0% found this document useful (0 votes)
335 views

SimUaid User Guide

The document provides instructions for using SimUaid software to simulate logic circuits. It describes how to enter a logic diagram by placing parts, connecting wires, labeling components, and setting input/output values. Examples are given to illustrate how to construct a simple logic circuit in the software.

Uploaded by

MARIA BALDIVIAN
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
335 views

SimUaid User Guide

The document provides instructions for using SimUaid software to simulate logic circuits. It describes how to enter a logic diagram by placing parts, connecting wires, labeling components, and setting input/output values. Examples are given to illustrate how to construct a simple logic circuit in the software.

Uploaded by

MARIA BALDIVIAN
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

SimUaid

User’s Guide
Software for Logic Simulation

Charles H. Roth, Jr
University of Texas at Austin

April 20, 2003


2 SimUaid User’s Guide

SimUaid User’s Guide


SimUaid is a computer program that can be used to simulate logic circuits. Using
SimUaid, you can input a logic diagram and display it on the computer screen. After
inputting the diagram for a logic circuit, you can simulate its operation by applying 0's
and 1's to the input pins and observing the circuit outputs on the screen. In this way you
can verify that your design is correct before actually building it in lab.

Note: Depending on the operating system and configuration of your computer,


you may experience some problems displaying the parts on the screen. If the parts do not
appear properly on your screen, change the graphics mode. You can do so by selecting
the Change Graphics Mode command on the View menu.
When you select this option, a dialog box appears on screen to allow you to select
one of the two graphics modes available in SimUaid. The modes are “Change component
size” and “Same component size” mode. “Same component size” will make the
components look relatively larger at higher resolutions, and relatively smaller at lower
resolutions. Conversely, “Change component size” will make the components look the
same size in relation to other screen elements, regardless of the resolution. Choose the
mode that works bests with your operating system and computer configuration. You
should close all circuit windows before changing the screen resolution.

1. Entering a logic circuit


Start with a new circuit window by selecting New from the File menu or by
clicking the button.

1.1. Placing a part


To place parts onto the circuit window, click on the Parts menu and select the
desired part. The mouse pointer will be changed into the symbol of the selected part.
Move the mouse over the circuit window and place the part in the desired location by
clicking the left mouse button. The same part will continue to be placed until you select
another part or action.

1.2. Connecting the wires


To connect a wire from one part to another, first select the Wire option from the
Edit menu, or simply click the button from the toolbar at the top of the circuit
window. The mouse pointer becomes a cross. Move the center of the cross to an input or
output pin of a part and click on it. A beep will sound if the wire is connected to that pin.
If there is no beep, this means that the wire is not connected to anything. After clicking
on the pin, you can click on anywhere on the circuit window to establish a corner point
for the wire. To establish a connection to the next part, just click on the input or output
pin of the part. Again, you will hear a beep if the wire is connected to the pin of the part.
SimUaid User’s Guide 3

When drawing the connecting wires, be careful to avoid unnecessary crossed


wires. This will help minimize the number of errors, and it will be easier to debug the
circuit. The following are examples of good and bad connections. Note that when two
wires touch each other, there is no connection unless a black dot appears at the
intersection.

Figure 1. Circuit Connections

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.

1.3. Labeling parts and pins


You can label each part by clicking on the Label option on the edit menu
or by clicking the button. The mouse pointer will change into a pencil. Move the
pencil point over the middle of the part you want to label and click. Enter the desired
label, and then hit Enter. The part label is red and will be placed above the part. To label
a pin, follow the same procedure, except click on a pin. The pin label is black and will be
placed beside the pin.
4 SimUaid User’s Guide

Example: In the figure below, Gate1 is a part label; Pin1 and Pin3 are pin labels.

1.4. Selecting devices and labels


Clicking on a wire segment highlights only that segment; however, clicking on a
wire segment while holding down the shift key highlights the entire net which contains
that segment. This helps you to observe the interconnection of wires, and know which is
connected to which.

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.

1.5. Deleting devices and wire segments


Choose Select on the Edit menu or the button on the toolbar. Move the tip of
the Pointer to the center of a device or wire segment and click. Then hit the delete key or
click the button.

