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

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

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

  2.  
  3. Draw the logic diagram for the Binary to BCD converter.

 

 

Procedure

Enter Circuit

Add Components:

  1. Open the Max+Plus II application by choosing "Altera - MAX+plus II 9.01" from the Start-Programs menu.
  2. In the MAX+plus II menu, choose "Graphic Editor".
  3. 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:
    1. You may copy symbols by using the commands in the "Edit" window or the keystroke equivalents given.
    2. You can double-click anywhere in the window to bring up the "Enter Symbol" popup window.
    3. 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.
    4. Place the symbols as you have drawn them on your pre-lab so that wiring will be simplified.
    5. You may remove symbols by selecting them and then using the "delete" key.
  4. 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:

  1. 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.
  2. Connection lines can be deleted by selecting them and then pressing the delete key.

Add Inputs and Outputs:

  1. Add the components "input" and "output" to your circuit. You will need 4 inputs and 5 output components.
  2. 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

  1. To simulate your circuit, you must first define the circuit to be your current project. Choose "File - Project - Set Project to Current File" .
  2. Next you must "compile" your circuit. Choose "MAX+plus II - Compiler" or click on the compiler button  to bring up the compiler window.
  3. 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.
  4. Next we must define the inputs for simulation. Open the waveform editor by choosing "MAX+plus II - Waveform Editor".
  5. 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".
  6. 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:
    1. B3
      B2
      B1
      B0
      T0
      O3
      O2
      O1
      O0
  7. 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.
  8. 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.
  9. Save this file using the "File - Save" menu. The file name will be bin2bcd.snf where the scf extension stands for "Simulation Channel File".
  10. 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.
  11. 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.

  12.  
    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          
  13. If there are any problems and your circuit must be changed, remember to  save and compile the circuit before re-simulating.
  14. 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:
    1. Select B3 B2 B1 and B0 by clicking on each one and holding down the shift key.
    2. 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.
    3. Repeat the above procedure for the T0,O3,O2,O1,O0 signals, call this group "BCD"
    4. Record the HEX values for the two signals below:
 
B[3..0]                                
BCD                                

Printing Results

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