EER-018 Introduction to Digital Computers
LABORATORY 2
MAX+plus Simulation of Binary to BCD Converter
Objective
In this lab you will reinforce minimization techniques learned in class
and gain some experience with the Max+plus II schematic capture and simulation
tool.
Equipment
-
Laboratory PC
-
Altera Max+Plus II Version 9.0
-
3.5 inch floppy disk, DOS format (bring to lab)
Prelab
In binary, a 4-bit number can represent decimal numbers 0-15. Suppose
we want to design a converter circuit that accepts a 4-bit binary input,
B3, B2, B1, B0, and outputs two corresponding BCD numbers, one for the
"tens" digit, and one for the "ones" digit. Figure 1 below illustrates
an example with input 1110 (14 in decimal) and output 0001 (1) 0100 (4).
Figure 1. Symbol View of Binary to BCD Converter
-
Use boolean variables B3 B2 B1 and B0 to represent the 4 binary input bits.
Use boolean variables T3 T2 T1 and T0 to represent the tens place BCD number
and O3 O2 O1 and O0 to represent the ones place BCD number. Using K-maps,
find minimum SOP expressions for the T and O outputs. (hint - some outputs
will be a constant 0.)
-
Draw the logic diagram for the Binary to BCD converter.
Procedure
Enter Circuit
Add Components:
-
Open the Max+Plus II application by choosing "Altera - MAX+plus II 9.01" from the Start-Programs menu.
-
In the MAX+plus II menu, choose "Graphic Editor".
-
Add the AND, OR and NOT gates needed for your circuit by first placing
the pointer where you would like to place the symbol (click on a location)
and then choosing "Symbol - Enter Symbol". In the pop-up window, select
the "prim" library by double-clicking on it. You will then see the logic
gate symbols listed. AND2 is a 2-input AND gate, OR3 is a 3-input OR gate,
etc. Select a gate by clicking on it, and then choose OK. Repeat for the
gates needed for your design. Here are some hints for making this process
easier:
-
You may copy symbols by using the commands in the "Edit" window or the
keystroke equivalents given.
-
You can double-click anywhere in the window to bring up the "Enter Symbol"
popup window.
-
Symbols can be moved by "dragging" them around with the mouse. You can
select a group of them by drawing a box around them with the mouse and
then move the entire group.
-
Place the symbols as you have drawn them on your pre-lab so that wiring
will be simplified.
-
You may remove symbols by selecting them and then using the "delete" key.
-
Save your file now, and frequently. Use the "File - Save" menu command
and save the file to your disk (Use a subdirectory in the h: drive). Name the file bin2bcd. It will have a ".gdf"
extension, which stands for "Graphics Data File".
Make Connections:
-
To make a connection between two gates, place the cursor at one gate terminal,
and drag the cursor to the terminal of the second gate.
-
Connection lines can be deleted by selecting them and then pressing the
delete key.
Add Inputs and Outputs:
-
Add the components "input" and "output" to your circuit. You will need
4 inputs and 5 output components.
-
Label each input and output by double-clicking on the default "pin_name"
label that appears on the component. When it turns black, type in the input
or output name.
Test the Circuit
-
To simulate your circuit, you must first define the circuit to be your
current project. Choose "File - Project - Set Project to Current File"
.
-
Next you must "compile" your circuit. Choose "MAX+plus II - Compiler" or
click on the compiler button
to bring up the compiler window.
-
Click on "start" to begin compilation. If you have any obvious errors such
as shorts or opens, the compiler will find these. If you get only a warning
about preliminary timing characteristics, then your circuit is ready to
simulate.
-
Next we must define the inputs for simulation. Open the waveform editor
by choosing "MAX+plus II - Waveform Editor".
-
Choose "Node - Enter Nodes from SNF" to add the inputs and outputs from
your circuit to the waveform window. When the pop-up window appears, click
on the "list" button to show all the inputs and outputs on the left side
of the window. Click on the "=>" button to add these nodes and then press
"OK".
-
You can re-order the signals by dragging the labels on the left hand side
with the mouse. If necessary, move the signals so they are in the following
order:
B3
B2
B1
B0
T0
O3
O2
O1
O0
-
First we will enter input values individually using the clock command.
First choose "Options - Snap to Grid" to turn off the snap to grid option.
-
Click on signal B3 and then on the clock button on the left side of the
window, it is the 4th button from the bottom. Enter a period of 1000.00ns
for this signal. Repeat this procedure for B2, B1 and B0, using periods
of 500ns, 250ns, and 125ns, respectively. Notice that this creates all
possible combinations of the inputs, from 0000 to 1111.
-
Save this file using the "File - Save" menu. The file name will be bin2bcd.snf
where the scf extension stands for "Simulation Channel File".
-
Finally we can simulate the circuit using these inputs. Choose "MAX+plus
II - Simulator" or click on the simulator button
to bring up the simulation window.
-
Click on "Start" to start the simulation. Hopefully you will find that
the simulation was successful. Close the window and examine the outputs.
Record the results on the table below.
| B3 |
B2 |
B1 |
B0 |
T0 |
O3 |
O2 |
O1 |
O0 |
| 0 |
0 |
0 |
0 |
|
|
|
|
|
| 0 |
0 |
0 |
1 |
|
|
|
|
|
| 0 |
0 |
1 |
0 |
|
|
|
|
|
| 0 |
0 |
1 |
1 |
|
|
|
|
|
| 0 |
1 |
0 |
0 |
|
|
|
|
|
| 0 |
1 |
0 |
1 |
|
|
|
|
|
| 0 |
1 |
1 |
0 |
|
|
|
|
|
| 0 |
1 |
1 |
1 |
|
|
|
|
|
| 1 |
0 |
0 |
0 |
|
|
|
|
|
| 1 |
0 |
0 |
1 |
|
|
|
|
|
| 1 |
0 |
1 |
0 |
|
|
|
|
|
| 1 |
0 |
1 |
1 |
|
|
|
|
|
| 1 |
1 |
0 |
0 |
|
|
|
|
|
| 1 |
1 |
0 |
1 |
|
|
|
|
|
| 1 |
1 |
1 |
0 |
|
|
|
|
|
| 1 |
1 |
1 |
1 |
|
|
|
|
|
-
If there are any problems and your circuit must be changed, remember to
save and compile the circuit before re-simulating.
-
Save your waveform once it simulates correctly.
Using Signal Groups:
Groups of signals, such as B3,B2, B1 and B0, can be grouped together in
the waveform editor. Group the B inputs and the O outputs using the following
procedure:
-
Select B3 B2 B1 and B0 by clicking on each one and holding down the shift
key.
-
When they are all selected, choose "Node - Enter Group" and type in the
name "B[3..0]" when the pop-up window appears if it is not already there.
We will display the signals in the default HEX radix.
-
Repeat the above procedure for the T0,O3,O2,O1,O0 signals, call this group
"BCD"
-
Record the HEX values for the two signals below:
Printing Results
-
To print the circuit diagram for your bin2bcd circuit, bring the graphics
editor window to the front, make a box around the circuit using the mouse
(selecting all components) and choose "File - Print". Make sure that the
"Selected Area" box is checked.
-
Bring the waveform editor to the front and using "File - Print",
print the waveform output. You may want to choose "Print Setup" and set
landscape mode first.
Lab Exercise
-
Using the procedure provided in this lab, design, enter and test a circuit
to implement functions Cout(A,B,Cin) and S(A,B,Cin) as described by the
truth table below. Use as few gates as possible. Do not group the signals.
| A |
B |
Cin |
Cout |
S |
| 0 |
0 |
0 |
0
|
0 |
| 0 |
0 |
1 |
0
|
1 |
| 0 |
1 |
0 |
0
|
1
|
| 0 |
1 |
1 |
1
|
0 |
| 1 |
0 |
0 |
0
|
1 |
| 1 |
0 |
1 |
1
|
0 |
| 1 |
1 |
0 |
1
|
0 |
| 1 |
1 |
1 |
1
|
1 |
-
Be sure to include the following items when you submit the results of this
exercise.
-
A title page that follows the format used for lab reports.
-
A clear presentation of your circuit design work.
-
A printout of your circuit.
-
A printout of the waveform that shows the correct results for all possible
inputs.
-
Attach the Lab #2 prelab and handout to your lab exercise.