Lab Exercise 10: Introduction to Programmable Logic - Altera EPM7032
(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 a simple majority circuit.
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 = !ABC + A!BC + AB!C
+ 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; |
Figure 1: AHDL program for a three input majority circuit.
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
Figure 2: Truth table for a three bit majority circuit.
-
Login to a PC (Windows NT network). Load up the Altera (MaxPlus II)
software.
-
Under the File menu, select New. A small window
will appear. Click on Text Editor File and OK. A window will
appear. Before doing anything else, go to the File menu and choose
Save
As. Select the U: drive and, in the File Name field,
type in majority.tdf and click on OK
-
From the File menu choose Project and choose Name.
Enter "majority" in the Project Name field, or select majority
with the mouse and click on OK. Your path (u:\) and project name should
appear on he bar at the top of the screen after a short wait.
Or, since you already have a program open for this project, you can simply select Set project to current file from the File:Project menu.
-
Type the program as given in Figure 1 in the majority.tdf window. It would
be wise to save your program (File menu, Save) after
you complete every few lines. This way, if your computer or the network
"crashes", you will not have to retype all of your work.
- 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-15T. Be sure the device matches verbatim - there are several choices that look similar.
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.
-
Take a look at your .rpt file. (File, Open majority.rpt,
or just click the rpt icon in the compiler window). Scroll down to
find the picture of the chip. Note the pinout, and which pins are connected
to what, and which are deliberately not connected ("Reserved"). Find the area where
the device, turbo, and security options are listed (right above the pinout).
Add your name around this area.
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. You should also put a copy of this diagram in your lab book.
-
Simulate your program. Altera has a feature that allows you to simulate
your program before you actually take the time to build your circuit.
-
From the File menu, select New. Specify a waveform file with
an extension of .scf. A simulation file window will appear.
-
In the simulator file window, go to the Node menu and select Enter
Nodes from SNF. Boxes for the input and output signals should already
be checked. Click on the List button. The A, B, and C inputs and
the F output will be listed (and highlighted) in the Available Nodes
& Groups field. Click on the right arrow to send these signals
to the Selected Nodes & Groups field. Click on the OK
button to close the signal selection window. Signals A, B, C, and F should
show up in your simulator window.
-
Click the File menu and select End Time. Enter a total simulation
time of 800ns. Go to the Options menu and select Grid Size.
Enter a grid size of 100ns
-
Click on the tab next to the C input signal. The entire waveform for C
should become highlighted. Go to the Edit menu and select Overwrite
and then Count Value. Click on OK. The C signal should have
become a periodic TTL waveform. (If needed, adjust the zoom controls so
that you can see 4 high parts and 4 low parts for the C signal.) In the
same way, highlight the B signal, go to the Edit menu and Select
Overwrite.
This time, enter a value of 2 in the Multiplied By box and
choose OK. Finally, highlight the A signal and overwrite it as you
did the others, changing the Multiplied By box to 4. Note
that signals A, B, and C count from 0002 to 1112.
-
Save your file as majority.scf. Under the Max+plus II menu choose
Simulator
and Start. The F signal should be generated. Draw a truth table
showing the results of your simulation. If your truth table does not agree
with the one from Figure 1, check the program you wrote for obvious problems.
-
Program your chip. The Altera programmer is located in the Southwest corner
of the lab. Since the programmer PC is networked with the rest of the lab,
you can access your files from there. When you are ready to program your
chip, let a lab assistant know so he or she can guide you through the
process.
-
Take your chip back to your workstation and install it in the PLCC adapter
board.
- Note that certain pins are always going to be tied to Vcc and GND.
For the EPM7032, pins 3, 15, 23 and 35 are always tied to Vcc, and pins
10, 22, 30 and 42 are always tied to ground. We have designed the adapter
board to join these Vcc and ground pins together. All you have to do is
to connect a single wire from the VCC port on the adapter to +5 volts on
the protoboard, and another wire from GND on the adapter to ground on the
protoboard. Note (from the printout of your chip) that there are possibly
other grounds and Vcc’s that you will still need to hook up. These pin
assignments will vary from project to project.
- 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.
 
- Use the logic probe to test the output of your circuit by sampling the F output from your Altera chip.
If you slow the protoboard clock enough so that you can hear the transitions, you should be able to match the lights and tones to the timing diagram output "song" you expected.
-
Call one of the lab TA's over to look over your wiring and confirm your working circuit. TA sign here _______
- Now you need to use a logic analyzer to visually confirm the timing diagram for your circuit. Take your chip out of the socket and bring it to the protoboard connected to the logic analyzer testing station.
- Plug your chip into the socket in the testing station. The testing unit should already be connected to the logic analyzer. If not, follow these instrutions:
- From the logic analyzer pod, attach line 0 on the pin header to signal A on your circuit. Likewise, attach lines 1 and 2 to signals B and C, respectively. Having
the three input stimuli attached to the logic analyzer will enable you
to monitor your A, B, and C inputs.
- Next, attach line 3 from the logic
analyzer pod to a pin header that comes into contact with the output ("F")
of your circuit.
- 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 (the black wires with green heat shrink) and connect this into a GROUND on the protoboard. This establishes a common
ground between your circuit and the logic analyzer.
-
Login to the PC that your logic analyzer is connected to (log into windows only, you do not need to log into the network). Open the logic analyzer software called LA Viewer. There should be an icon on the desktop, or you can find it in the start menu.
- To be sure you haven't damaged your wiring while moving and attaching it to the logic analyzer, use the logic probe again to confirm that your output F is still working.
- It is best to obtain software instructions from the Instructor or TA and have them help you through this process.
- In LA Viewer you will see 16 channels on the left (0-15) where each one corresponds to a colored wire coming out of the logic analyzer. In our case, we are only using 4 channels (Ch-0...Ch-03) for A, B, C, and F. We should get rid of all remaining channels by holding control to select multiple channels with the mouse, highlight all channels except the ones we are using. Press delete or right-click on the selected and choose 'delete label'.
- To the upper right of the program you will see a clcok speed in Hertz, this is how fast the program is going to sample the input, so you want this speed to be much faster than the protoboard clock. A good speed for each is 10kHz for the function generator and 5MHz for LA viewer.
- When the clock speeds are set at the desired values, acquire the signal by clicking the "man running" icon. Your data should appear on the screen. Depending on your clock speeds, you may need to zoom in or zoom out (using the magnifying glass) to clearly see about two cycles through the truth table combinations on A, B and C. An easy way to check your values is to slide the blue marker at the top of the window over a transition period of the timing diagram and check to make sure that the blue numbers on the left match your truth table.
- When you are finished with the logic analyzer timing diagram, print a copy for your lab book. The simplest way to do this is to print an application screen shot.
- Unmaximize the application window.
- Using the corner drag tool, resize the application window such that it shows only the portion of the window we need (including your signal lines with minimal blank space below).
- Hold 'Alt' and press 'Print Screen'. This places a screenshot of the application window on the clipboard.
- Use Open Office to open a text document and paste the image into the document (ctrl-v works to paste).
- Print the document.
- Paste the waveform printout into your lab book and describe the results.
March 2001
Copyright 2001, New Mexico Tech