To use the TTY device, open the library manager with the toolbar button and load the "tty" library. You can then locate the module in the module list or module hierarchy and drag it onto the main window canvas to create an instance of it. Figure 9.1 shows the external view of the TTY instance which is defined with a symbolic module interface.
When a design containing the TTY device is simulated, it will open a window such as the one shown in Figure 9.2 (after the design has been running for a while). The text shown in this window was transmitted from the "Menagerie CPU" example. Keys pressed while the window has focus will be transmitted back to the controlling design.
To send a character to a TTY device, use the following protocol (see Figure 9.3):
To receive a character from the TTY device, use the following protocol(see Figure 9.4):
Note that transmitting a character to the TTY uses "RD" and receiving a character from the TTY uses "TD" because the RD and TD are named from the perspective of the TTY device.
initial begin # 10000 ; $tkg$send("main.memory.tty0.FORCE","Hello World"); end
To use the drink machine device, open the library manager with the toolbar button and load the "coke" library. You can then locate the cokemachine module in the module hierarchy and drag it onto the main window canvas to create an instance of it. Figure 9.5 shows the external view of the cokemachine instance.
The virtual drink vending window that appears when you start the simulation is shown in Figure 9.6. It is comprised of an external view (left side) and an internal view (right side). The external view includes buttons that can be pressed to make a drink selection, a coin slot, and a bill reader.
The following interactions can be made through the drink machine GUI:
The internal view shows the columns of drinks that are available in the machine, the status of the bill scanner, the coins that have been inserted (but not used for a purchase), the coins that have been committed to a purchase, and coins that are available to make change.
The input signals on the drink machine and their function are as follows:
Signal | Description |
---|---|
DISP | Dispense - Each of the six bits dispenses a drink from one of the six columns. Drinks are dispensed on the rising edge of the signal. Only one bit should be asserted at a time, and only after ensuring the the DISPACK (Dispense Acknowledge) signal is low. The asserted bit should remain high until the DISPACK signal goes high. |
ELIGHT | Empty Light - Each bit corresponds to the empty light on each of the six buttons. If a bit is asserted, then the corresponding empty light will be illuminated. |
CHGQ CHGD CHGN | Dispense Change - Drop a quarter (CHGQ), dime (CHGD) or nickel (CHGN) from the "Change" bin. Only one of these signals (or the CHGCOM or RETINS signals) may be asserted at a time. Change is dropped on the rising edge of the signal. The signal should not be raised unless the CHGACK (Change Acknowledge) signals is low. The Dispense Change signal should be held high until the CHGACK signal goes high. |
NOCHG | No Change - If asserted, illuminates the "No Change" light on the vending machine to indicate that change can not be made. |
BILLIN | Bill In - Drives the bill motor to feed the inserted bill into the bill tester. Bills in the bill tester will be dropped into the "Collected" bin. The motor is activated on a positive edge of this signal. This signal should not be raised unless the BILLACK (Bill Acknowledge) signal is low. The Bill In signal should be held high until the BILLACK signal goes high. |
BILLLT | Bill Light - This signal illuminates the light on the bill reader. |
BILLOUT | Bill Out - Drives the bill motor to feed out the bill currently in the bill tester. The motor is activated on a positive edge of this signal. This signal should not be raised unless the BILLACK (Bill Acknowledge) signal is low. The Bill Out signal should be held high until the BILLACK signal goes high. |
CHGCOM | Change Commit - This signal commits any change in the "Inserted" area to the "Collected" area. Change is committed on the rising edge of this signal. The signal should not be raised unless the CHGACK (Change Acknowledge) signals is low. The Dispense Change signal should be held high until the CHGACK signal goes high. |
RETINS | Coin Return - This signal returns any change in the "Inserted" area back to the user. Change is returned on the rising edge of this signal. The signal should not be raised unless the CHGACK (Change Acknowledge) signals is low. The Dispense Change signal should be held high until the CHGACK signal goes high. |
INSACK | Insert Acknowledge - This signal should be raised after seeing a positive edge on the INSQ, INSD or INSN signals indicating that a coin was inserted. |
COST | Drink Cost - This signal drives the drink cost displayed on the external view of the vending machine. It should be the cost in nickels. |
RESET | Reset - Resets the drink machine. This is an active low signal. It should be driven low to reset the machine, then kept high while using the device. |
The output signals on the drink machine and their function are as follows:
Signal | Description |
---|---|
PRESS | Button Pressed - Each bit is for one of the six buttons on the drink machine and is asserted while the corresponding button is pressed. |
EMPTY | Empty Sensor - Each bit corresponds to one of the drink columns and is asserted when the sensor indicates that there are no more drinks in a column. |
INSQ INSD INSN | Coin Inserted - These signals indicate that a quarter (INSQ), dime (INSD) or nickel (INSN) have been inserted. A rising edge indicates the insertion. The controlling circuit should assert the INSACK signal to acknowledge the insertion. |
NUMQ NUMD NUMN | Change Available - Indicates the number of quarters (NUMQ), dimes (NUMD) and nickels (NUMN) available for making change (up to 7). If there are more than 7 coins of a type available, then the signal will indicate 7. |
BILLSNS | Bill Sense - A high value indicates that a bill is sensed in the bill insertion slot. The controlling circuit should assert BILLIN to feed the bill into the bill tester |
BILLOK | Bill OK - A high value indicates that the bill in the bill tester is a valid bill. |
CNRET | Coin Return Request - A high value indicates that the user is pressing the coin return lever. |
BILLACK | Bill Acknowledge - This signal is asserted to acknowledge a BILLIN or BILLOUT signal. |
CHGACK | Change Acknowledge - This signal is asserted to acknowledge a CHGQ, CHGD, CHGN, CHGCOM or RETINS signal. |
DISPACK | Dispense Acknowledge - This signal is asserted to acknowledge a DISP signal. |
BILLNG | Bill No Good - This signal is asserted to indicate that a fake bill is in the bill tester. |
Device | Description |
---|---|
7400 | Quad 2-input NAND gates |
7402 | Quad 2-input NOR gates |
7404 | Hex Inverters |
7408 | Quad 2-input AND gates |
7410 | Tri 3-input NAND gates |
7430 | 8-input NAND gate |
7432 | Quad 2-input OR gate |
7474 | Dual D-Latch, edge triggered with clear and preset |
7486 | Quad 2-input XOR gates |
74154 | 4-16 Decoder |
74157 | Quad 2-1 Mux |
74163 | 4-bit Synchronous Counter |
74175 | Quad D-Latch, edge triggered with clear |
Please see standard TTL data sheets for a description of these devices.