This file is indexed.

/usr/share/tkgate/doc/gateLibrary.html is in tkgate-doc 2.0~b10-4ubuntu2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
   <TITLE>TKGate User Documentation (Libraries)</TITLE>
    <META http-equiv="Content-Style-Type" content="text/css">
   <link rel="stylesheet" href="tkgate.css" type="text/css">
</HEAD>
<BODY>

<a name=vpdexamples>
<h2>9. TkGate Library Components</h2>

The TkGate distribution includes four libraries that can be loaded
through the library manager.  Components from these libraries can be
used to add additional functionality to your designs.  To use one of
the libraries, open the library manager with the <img
src=fig/file_lib.gif class=tool> toolbar button and select the library
you wish to load.  You can then locate the module you wish to use in
the module hierarchy and drag it onto the main window canvas to create
an instance of it.  The libraries that are available with TkGate are
described in the following sections.

<a name=tty>
<h3>9.1 TTY</h3>

<div class=rfig>
<a name=ttywin>
<a href="fig/ttywindow.gif"><img src=fig/small-ttywindow.gif><br>
(Click to Enlarge)</a><br><br>
<b>Figure 9.2: TTY Device Window</b>
</div>

The TTY library, <tt>tty</tt> provides a Virtual Peripheral Device
(VPD) modeling a TTY device.  The TTY supports input and output and
models an interactive TTY terminal.  You can use it in your design to
provide textual interaction with the user.  When you start the
simulator, one TTY window will appear for each instance of a TTY VPD
in your design.  Your design can send characters to and receive
characters from the TTY device.
<p>

<div class=lfig>
<a name=ttydev>
<img src=fig/tty.gif><br><br>
<b>Figure 9.1:<br>TTY Device</b><br><br>
</div>
To use the TTY device, open the library manager with the <img
src=fig/file_lib.gif class=tool> 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.
<p>
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.

<p style="clear: right;">

<div class=rfig>
<a name=txchar>
<img src=fig/txchar.gif><br><br>
<b>Figure 9.3:<br>Transmit Character</b>
</div>

To send a character to a TTY device, use the following protocol (see
Figure 9.3):
<ul>
<li> Unassert the DSR line.
<li> Wait for the DTR (Data Terminal Ready) line to be low.
<li> Drive the RD line with the ASCII code of the character to be transmitted.
<li> Assert the DSR (Data Set Ready) line.
<li> Wait for the DTR line to go high.
<li> Unassert the DSR line
</ul>
<p style="clear: right;">

<div class=rfig>
<a name=rxchar>
<img src=fig/rxchar.gif><br><br>
<b>Figure 9.4:<br>Receive Character</b>
</div>

To receive a character from the TTY device, use the following
protocol(see Figure 9.4):
<ul>
<li> Unassert the CTS line.
<li> Wait for the RTS line to go high.
<li> Read the received value on the TD line.
<li> Assert the CTS line.
<li> Wait for the RTS line to go low.
<li> Unassert the CTS line.
</ul>
<p>
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.

<h4>9.1.1 Forcing TTY Characters from Simulation Scripts</h4>

You can use a simulation script to force input into a TTY device.
This is done by using a special named channel
"<i>instaname</i><tt>.FORCE</tt>" where "<i>instaname</i>" is the
fully instantiated instance name of the TTY.  You can use the <a
href="systemTasks.html#tkg_send"><tt>$tkg$send</tt></a> system task to
send the string to be forced.  For example, to force the input
"<tt>Hello World</tt>" into the TTY named "<tt>main.memory.tty0</tt>",
you could use the simulation script:

<pre>
  initial
    begin
      # 10000 ;
      $tkg$send("main.memory.tty0.FORCE","Hello World");
  end
</pre>


<br style="clear: right;">


<a name=drink>
<h3>9.2 Drink Vending Machine</h3>

<div class=rfig>
<a name=drinkdev>
<center>
<img src=fig/cokemachine.gif><br><br>
</center>
<b>Figure 9.5: Drink Machine Device</b>
<br><br>
<a name=drinkwin>
<a href="fig/cokemachinewin.gif"><img src=fig/small-cokemachinewin.gif><br>
(Click to Enlarge)</a><br><br>
<b>Figure 9.6: Drink Machine GUI</b>
</div>

The drink vending machine library, "<tt>coke</tt>", provides a Virtual
Peripheral Device (VPD) modeling a drink vending machine.  The device
provides input and output signals for the actuators and sensors in the
virtual vending machine.  You can use this device to design a vending
machine circuit that controls an interactive model of a vending machine.
<p>
To use the drink machine device, open the library manager with the
<img src=fig/file_lib.gif class=tool> toolbar button and load the
"<tt>coke</tt>" library.  You can then locate the <tt>cokemachine</tt>
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.
<p>
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.
<p>
The following interactions can be made through the drink machine GUI:
<ul>
<li>Coins are inserted by dragging them from the user's stock of cash in
the upper left corner to the coin slot.
<li>Bills are inserted by dragging them from the user's stock of cash in 
the upper left corner to the bill reader.
<li> Fake bills can be dragged to the bill reader to test if the
control logic detects and rejects them correctly.
<li> Drink selections are made by pressing the drink buttons on the external view.
<li> Pressing the coin return lever should cause inserted coins to be returned.
<li> Purchased drinks appear in the margin along the bottom.
</ul>
<p>
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.

