Digital Design and Computer Architecture: Lab 1: Full Adder
Digital Design and Computer Architecture: Lab 1: Full Adder
Introduction
In this lab you will design a simple digital circuit called a full adder. Along the way, you will
learn to use the Altera field-programmable gate array (FPGA) tools to enter a schematic,
simulate your design, and download your design onto a chip. You will also build your adder on
a breadboard using discrete chips to get a more tactile sense of digital logic.
After completing the lab, you are required to turn in something from each part. Refer to the
“What to Turn In” section at the end of this handout before beginning the lab.
The computer-aided design (CAD) tools required for this class are installed in the E85 lab
(Parsons B183). If you would like to work from the convenience of your own computer, see the
class website for instructions on installing the tools.
Background: Adders
An adder, not surprisingly, is a circuit whose output is the binary sum of its inputs. Since adders
are needed to perform arithmetic, they are an essential part of any computer. The full adder will
be an integral part of the microprocessor that you design in later labs.
A full adder has three inputs (A, B, Cin) and two outputs (S, Cout), as shown in Figure 1. Inputs A
and B each represent 1-bit binary numbers that are being added, and S represents a bit of the
resulting sum.
A B
Cout Cin
+
S
The Cin (carry in) and Cout (carry out) signals are used when adding numbers that are more than
one bit long. To understand how these signals are used, consider how you would add the binary
numbers 101 and 001 by hand:
Cout Cin
+ C1 + C0 +
S2 S1 S0
A B
Cout
+
S
Use the Orthogonal Node Tool ( ) to wire the gates together. Click and drag to connect the
pins to gates and the two gates together. At this point, your schematic should resemble Figure 4.
5 © 2012 David Money Harris and Sarah L. Harris
It’s a good idea to click on the wire between the two XOR gates and give it a unique name such
as n1 or mid in case you need to debug later. (If you are using version 10 or higher, you can
name a wire by right clicking on the wire, selecting Properties, and adding the name).
If you need to make corrections, use the Selection Tool to grab and move gates or wires. Zoom
in and out by using the View menu or holding the Ctrl key while turning the mouse wheel. Use
delete and undo as necessary.
Choose File Save and save your schematic as lab1_xx.bdf.
You are now ready to complete your schematic of the full adder by drawing the logic for Cout
that you designed in Part 1. Draw the necessary logic gates and wires to complete the circuit.
Use the existing input terminals for A, B, and Cin, and add an output terminal for Cout. The
symbols you may use to draw your logic gates are as follows: and2, and3, or2, or3, not, and xor.
Remember, do not add a second set of input ports for A, B, and Cin. Instead, note that you can
connect multiple wires to the same input ports (or you can connect wires to other wires to create
branches).
Select the Files tab in the Project Navigator pane to see a list of files of the project (presently just
lab1_xx.bdf). If you need to reopen the file later, double-click on it here.
To check your design, click on Start Compilation in the Task pane (ProcessingStart
Compilation). You’ll see a compilation report indicating five pins and 2 logic elements. Review
the warnings and errors carefully. You may get the following warnings that are harmless:
• Feature LogicLock only available with subscription.
• Ignored location or region assignments
• Found output pins without load capacitance
• Found invalid Fitter assignments
• Reserve All Unused Pins not specified
If you see other warnings or errors, track down their root cause before they lead you to grief
later.
3. Simulation
One motivation for drawing your full adder schematic in Quartus is that you can now use the
software to simulate the operation of the circuit. It is a good idea to verify the correctness of
your design before actually building the circuit in hardware. In this part of the lab, you will
simulate the design using ModelSim.
ModelSim expects a description of a circuit in a hardware description language (HDL) such as
Verilog. To convert your schematic to Verilog, open the schematic and choose File Create /
Update Create HDL Design File for Current File. Choose Verilog HDL. Your file should be
written to lab1_xx.v. Watch for and correct any warnings or errors that arise.
Now fire up ModelSim SE 6.6b from the Windows start menu. Maximize the ModelSim
window when it opens. If prompted, you may wish to associate file types with ModelSim but do
not want to use Jumpstart.
First, retrieve as many 74xx-series chips as you need to implement your 1-bit full adder. They
are located in the black cabinet in the lab. Recall that each chip contains multiple gates. Wires
and wirecutters are also located in the lab for your use. Build your circuit on the protoboard
located next to each computer. You will likely want to print out your schematic and label your
circuit, as shown in Figure 6 for the sum logic. The circuit could have used any of the four XOR
gates on the 7486 chip. Label each gate with the chip you will be using (in this case, the 7486
chip). Label each input and output with the pin number that you will connect it to. S1, S2, and
S3 indicate switches 1, 2, and 3 on the protoboard.
S1 1
3 4
S2 2 86 6
86
S3 5
What to Turn In
You must submit an electronic copy of the following items via Sakai. Be sure to label each
section and organize them in the following order. Messy or disorganized labs will lose points.
1. Please indicate how many hours you spent on this lab. This will be helpful for calibrating the
workload for next time the course is taught.
2. Write a few sentences describing the purpose of this lab.
3. Include your completed truth table, including the values in the Cout column.
4. Include the following figures:
• Your completed schematic, including the logic gates for both S and Cout. This can be
produced using the FileExport feature in the Schematic Editor (you may need to select
.bmp format).
• Your simulation of the full adder, including all inputs and outputs. This can be produced
using the FileExportImage… feature of the ModelSim Simulator.
5. Did your full adder on the DE2 board pass work for all eight possible inputs?
6. Did your full adder on the breadboard pass work for all eight possible inputs?
If you have suggestions for further improvements of this lab, you’re welcome to include them at
the end of your lab.