1.6. Moving a device


Select Move on the Edit menu or the button on the toolbar. Position the hand
in the middle of the device or gate to be moved. Hold down the mouse button and drag
the device or gate to the desired position. The connecting wires will follow along. Note:
If the program will not allow you to move a device, it is probably because moving the
device would make the diagram difficult to read. To move a device a small distance, you
can use the "nudging" feature. First click the button on the tool bar, then select the
device you want to move, and use the four arrow keys on the keyboard to move it.

1.7. Moving a wire or label


The procedure is similar to that for moving a device. To move an entire circuit,
click on the button, and then click on Select All on the Edit menu.

1.8. Deleting a group of wires (called a net)


Choose Select on the Edit menu or the button on the toolbar. Move the tip of
the pointer to a wire in the net to be deleted. Click on the wire while holding down the
Shift key. This will highlight the entire wire net to be deleted. Then hit the delete key or
select delete from the Edit menu or the scissors icon on the toolbar.
SimUaid User’s Guide 5

1.9. Input and output values


The input and output signals can have four different values:

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.

Figure 2. Circuit with bad connection

1.10. Example for entering logic circuit


The following procedures will give you an idea of how to enter a simple logic
circuit. As an example, enter the following diagram into the circuit window:

Figure 3. Example circuit diagram

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.

1.11. Using Virtual Connections


The example given below explains the difference between wired and virtual
connections. If you enter all of the connecting wires in a SimUaid circuit diagram, the
diagram may become very cluttered and hard to read. The virtual connection feature in
SimUaid allows you to connect two device pins together without actually drawing the
wire. To make virtual connections, place a label on a device output pin. Then place the
same label on one or more device input pins. The output will be connected to the inputs,
even though the connecting wires are not shown on the screen.
SimUaid User’s Guide 7

The following example shows a logic circuit with no virtual connections:

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.

1.12. Redraw Window


You might want to redraw the window occasionally if your circuit looks like it is not
displayed correctly, or if your changes do not seem to take effect. To redraw the window,
select Redraw Window from the View menu.

1.13. Scaling and printing your circuit


Before printing your circuit by selecting Print from the File menu, ensure that the
output will look the way you want it to. You might want to fit the design on a certain
number of pages, or if it must use two pages, you might want it to flow to the right
instead of down. The vertical and horizontal dotted, red lines you see on the circuit
window are page boundaries. To keep your circuit on one page, you must fit it within the
left, uppermost rectangle.
8 SimUaid User’s Guide

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.

1.14. Adding comments

To add a comment to your circuit, select comment on the edit menu, type in your
comment, and then hit F12.

2. Simulating the logic circuit


You can simulate your circuit manually or by using the clock and input signals.

2.1. Manual Simulation


To manually simulate your logic circuit, you will need to connect switches to the
inputs of your logic circuit. Do so by selecting Switch from the Parts menu and placing
them on your design window. To observe the outputs of the logic circuit, you can place
probes on the output pins of your logic circuit. You can also select the Show I/O Values
from the View menu to make SimUaid display the input and output values of all the parts
in the design window.

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

Figure 4. Example circuit diagram

Continuing in this manner, you can observe the outputs of the circuit for the
desired input combinations and see if it works correctly.

2.2. Simulating Flip-Flops with SimUaid


SimUaid provides two types of flip-flops on the Parts menu—a J-K flip-flop
which changes state on the falling edge of the clock input, and a D flip-flop which
changes state on the rising edge of the clock input. Work through this exercise to
become familiar with using a D flip-flop.

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.

b. SimUaid requires that a signal be connected to every flip-flop input including


the preset and clear (S and R) inputs. Connect switches to the flip-flop inputs
and outputs as shown in Figure 5.

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?

2.3. Automatic Simulation


Automatic simulation is usually performed for sequential circuits, for example
circuits involving flip-flops. To automatically simulate your logic circuit, you will need
to insert a Clock and an Input Signal in your circuit design. The Input Signal will go in
place of the switches of the input to your logic circuit. Figure 6 gives an example of a
sequential logic circuit using automatic simulation. This circuit is named Mealy_ex.ckt
and is found in the SimUaid/examples folder.

