Follow a carry through four bit positions
Online version: https://fpga.labsland.com/altera/digital-logic/lab-02/part-03/
Digital Logic · Lab 2, Part III · DE1-SoC
Build a four-bit adder from four copies of the same one-bit circuit. A change to a single switch can flip five LEDs. Find an input that makes that happen, then explain it one column at a time.
Lab setup
LabsLand Online Editor · DE1-SoC
Physical DE1-SoCCyclone V · 5CSEMA5F31C6 · camera, switches and buttons in the browser
Build in Quartus and upload the bitstream
Extract the project for your HDL and open ripple_sum.qpf in Quartus Prime Lite with the Cyclone V device package. Complete the full-adder stage and connect the carry between the four stages. Select Processing → Start Compilation and check the fitted device is 5CSEMA5F31C6.
In the Standard DE1-SoC binary upload lab, choose output_files/ripple_sum.sof. Enter the board with that firmware selected. Read LEDR4 as carry-out and LEDR3…0 as the four-bit sum.
- Get the starterDownload
ripple_sum.v - Open the LabsLand Online EditorOpen the lab Choose DE1-SoC · Verilog when you open the lab. LabsLand asks you to sign in. Use the access your course or institution provides.
- Follow the worksheetPredict first, then build, read the board and hand in. The build steps are below.
- Install Quartus Prime Lite with Cyclone V supportSkip this if it is already installed.
- Download the activityDownload worksheet and Quartus project Includes the worksheet and the Quartus project.
- Complete the design and compileStart with Predict the carry in the worksheet below, then complete the design as its build steps describe. Open
ripple_sum.qpfand choose Processing → Start Compilation. Quartus writesoutput_files/ripple_sum.sof. - Upload the bitstream to LabsLandUpload bitstream LabsLand asks you to sign in. Use the access your course or institution provides.
Already compiled? Upload your .sof directly
Starter files · Verilog · VHDL · SystemVerilog
Worksheet and starter (.zip) for offline work or printing
Predict the carry
Draw the eight rows of the truth table for three inputs a, b and carry-in. Write two output bits for each row. Which rows generate a carry even when carry-in is zero? Which rows pass a carry from the previous column to the next? Derive one Boolean expression for the sum bit and one for the carry bit.
Read SW7…4 as unsigned A and SW3…0 as unsigned B. SW8 supplies the carry-in. LEDR3…0 show the sum and LEDR4 is the final carry. SW9 is unused.
Build
Open the starter for your HDL in the DE1-SoC Online Editor with Standard selected. Create ripple_sum, paste the starter and select it as the top level. Find the one-bit component. Its sum output is supplied. Replace its fixed carry output with your expression. Follow the four instances from the least significant bit to the most significant bit. Synthesize and upload to the board.
Read the board
| A | B | Carry-in | Predicted LEDR4…0 | Camera LEDR4…0 |
|---|---|---|---|---|
| 0000 | 0000 | 0 | ||
| 0001 | 0001 | 0 | ||
| 0111 | 0000 | 1 | ||
| 1111 | 0000 | 0 | ||
| 1111 | 0000 | 1 | ||
| 1111 | 1111 | 1 |
In the two rows with A = 1111 and B = 0000 change only SW8. Label each carry into and out of the four columns. The camera shows the stable result after the switch change. The carry sequence itself comes from your logic analysis. Toggle SW9 once and check your prediction.
Hand in
Submit the one-bit truth table, your two equations, the six board readings and the four-column explanation. Which test first exposes the original starter's fault?
Adapted from FPGAcademy Digital Logic 21.1, Verilog Lab 2, Part III and its VHDL edition. LabsLand wrote the programs and remote procedure. MIT notice
