Lab6: Arithmetic Circuits
Time Estimate2-4 Hours Grade Impact2.5% DueOct 21 @ 3pm Required for Pass
Objective
Get to know the Vivado user interface by practicing the design workflow for this course.
Warning
Before starting any lab, always read the entire lab description. You are working with expensive, fragile hardware. Look particularly closely at these boxes, which warn you of potential problems.
Revised Edition: This assignment was revised on 2026-09-29 to improve clarity and provide better guidance. The core concepts remain the same, but the examples and explanations have been enhanced. If you completed the original version, you may still submit it for credit.
Before the Lab
Repository
Create a repository for this assignment and add your instructor and TA as collaborators.
Equipment
Please bring the following equipment to this lab:
- Digilent Basys 3 FPGA board
- Compatible (power-and-data) USB cable
- Note taking mechanism (laptop, notebook, etc.)
Pre-Lab Work
This lab has pre-lab work, specified below. Pre-lab work is due within the first 30 minutes of the lab session designated for this lab (that is, 3:00pm on October 14).
Pre-Lab
A multiplexer (MUX) has one output $\text{out}$, two signal inputs $i_0$ and $i_1$, and a select input $\text{sel}$. When $\text{sel}=0$, the output is assigned to equal $i_0$. When $\text{sel}=1$, the output is assigned to equal $i_1$. This behavior can be written algebraically as $$ \text{out} = \text{sel} \cdot i_1 + \overline{\text{sel}} \cdot i_0 $$
A carry-select adder includes two 4-bit ripple-carry adders per section. One ripple-carry adder computes the sum and carry bits assuming the carry-in is 0, while the other computes them assuming the carry-in is 1. Once the carry-in is known, it is used as the select to multiplexers to choose the appropriate sum and carry-out bits. One 4-bit section of a carry-select adder is shown below.
Switching between numbers
Suppose we want to switch between three-bit numbers $a$ and $b$ (i.e. $a$ has digits $a_0$, $a_1$, and $a_2$, and $b$ is a similarly defined vector of three bits). How would you interconnect 2-to-1 MUXes in order to select $a$ if $\text{sel}=1$, or $b$ if $\text{sel}=0$?
Delay Comparison
Assuming the delay of a 4-bit ripple carry adder is 4 and a multiplexor is 1, compare the delay of a 16-bit ripple carry adder to a 16-bit carry-select adder.
Deliverable Checkpoint: Pre-Lab
Submit your pre-lab work to your instructor or TA via Canvas or in-person.
MUX Module
Create a new Vivado project. Create a module called mux and implement a 2-to-1 multiplexer module. The module should have the following interface:
module mux2to1 (
input wire i0,
input wire i1,
input wire sel,
output wire out
);Draft a simple testbench to verify the functionality of your multiplexer. The testbench should apply all possible combinations of inputs. Check that the output matches the expected value.
Deliverable Checkpoint: MUX
Demonstrate your simulation or submit a screenshot of the waveform showing that your multiplexer works correctly.Tag your commit
muxand push tags.
Half Adder
In the same project, create a module called half_adder that implements a half adder. The module should have the following interface:
module half_adder (
input wire a,
input wire b,
output wire sum,
output wire carry
);Draft a simple testbench to verify the functionality of your half adder. The testbench should apply all possible combinations of inputs. Check that the outputs match the expected values.
Full Adder
In the same project, create a module called full_adder that implements a full adder by interconnecting two half adders and an OR gate. The module should have the following interface:
module full_adder (
input wire a,
input wire b,
input wire cin,
output wire sum,
output wire cout
);Create a testbench to verify the functionality of your full adder. The testbench should apply a sample of possible combinations of inputs, similar to the testbench from the previous lab. Check that the outputs match the expected values.
Deliverable Checkpoint: Full Adder Demonstrate your simulation or submit a screenshot of the waveform showing that your full adder works correctly.
Tag your commit
full_adderand push tags.
Ripple-Carry Adder
In the same project, create a module called ripple_carry_adder that implements a 4-bit ripple-carry adder by interconnecting four full adders. The module should have the following interface:
module ripple_carry_adder (
input wire [3:0] a,
input wire [3:0] b,
input wire cin,
output wire [3:0] sum,
output wire cout
);Create a testbench to verify the functionality of your ripple-carry adder. The testbench should apply a sample of possible combinations of inputs, similar to the testbench from the previous lab. Check that the outputs match the expected values.
Deliverable Checkpoint: Ripple-Carry Adder Demonstrate your simulation or submit a screenshot of the waveform showing that your ripple-carry adder works correctly.
Tag your commit
ripple_carry_adderand push tags.
Ripply-Carry Implementation
Turn off optimization options in the implementation settings, and then synthesize the adder to generate the implementation. This process generates:
- a register-transfer level (RTL) schematic,
- a synthesis report,
- a map report, and
- a place & route report. To access these reports, select open implemented design in the pop up window after the implementation has finished running. (Alternatively, if you have an up-to-date implementation, you can select it from the side menu any time). Once you have opened the design, you can open the reports you want to view from the side menu.
Designers often want to know what the critical path is (the path from input to output that takes the longest amount of time). This is most easily viewed on the timing report. In the upper toolbar select reports then timing and report timing. Make sure you have both the RTL schematic and the timing report open. From there, you can click on any path in the report and it will highlight it in blue on the schematic for you to visualize. The critical path should be listed first. Analyze these carefully, and see what can you decipher from them.
Identify the following information from these reports:
- Area of the design, specified in terms of the number of slices and look-up tables (Utilization Report).
- Delay of the design, i.e., the longest/slowest path of the circuit (Timing Summary Report, Data Sheet, Combinational Delays). Compare the longest path to your expected longest path of your ripple-carry adder. Does the report agree with your expectation?
Deliverable Checkpoint: Reports Describe in a note on Canvas or in-person to your instructor or TA what you learned from the implementation reports. Include relevant screenshots if submitting digitally.
Implement this design on your FPGA, adjusting the constraints file to map the inputs and outputs of your top-level module to the physical switches, buttons, and LEDs on the Basys 3 board. Refer to previous labs or the Basys 3 reference manual for the correct pin assignments.
Deliverable Checkpoint: Implementation Demonstrate your working carry-select adder on the FPGA board, or submit a video showing that your carry-select adder works correctly.
Tag your commit
carry_select_adderand push tags.
Carry-Select Adder
Now, create a module called carry_select_adder that implements a 4-bit section of a carry-select adder as described in the pre-lab and figure above. The module should have the following interface:
module carry_select_adder (
input wire [3:0] a,
input wire [3:0] b,
input wire cin,
output wire [3:0] sum,
output wire cout
);Create a testbench to verify the functionality of your carry-select adder. The testbench should apply a sample of possible combinations of inputs, similar to the testbenches from the previous section. Check that the outputs match the expected values.
Generate the synthesis reports and see for yourself if the delay of the longest path improves or not. Would you expect the longest path to change? Why or why not? Also, observe what happens to the area of the circuit, as compared to that of the ripple carry design.
Deliverable Checkpoint: Reports Describe in a note on Canvas or in-person to your instructor or TA what you learned from the implementation reports. Include relevant screenshots if submitting digitally.
Implement this design on your FPGA, adjusting the constraints file to map the inputs and outputs of your top-level module to the physical switches, buttons, and LEDs on the Basys 3 board. Refer to previous labs or the Basys 3 reference manual for the correct pin assignments.
Deliverable Checkpoint: Implementation Demonstrate your working carry-select adder on the FPGA board, or submit a video showing that your carry-select adder works correctly.
Tag your commit
carry_select_adderand push tags.
16-bit Adders
Construct 16-bit adders using both ripple-carry and carry-select architectures. Use the 4-bit modules you created earlier as building blocks in a heirarchical design.
Create testbenches to verify the functionality of both 16-bit adders. The testbenches should apply a sample of possible combinations of inputs, similar to the testbenches from the previous section. Check that the outputs match the expected values.
Run the synthesis reports and see for yourself if the delay of the longest path improves or not. Would you expect the longest path to change? Why or why not? Also, observe what happens to the area of the circuit, as compared to that of the ripple carry design.
Deliverable Checkpoint: Reports Describe in a note on Canvas or in-person to your instructor or TA what you learned from the implementation reports. Include relevant screenshots if submitting digitally.
You do not need to implement these 16-bit adders on the FPGA board due to limited hardware resourcse, but you may get creative with pin mappings if you wish.
Deliverables
Indicate to your instructor that you’re ready to submit your work by leaving a comment on the Feedback PR and requesting a review from @mossbiscuits. Ensure that your submission is on the main branch. Create a tag named done to mark your submission:
git tag -a done -m "Lab6 submission"
git push origin doneIf you took photos, screenshots, or videos, remember to upload them to Box or OneDrive and link to them in the Feedback PR. Alternatively, you can submit these items directly on Canvas.
To receive 100 points, submissions must include evidence of the following:
- (20) Correct and timely completion of the pre-lab work
- (20) 4-bit ripple-carry adder simulation and synthesis report
- (10) 4-bit ripple-carry adder implementation
- (20) 4-bit carry-select adder simulation and synthesis report
- (10) 4-bit carry-select adder implementation
- (20) 16-bit adders simulation and synthesis report