(There is no pre-lab for this exercise)
Your assignment in this lab exercise is to use a programmable logic device (PLD) to implement a combinational logic circuit. The circuit you will program into the Altera EPM7032 EPLD is identical to the majority circuit we just designed in class. For this lab, the AHDL (Altera Hardware Description Language) file that you would normally be responsible for writing has been provided for you below. The purpose of this exercise is merely to familiarize you with the Altera PLD programming software.
A sample AHDL program, below, implements the majority circuit. The truth table for this circuit is shown in Figure 2. The canonical sum of products expression for the majority circuit is F = A'BC + AB'C + ABC' + ABC. Note that we did not reduce the equation before writing the Altera text design file below. The Max+plus II software does this automatically.
SUBDESIGN majority |
( |
A,B,C :INPUT; |
F :OUTPUT; |
) |
BEGIN |
F=(!A and B and C) or |
(A and !B and C) or |
(A and B and !C) or |
(A and B and C); |
END; |
A B C F
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 1
1 1 1 1
After you have finished typing in the program, save it one more time. Then, go to the Max+plus II menu and choose Compiler. Do not hit the Start button yet.
Before starting the compilation, you will specify the device type you want to use. Lots of PLDs are supported by the Max+plus II software, and there is a built-in feature that lets Altera pick the best chip for you. The PLD we are using in this lab is the EPM7032LC44.
We will make sure that the proper device and package are chosen by first going to the Assign menu and selecting Device. First, uncheck the box that reads Show Only Fastest Speed Grades. You should see two fields, one for Device family and the other for specific Devices. In the Device Family Field, select MAX7000 (if it is not already selected). In the devices field, select EPM7032LC44-15. Hit OK.
Now click the Start button on the compiler window. If there is problem with the .tdf file you created, you will find out now. If the compilation process stops and reports errors, fix these, re-save your program, and resume compiling (hit the Start button again). Ask for assistance if you have trouble fixing your errors and compiling. After the program compiles with no errors, hit OK. After compilation, several new files have been added to your directory. They are all called majority, but their extensions vary: .cnf, .fin, .fit, .hif, .ini, .mmf, .pof, .prb, .rpt, .snf, and .sym.
By highlighting the area with your mouse, select your name, the picture of the PLD, and the pinout information which follows it. Print out your highlighted portion. (File ~ Print ~ 1 copy ~ Selected Area). Go to the printer and wait for your printout. You will use this picture of the chip to wire up your circuit.
Take care that your chip has the proper orientation, and let a lab assistant witness you plugging the chip into its socket. Make sure all GND and Vcc wires are hooked up properly to the device.
Wire up your counter (74HC4040) as described in the pre-lab lecture and your programmed Altera chip. The outputs of the counter chip will be hooked up as inputs to the Altera chip. The "clock" input of the counter chip will be driven by the clock on the protoboard. The clock will cycle through all possible inputs for your Altera chip, saving you from having to wire each combination of the inputs by hand for testing.
Note: When working with digital circuits, it is extremely important to establish a common ground between all parts of the circuit and any instruments acting on the circuit. Otherwise, the circuit simply may not work. On the logic analyzer pod, locate a ground lead (labeled GND) and plug this into a GROUND on the protoboard. This estables a common ground between your circuit and the logic analyzer.
You will now hook the logic analyzer up to the inputs and output of your circuit. It is an unfortunate, but somewhat unavoidable occurrence that the logic analyzer lines tend to break. Whenever this happens, we try to put a tag on the logic analyzer pod indicating which lines do not presently work. Look at the logic analyzer pod for any such note. The following instructions assume your pod is fully functional. If you have a pod where any of the first three lines are not working, do not use these lines, but simply use the next available ones.
If the logic analyzer is working properly, a window with waveforms for the input and output signals may appear. Or, you may have to maximize the waveform display from icon form.
Once the waveforms are visible (and each signal is toggling properly -- no flat liners!), verify the output for each state with the truth table in Figure 2.
Zoom in or out so that you can read the waveforms easily. Print out your waveform data and include this in your lab book.