Figure 6. Example for automatic simulation.


SimUaid User’s Guide 11

2.3.1. Configuring timing aspects for automatic simulation


Configure the Clock and Input Signal by clicking on the icon on the tool bar
and then clicking on the Clock or the Input Signal. Clicking on the clock will bring up
the Simulation Options dialog box. Here, you can configure the period of the clock, the
initial value of the Clock output, and the time limit of the simulation. Figure 7 below
shows the simulation options dialog box.

Figure 7. Simulation options

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

Figure 8. Input Signal configuration

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.

Figure 9. Timing diagram window


SimUaid User’s Guide 13

2.4. Debugging your circuit


SimUaid checks certain things about your circuit, such as whether pin or device
names conflict and whether you try to connect a output to another output, but you must
determine whether your circuit works according to your specifications, and correct any
errors you may notice.

Here are some hints on how to debug your circuits.

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.

c. Check to see if the output is always incorrect, or if it is only wrong in certain


cases. If it is only wrong in certain cases, get the circuit into a state in which the
outputs are wrong, and work backward from the output to determine the source of
trouble.

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.

2.5. Scaling and printing your waveform


You can scale your timing diagram to show the level of detail you want and make
it fit in the desired amount of space. To change the scale, select Scale from the Options
menu you see at the top of the screen when the Timing Diagram is selected. Select a
smaller time scale to zoom in or a larger time scale to zoom out. The 1 ns scale allows
you to see the smallest time unit (1 ns) in great detail.

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

3. Creating VHDL Code


SimUaid has the capability of generating structural VHDL code that corresponds
to a SimUaid circuit diagram. The VHDL code generator replaces input and output
devices in your circuit diagram with input and output port signals. The architecture body
of the code consists of a series of component instantiation statements. These components
are defined in two VHDL packages called SimUAid_Synthesis_Package.vhd and
SimUAid_Simulation_Package.vhd.

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.

j. Repeat steps e through i as necessary until the save operation succeeds.

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

4. Using N-Bit Parts, Busses, and State Machines


Using N-Bit Parts and Bus Parts

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.

Example of Using N-Bit Parts

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.

Figure 10. N-Bit Adder

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.

Using Busses and Bus Parts


A bus represents a group of wires. Connecting busses is the same as connecting wires—
use the wiring tool to connect bus inputs and outputs of the same width. When you select
an N-bit part from the parts menu, check "Busses" to create a bus part instead of an N-bit
part. The bus parts use busses for data inputs and outputs instead of individual wires.
When you combine N-bit parts and bus parts, you have to be careful to make sure they
will connect properly. Use a bus merger to convert a group of wires to a bus, and use a
bus splitter to split a bus into a group of wires. Refer to the SimUaid Reference Manual
for how to do this.

Bus Probe and Bus Input


You use a Bus Probe to show the value on a Bus. It displays the value in hex, and the
value appears on the Timing Diagram.

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..

Example of Using Busses

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

Figure 11. Bus Adder

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

Using State Machines


You can use a Mealy state machine to control the sequence of operations in a digital
system such as a multiplier or divider. The Mealy state machine, shown in Figure 12, has
input pins on the lower left, and output pins on the upper left. When you change an
input, the output changes asynchronously and does not wait for the rising edge of the
clock. The smaller box on the right shows the current state number. The state only
changes on the rising edge of the clock. (You can simulate a Moore state machine by
assigning, for each state, the same output to every arc leaving that state.)

Figure 12. State Machine

Example of Using a State Machine

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.).

Figure 13. State Graph

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.

Figure 14. Labeled State Machine

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.)

Table 1. State Graph Table

Present Input Output Next State


S0 St' 0 S0
S0 St LdM S1
S1 K M’ Sh S3
S1 K’M’ Sh S1
S1 M Ad S2
S2 K’ Sh S1
S2 K Sh S3
S3 – Done S0

d. Your state graph table should look like the one in Figure 15.

Figure 15. Resulting State Graph Table in SimUaid.


20 SimUaid User’s Guide

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.

You might also like