SimUaid User Guide
SimUaid User Guide
User’s Guide
Software for Logic Simulation
Charles H. Roth, Jr
University of Texas at Austin
You can verify all of your circuit connections by the following procedure:
Move the mouse pointer over a wire and click while holding the Shift key down. All the
connections to that wire will be highlighted as a red dashed line. You can repeat this
procedure for each group of wires to ensure that all the wires are connected to the right
places.
Example: In the figure below, Gate1 is a part label; Pin1 and Pin3 are pin labels.
When a device is selected, its label is also selected. However, when a device’s
label or a pin’s label is selected, only the label is selected, not the entire device.
To select the entire circuit, choose Select All from the Edit menu.
0 Logic 0
1 Logic 1
Z The pin does not have an input, i.e. no connection was established.
X The output is undetermined because an input to the part was undetermined
or not connected.
To show the values of input and output pins, select Show I/O Values from the View
menu, or click on the Show I/O Values button .
Figure 2 illustrates the different values of input and output for a logic circuit.
Note that the connection between the switch and the wire to the top input of the AND
gate is bad because there is no black dot at the intersection. Therefore, the input to the
AND gate is Z, and the output of the AND gate is X.
a. First, place the gates on the circuit diagram. To do this, pull down the parts menu
and select the AND-2 input (2-input AND) gate from the submenu. Use the mouse
6 SimUaid User’s Guide
to position the first AND gate where you want it and click to place it. Use the
mouse to position the second AND gate and click to place it.
b. Then pull down the parts menu and select the OR-2 input (2-input OR) gate on the
OR submenu. Use the mouse to position the OR gate and click to place it.
c. Next pull down the Parts menu and select Switch→right. Use the mouse to place
four switches in the desired locations on the screen.
d. To display the logic levels of each pin, select Show I/O Values from the View
menu or click the button. The logic levels {1, 0, Z, or X} will appear above the
input and output pins of each component in the circuit.
e. Next, connect the pins of the parts with wires. The general procedure for drawing
a wire on the screen is as follows:
i. Click on the Wire option from Edit Menu (or the button). The pointer
becomes a cross hair.
ii. Click the left mouse button at the starting point of the wire.
iii. Move the mouse to the ending point, and click there. If you wish to change
the routing of the wire you may click at additional intermediate points as you
draw the wire.
f. If you need to move a gate or device, select the Move option from Edit menu or
the button. Position the mouse to the middle of a gate or device and drag it to
its new location. The connecting wires will follow along.
g. Next we will label the switches. Select Label in the Edit menu or click on the
button. Note that the cursor becomes a pencil. Move the tip of the pencil to the
middle of the top switch and click. Type in the label A followed by Enter. Now
use the pencil tip to select the next switch, and type in the label B. In a similar
manner, label the next two switches C and D.
h. Your circuit is now complete and should look similar to the one in Figure 3. You
are ready to simulate your circuit.
The same circuit is redrawn below, with wired connections for A and A’, and
virtual connections for B, B’, C, and C’. In order to make this work, B, B’, C, and C’
must be pin labels. Using B' as a pin label does not actually complement B; you still
must use an inverter with a B' output. To label a pin, first click on the ABC button on the
SimUaid menu. Then use the pencil cursor and click on a device pin (not on the device
itself). Type the label and hit return. The label should appear in black near the pin.
Then you may move the label anywhere you want it, but do not move it too far away
from the pin.
After you have input your circuit, select Show I/O values on the View menu.
Every device input should be 0 or 1. If any input or output is X or Z, you have a bad
connection, and you should fix this before continuing. In the above diagram, note that
the switch output pin labeled B has a 0 value, and the gate input pin labeled B has a 0
value, even though no visible wire appears between the two pins. Similarly, the pins
labeled B’ both have a 1 value.
To check if your output is flowing to the next page, you can check the Print
Preview from the File menu. The print preview shows how your design will look when
printed on one or more pages. Click on the Close button to Close the Print Preview and
return to the design.
If your output is too large or too small, you can select Set Scaling Factor from the
View menu to make your circuit the desired size. Select Fit to Window from the View
menu to scale the circuit to just fit in the visible window.
To add a comment to your circuit, select comment on the edit menu, type in your
comment, and then hit F12.
To toggle the switch between logic 0 and 1, click on the icon or press Ctrl+S
to switch to the select mode. Then, click on middle of the switch. This will cause the
switch to toggle. To simulate the circuit, just toggle the switches and observe the output
values from the probes. The output values will change to reflect the different input
signals that are being fed into your circuit. (If the output values do not change
immediately, reset the simulator by clicking on the Reset option on the Simulate menu or
the button. If this does not fix the problem, you may have accidentally quit the Live
Mode. In the "Simulate" pull-down menu, be sure that the "Change Button" does NOT
have a check mark next to it. The Change Mode allows advanced users to analyze circuit
timing, but we will not discuss it here.)
EXAMPLE:
Following the example in the previous section, click on the button to change to
the Select mode. Then set the switches to A = 0, B = 1, C = 1, and D = 1. You can do so
by clicking on each switch until the desired input is obtained. Then, observe that the
circuit output is logic 1, as shown in the Figure 4.
SimUaid User’s Guide 9
Continuing in this manner, you can observe the outputs of the circuit for the
desired input combinations and see if it works correctly.
a. Start with a new empty circuit window on the screen. Select the D flip-flop from
the Parts menu and position it in the center. The clock input at the lower left is
marked with a small triangle. This flip-flop changes state at the rising edge of
the clock signal. Also note that the active-low Preset and Clear inputs are
labeled "S" and "R" respectively.
Figure 5. D flip-flop
10 SimUaid User’s Guide
c. Click on the switches as required to set all inputs to 0 and then set the D input to
1. Next, input a rising edge on the CLOCK by changing the switch from 0 to 1.
Why did the flip-flop state Q remain at 0? Because having both Preset (S) and
Clear (R) equal to 0 at the same time is an illegal input combination. Also, note
that the Preset and Clear inputs are asynchronous inputs; they determine the flip-
flop state regardless of the clock. Correct this condition by setting Preset (S) to 1
and then Clear (R) to 1. At this point you should have Q = 0 since the Clear
input was 0 (and so active) briefly before it was set to 1. If you input another
rising edge at the CLOCK input, the flip-flop will now change to Q = 1 in
response to the D input.
d. Verify the operation of Clear (R) by setting it to 0 and then back to 1. Then
verify Preset (S) in the same way.
e. Starting with Q = 0, D = 0, and CLOCK = 1, change the clock input to 0 and
back to 1. Note that Q will remain 0. Now change D to 1 and change the clock
to 0 and back to 1. Q will change to 1. (Note that the flip-flop changes state just
after you change the clock from 0 to 1). Then set D = 0 and toggle the clock
again. When does the flip-flop change state?
The default propagation delay for all parts is 1 ns. You might want to change the
delays for individual parts, if it is required for your simulation. To do so, click on the
icon or select Delay from the Edit menu, then click on the part you want to set a special
delay for. The Propagation Delay dialog box appears so you can enter the delay for the
part in ns.
You can change the default delay for all parts by selecting Default Delay from the
Edit menu. After you have entered the default delay, all the devices you place on the
circuit will have this propagation delay until you change the default delay again. Devices
that are on the circuit before this command is executed will not be affected.
The input signal can be set up as shown in Figure 8. The values are for a sequence
1100 1011 01. To enter new values, enter the Time in ns and the associated input signal
value. Then click Add/Modify. To delete a value, click on the row of the value and click
Delete. The values can be 1, 0, X, Z, or R. After updating the input signal, you must
click reset on the toolbar before running the simulation. For more information, refer to
the SimUaid Reference Manual.
12 SimUaid User’s Guide
The outputs of the simulation are displayed in a timing waveform chart. Click on
the Open Timing Diagram command on the Window menu to bring up the timing chart.
Start the simulation by clicking on the Go option in the Simulate menu. This will
make the simulation run until it reaches the time limit. The Step command can be used to
run the simulation for one clock period. The Change command will run the simulation
until a value changes. The simulation can be stopped at any time by selecting the Stop
command.
You will need to place probes on the signals that you want to display on the
timing diagram. The order in which you place the probes will be the order of the timing
waveforms. Label each probe with the appropriate name so that the label will appear
next to the probe’s waveform in the timing window. Probes without labels will have “??”
appearing next to their timing waveform.
Figure 9 shows an example of a timing diagram for the circuit shown in Figure 6.
The horizontal scale of the waveforms can be adjusted by using the Scale option from the
Options menu.
a. Make sure you know what the output should be in every case. Double-check that
according to the inputs you are giving, you are reading the output at the correct
time and that the output is really incorrect.
b. Select Show I/O Values from the View menu so you can see what all the device
inputs and outputs are. After resetting the circuit, if any of the input or output
values are X or Z, this usually indicates a bad connection.
d. Since we can assume the output is incorrect or you would not need to debug, first
look at the inputs to the output gate. Are they correct? If not, figure out what they
must be to be correct and write it down. Figure out how to get that value from the
input gates.
e. If the inputs to the output gate are correct, keep working your way backward
through the circuit until you find which inputs are wrong. Most likely, you either
have wires that are connected incorrectly (or not connected at all) or your design
is slightly incorrect.
To fit your output on the preferred number of pages, try selecting File, Print
Setup, and then select the Landscape option. This will print the output sideways to make
it fit on fewer pages. Also, you can try selecting different scales from the Options menu,
then checking the Print Preview to ensure your output will look the way you want it.
14 SimUaid User’s Guide
To generate VHDL code that represents your circuit, follow this procedure:
a. First, create your design in SimUaid and save it the usual way.
b. Test your circuit and simulate it to ensure that it works according to the
specification.
c. Add probes to all outputs. The order in which the probes are added will determine
the order in which they are listed in the VHDL file.
d. Make sure that all device labels and pin labels are valid VHDL identifiers. The
only exception is that you may label pins with a single character followed by a
prime (A', B', for example). The code generator replaces A' with A_p and B' with
B_p to conform to VHDL syntax.
e. Ensure that all input and output devices have labels, and that none of the labels
conflict.
f. Select the Save VHDL option from the file menu in SimUaid.
g. Select Synthesizable VHDL from the pull-down menu if you want to generate
synthesizable code. Select VHDL for Simulation Only if you want to preserve
the delays that are associated with the SimUaid circuit and use a VHDL simulator
to observe timing waveforms.
h. Type in a valid VHDL identifier for a filename and click on Save to save your
file.
i. If an error message appears and the save operation fails, correct all errors
according to the error messages.
Your circuit will be saved as VHDL code, with all switches and input devices
becoming inputs, and all probes and 7-segment indicators becoming outputs. You can use
this VHDL in other programs to simulate the operation of a digital system.
SimUaid User’s Guide 15
The N-bit parts are complex parts, such as adders, registers, and counters, which have
multiple data inputs and outputs. Refer to Appendix A of the SimUaid Reference Manual
for descriptions of these parts. Typical N-bit parts have N data inputs or outputs along
with other control inputs. Each data input accepts a single-bit signal and connections are
made using wires. In contrast, bus parts use bus inputs and outputs for data. Each bus
represents and array of N signals, and connections are made using busses instead of
wires.
To show how to use N-Bit parts, we will construct an adder that has a register to store the
sum.
a. From the Parts menu, select N-Bit Parts, Register. Do not enable the Busses
checkbox. Place the register.
b. Now, select Parts, N-bit parts, Adder. Again, do not enable the Busses
checkbox. Place the adder.
c. Connect the adder and register and add probes and switches as shown in Figure
10. Select show I/0 values on the view menu.
d. To test the adder, make sure to set the CLR switch to 0, LD to 1, and Cin to 0.
Set X3-X0 to the bits of the first input and Y3-Y0 to the bits of the second
addend. Notice that when you flip the X and Y switches, the adder output
changes (since it is a combinational circuit) but the register output does not
change because it is clocked.
16 SimUaid User’s Guide
e. Set the CLK to 0, then back to 1, and see that the adder output is loaded into the
register. Notice that no matter how many times you “clock” the register (set CLK
to 1 then back to 0), the sum does not change, because this adder does not have an
accumulator.
f. If you are not getting the proper result from the adder, ensure that LD, CLR, and
Cin are set correctly. LD should be 1, CLR should be 0, and Cin should be 0
unless you want a carry in.
Use a Bus Input to assign a value to a Bus or a Bus Pin. Click on a Bus Input in LABEL
mode to enter the hex string value. You cannot label Bus Input devices; you can only
assign them a hex value. Enter the hex string without any leading characters, and ensure
that it is of the proper length considering the width of the bus..
To show how to use bus parts, we will construct an adder similar to the one we created
with N-bit parts.
a. From the Parts menu, select N-bit parts and then Register for Adder. Enable
the Busses checkbox. Place the register.
b. Now, select Parts, N-bit parts, Adder for Register. Again, enable the Busses
checkbox. Place the adder. Note that the Adder for Register is functionally the
same as the Adder, but the adder output is at the bottom instead of the top.
c. Connect the adder and register as shown in Fig. 11 using the wiring tool in the
same way you use it to connect wires. The wiring tool can sense that you are
connecting two busses, and will do this properly without you doing anything out
of the ordinary.
SimUaid User’s Guide 17
d. Now, select Parts, N-bit parts, Bus Input. Connect the bus input to the bottom
input of the Adder for register.
e. Connect RS, LS, Lin, and Rin to ground, because we will not be right-shifting or
left-shifting this time.
f. Now, select Parts, N-bit parts, Bus Probe. Connect the bus probe to the output
of the Register for Adder as shown in Figure 11.
g. Add a probe and switches as shown in Figure 11. Select show I/O values on the
view menu.
h. To test the adder, make sure to set the CLR switch to 0, LD to 1, and Cin to 0. To
set the bus input, select the labeling tool and click on the bus input. Type the hex
value you want to input.
i. To input the first value into the accumulator, set the CLK switch to 1 and then
back to 0. The bus probe should show the value you just input.
j. To add another number to the accumulator, set the bus input as desired, and then
set CLK to 1 and then back to 0. The bus probe should show the sum.
k. If you are not getting the proper result from the adder, ensure that LD, CLR, and
Cin are set correctly. LD should be 1, CLR should be 0, and Cin should be 0
unless you want a carry in.
18 SimUaid User’s Guide
We will construct a simple state machine and the corresponding state graph table based
on the Mealy state graph shown in Figure 13, which is the control state graph for a
multiplier (see Figure 18-9 in Fundamentals of Logic Design, 5th Ed.).
a. From the Parts menu, select Other Parts, State Machine. Change the
number of inputs to 3, and then place the state machine.
b. Next, using the labeling tool, label the state machine as shown in Figure 14.
c. Right-click on the state machine to open the state graph table, and then input
the data as shown in Table 1. SimUaid syntax-checks the data as you enter
each row, so it is able to catch some typing mistakes. Each row in the table
represents one arc in the state graph. For example, the second row in the table
SimUaid User’s Guide 19
indicates that if the present state is S0 and the input is St = 1, then the output
will be LdM = 1 and the next state will be S1. If two signal names appear in
the same input cell, they must be separated by a space or a prime (K M' or
K'M'). Similarly, spaces are required between signal names in an output cell.)
d. Your state graph table should look like the one in Figure 15.
e. Reset the state machine by clicking the reset icon on the toolbar. To test the state
machine, connect switches to all of the inputs. The active row in the table (the one
that corresponds to the current state and input), will be shown in blue, and the other
rows will be green. Note that when you change the appropriate input switch, the
active row in the table changes, but the state does not. When you clock the state
machine by flipping the clock input switch from 0 to 1, the active row should
change to the appropriate next state.