CCEE221L Lab Report Template 5
CCEE221L Lab Report Template 5
Experiment [1]:
[FPGA VHDL Programming]
Section 1: Introduction
The goal of this experiment is to understand FPGA (Field Programmable Gate Array) and learn
how to write code in Verilog HDL using Quartus Prime software. Verilog is a programming
language used to design digital circuits, and it is built into the Quartus II system. You can create
Verilog Design Files (.v) using the Quartus II Text Editor or any other text editor. In this
experiment, the circuit consists of two Full Adders.
A Full Adder is an important part of digital circuits used for addition and subtraction. It takes
three inputs—A, B, and a carry-in (C-IN)—and gives two outputs: the sum (S) and the carry-out
(C-OUT). Full Adders can be connected together to add multiple bits, allowing for larger
calculations like adding a full byte.
Page 2 of 6
CCEE 221 – Logic Design Lab
Figure 2: FPGA
Page 3 of 6
CCEE 221 – Logic Design Lab
To implement a Full Adder in Quartus Prime using Verilog, a new project and a Verilog HDL
file need to be created. The Verilog file should contain the necessary code to define the Full
Adder circuit.
In the Full Adder, a module is created with three inputs (A, B, C) and two outputs (Cout, S). The
inputs represent binary values (0 or 1) that are manually entered using a switch on the FPGA.
The output s gives the sum of the inputs, while the carry output Cout is passed as the carry-in for
the next adder in a multi-bit addition setup.
We write the following code on verilog :
module addsub (input A, B, input C, output S, Cout);
assign S=A^B^C;
assign Cout=A*C|A*B|B*C;
end module
When done for the module, the symbol should be created by the following steps :
file>create update>create symbol file for current file
named as the name of the module
Note: The symbol name must be exactly the same as the module name and should be different
from the block and project names.
Now that the blocks are ready, they can be added to the block diagram by going to "Inputs" →
"Project" → selecting the created blocks.
The first input a0 is connected to a.
Inputs b0 and s pass through an XOR gate before connecting to b.
The output s is also connected to another XOR gate along with input b1, which then
connects to b in the second Full Adder.
The output s is linked to an output called sum0.
The carry output co from the first Full Adder is connected to the carry-in (cin) of the
second Full Adder.
In the second Full Adder, input a1 connects to a, while the outputs s and co represent the
sum and final carry output.
This setup allows numbers to be added using switches on the FPGA, as shown in Figure 3.
Page 4 of 6
CCEE 221 – Logic Design Lab
Figure 3: Fullstep
The next AdderisCircuit
to assign
each pin to its pin name by clicking on “pin planner” and getting each
pin location from the DE10 data sheet as shown in figure 4 .
The program is then compiled and the remaining steps in appendix A are completed. After
completing all steps, the circuit will be uploaded on the FBGA board and ready to compile.
Page 5 of 6
CCEE 221 – Logic Design Lab
[IF IT WAS DONE INSIDE THE LAB Show the implemented circuit on the breadboard and
specify the input/output values, with a detailed experimental discussion based on your outputs.]
All figures/tables/diagrams if present must be very clear labeled and captioned
Section 6: Conclusion
[A brief conclusion of 4 to 5 lines.]
Section 7: References
[No references]
Page 6 of 6