Design Specification
There is very little to design for this lab. Instead, you will mainly study
the timing behavior of the two circuits shown in Figures 1 and 2. The first is a
five-input XOR gate built out of four two-input XOR gates. It has the
interesting characteristic that changing any one bit results in the output
changing. The second circuit represents a common digital circuit: the
ripple-carry adder. Although you probably have not covered adders in
lecture at this point, we will provide you with enough background to do this
example.
Figure 1: 5-input XOR
Figure 2: 4-bit adder
You will be creating two different projects, one with the five-input XOR,
and one with the ripple-carry adder. You will then examine the propagation
delay of the circuit using both a simple abstract model and then using the
Quartus tools to provide a "real" model of the FPGA delay. For the 5-input
XOR gate you are to use switches SW0-SW4 (in any order) as your inputs and
LEDR[0] as the output.
For the adder SW[3:0] will be "A[3:0]" (in that order), SW[7:4] will B[3:0]
(again in that order) and Cin will be KEY3 (recall that the KEY inputs are
active low). Your outputs will have S[3:0] mapped to LEDR[3:0] and Cout
mapped to LEDG[7].
Implementation details
The 5-input XOR gate should be straightforward to implement. The XOR gates
needed are found on the symbol tool under "primitives → logic". The
ripple-carry adder requires you to learn a few more things about the Quartus
tools, so we will step you through it.
Don't forget to save the project early and often!
Once you've finished copying the 5-input XOR design, you will need to do the
following to get the 4-bit adder working:
- First, don't forget you want to to start a new project when doing the ripple-carry
adder. That is, the adder and the 5-input XOR should be different projects
(and ideally different directories).
- Once you've created a new project for the adder, the first thing you
should do is create a schematic as shown in Figure 3. Be sure to name
everything the same as we did (though don't worry about instance numbers).
Figure 3: Full-adder
- Save the schematic as "full_adder".
- Now select "File → Create/Update → Create Symbol files for
the current file". You should get a message telling you that it was
successful.
- Now open a new schematic and name it whatever you chose as your top
module. (That should be the default when you try to save it.)
- When you open the symbol tool, a new option appears "Project". See
Figure 4. Select "Project → full_adder" from the symbol tool menu and
place the full-adder in your schematic.
Figure 4: New option in the symbol tool.
- This would be a good time to save!
- Now the full-adder symbol probably doesn't have the inputs and outputs
in the same order as they are in Figure 2. So what you need to do
right-click on the full_adder symbol and select "Edit Selected Symbol".
- You should find that by grabbing the wires with the mouse (not the text!)
you can change the order of the signals. Make it match what you see in
Figure 2 (Cin on the top right, then A then B. On the left you have S on the
top then Cout.) Try to keep the spacing about the same as it was.
- Save the file (use the default name which should full_adder.bsf) then
close the file ("File → Close").
- This would be a good time to save.
- Now back in the top-level file you will notice that the order of the
adder's inputs and outputs haven't changed. Select the adder, right click
on it, and then choose "Update symbol or block". That pops up a window
asking what you want to update. In this case it doesn't matter which of the
options you select (the default is fine).
- Now all you need to do is make your figure look like Figure 2. Be sure
to name everything correctly!
You will now need to edit the .qsf file for both projects to properly set-up
the switches. This should be very similar to what you did in lab 1.