<p style="clear: both;">
The input signals on the drink machine and their function are as follows:
<p>
<table class=display>
<tr><th width=100>Signal</th><th align=left>Description</th></tr>
<tr><td colspan=2><hr></td></tr>

<tr><td class=tt>DISP</td><td class=wide>

<b>Dispense</b> - 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 <tt>DISPACK</tt> (Dispense Acknowledge) signal is
low.  The asserted bit should remain high until the <tt>DISPACK</tt>
signal goes high.</td></tr>

<tr><td class=tt>ELIGHT</td><td class=wide>

<b>Empty Light</b> - 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.</td></tr>


<tr><td class=tt>CHGQ<br>CHGD<br>CHGN</td><td class=wide>
<b>Dispense Change</b> - Drop a quarter (<tt>CHGQ</tt>), dime
(<tt>CHGD</tt>) or nickel (<tt>CHGN</tt>) from the "Change" bin.  Only
one of these signals (or the <tt>CHGCOM</tt> or <tt>RETINS</tt>
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
<tt>CHGACK</tt> (Change Acknowledge) signals is low.  The Dispense
Change signal should be held high until the <tt>CHGACK</tt> signal
goes high.</td></tr>

<tr><td class=tt>NOCHG</td><td class=wide> <b>No Change</b> - If asserted,
illuminates the "No Change" light on the vending machine to indicate
that change can not be made.</td></tr>

<tr><td class=tt>BILLIN</td><td class=wide>
<b>Bill In</b> - 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 <tt>BILLACK</tt> (Bill
Acknowledge) signal is low.  The Bill In signal should be held high
until the <tt>BILLACK</tt> signal goes high. 
</td></tr>

<tr><td class=tt>BILLLT</td><td class=wide><b>Bill Light</b> - This signal
illuminates the light on the bill reader.</td></tr>

<tr><td class=tt>BILLOUT</td><td class=wide> <b>Bill Out</b> - 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 <tt>BILLACK</tt> (Bill Acknowledge) signal is
low.  The Bill Out signal should be held high until the
<tt>BILLACK</tt> signal goes high.

<tr><td class=tt>CHGCOM</td><td class=wide><b>Change Commit</b> - 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
<tt>CHGACK</tt> (Change Acknowledge) signals is low.  The Dispense
Change signal should be held high until the <tt>CHGACK</tt> signal
goes high.</td></tr>

<tr><td class=tt>RETINS</td><td class=wide><b>Coin Return</b> - 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 <tt>CHGACK</tt> (Change Acknowledge)
signals is low.  The Dispense Change signal should be held high until
the <tt>CHGACK</tt> signal goes high.</td></tr>

<tr><td class=tt>INSACK</td><td class=wide><b>Insert Acknowledge</b> -
This signal should be raised after seeing a positive edge on the
<tt>INSQ</tt>, <tt>INSD</tt> or <tt>INSN</tt> signals indicating that
a coin was inserted.</td></tr>

<tr><td>COST</td><td class=wide><b>Drink Cost</b> - This signal drives
the drink cost displayed on the external view of the vending machine.
It should be the cost in nickels.</td></tr>

<tr><td>RESET</td><td class=wide><b>Reset</b> - 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.</td></tr>
</table>

<p>
The output signals on the drink machine and their function are as follows:
<p>

<table class=display>
<tr><th width=100>Signal</th><th align=left>Description</th></tr>
<tr><td colspan=2><hr></td></tr>

<tr><td>PRESS</td><td class=wide><b>Button Pressed</b> - Each bit is
for one of the six buttons on the drink machine and is asserted while
the corresponding button is pressed.</td></tr>

<tr><td>EMPTY</td><td class=wide><b>Empty Sensor</b> - 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.</td></tr>

<tr><td class=tt>INSQ<br>INSD<br>INSN</td><td class=wide>

<b>Coin Inserted</b> - These signals indicate that a quarter
(<tt>INSQ</tt>), dime (<tt>INSD</tt>) or nickel (<tt>INSN</tt>) have
been inserted.  A rising edge indicates the insertion.  The
controlling circuit should assert the <tt>INSACK</tt> signal to
acknowledge the insertion.</td></tr>


<tr><td class=tt>NUMQ<br>NUMD<br>NUMN</td><td class=wide> <b>Change
Available</b> - Indicates the number of quarters (<tt>NUMQ</tt>),
dimes (<tt>NUMD</tt>) and nickels (<tt>NUMN</tt>) available for making
change (up to 7).  If there are more than 7 coins of a type available,
then the signal will indicate 7.</td></tr>

<tr><td>BILLSNS</td><td class=wide><b>Bill Sense</b> - A high value indicates that
a bill is sensed in the bill insertion slot.  The controlling circuit
should assert <tt>BILLIN</tt> to feed the bill into the bill tester</td></tr>

<tr><td>BILLOK</td><td class=wide><b>Bill OK</b> - A high value
indicates that the bill in the bill tester is a valid bill.</td></tr>

<tr><td>CNRET</td><td class=wide><b>Coin Return Request</b> - A high
value indicates that the user is pressing the coin return lever.</td></tr>

<tr><td>BILLACK</td><td class=wide><b>Bill Acknowledge</b> - This
signal is asserted to acknowledge a <tt>BILLIN</tt> or <tt>BILLOUT</tt>
signal.</td></tr>

<tr><td>CHGACK</td><td class=wide><b>Change Acknowledge</b> - This
signal is asserted to acknowledge a <tt>CHGQ</tt>, <tt>CHGD</tt>,
<tt>CHGN</tt>, <tt>CHGCOM</tt> or <tt>RETINS</tt> signal.</td></tr>

<tr><td>DISPACK</td><td class=wide><b>Dispense Acknowledge</b> - This
signal is asserted to acknowledge a <tt>DISP</tt> signal.</td></tr>

<tr><td>BILLNG</td><td class=wide><b>Bill No Good</b> - This signal is
asserted to indicate that a fake bill is in the bill tester.</td></tr>
</table>


<a name=timer>
<h3>9.3 Timers and One-Shots</h3>

Timers and one-shots are devices that operate in real time.  To use a
timer or one-shot device, open the library manager with the <img
src=fig/file_lib.gif class=tool> toolbar button and load the "timer"
library.  You can then locate the desired device in the module list or
module hierarchy and drag it onto the main window canvas to create an
instance of it.

<h4>9.3.1 OSCILLATOR Device</h4>

<div class=rfig>
<img src=fig/oscillator.gif><br>
<b>Figure 9.7:<br>Oscillator</b>

</div>

The <tt>OSCILLATOR</tt> device provides a signal that oscillates at a
set frequency in real-world time.  You can use it to design circuits
such as digital clocks using the LED gates.  The default frequency is
one hertz.  To change the frequency, double click on the OSCILLATOR
module to open the <a href="gateEdit.html#gateprops">Gate
Properties</a> dialog box and select the "Parameters" tab.  Set the
"HZ" parameter to the desired period in milliseconds. 


<br style="clear: right;">
<h4>9.3.2 ONESHOT Device</h4>

<div class=rfig>
<img src=fig/oneshot.gif><br>
<b>Figure 9.8:<br>One Shot</b>
</div>

A one-shot device asserts its output a set time period after being
reset by the input.  The ONESHOT is triggered by an active low signal.
You can connect the input to ground, to cause the ONESHOT device to
assert its output after a set amount of real-world time after the
simulation begins.  Raising the input and lowering it again resets the
one-shot.  The default delay is one second.  To change the time delay
of the ONESHOT, double click on it to open the <a
href="gateEdit.html#gateprops">Gate Properties</a> dialog box and
select the "Parameters" tab.  Set the "HZ" parameter to the desired
delay in milliseconds.

<a name=ttl>
<h3>9.4 TTL Devices</h3>

The TTL device library provides access to a small number of commonly
used 7400 series TTL modules. To use this library, open the library
manager with the <img src=fig/file_lib.gif class=tool> toolbar button
and load the "74xx" library.  You can then locate the desired device in
the module list or module hierarchy and drag it onto the main window
canvas to create an instance of it. The supported devices are: 
<p>
<table class=display>
<tr><th align=left width=100>Device</th><th align=left>Description</th></tr>
<tr><td colspan=2><hr></td></tr>
<tr><td><tt>7400</tt></td><td>Quad 2-input NAND gates</td></tr>
<tr><td><tt>7402</tt></td><td>Quad 2-input NOR gates</td></tr>
<tr><td><tt>7404</tt></td><td>Hex Inverters</td></tr>
<tr><td><tt>7408</tt></td><td>Quad 2-input AND gates</td></tr>
<tr><td><tt>7410</tt></td><td>Tri 3-input NAND gates</td></tr>
<tr><td><tt>7430</tt></td><td>8-input NAND gate</td></tr>
<tr><td><tt>7432</tt></td><td>Quad 2-input OR gate</td></tr><tr>
<tr><td><tt>7474</tt></td><td>Dual D-Latch, edge triggered with clear and preset</td></tr>
<tr><td><tt>7486</tt></td><td>Quad 2-input XOR gates</td></tr>
<tr><td><tt>74154</tt></td><td>4-16 Decoder</td></tr>
<tr><td><tt>74157</tt></td><td>Quad 2-1 Mux</td></tr>
<tr><td><tt>74163</tt></td><td>4-bit Synchronous Counter</td></tr>
<tr><td><tt>74175</tt></td><td>Quad D-Latch, edge triggered with clear</td></tr>
</table>
<p>
Please see standard TTL data sheets for a description of these devices.

</body>
</html>