Compare a behavioral BCD adder with your gate design
Online version: https://fpga.labsland.com/altera/digital-logic/lab-02/part-05/
Two students can look at the same board and read the sum in different number systems. LEDR4…0 show the raw binary sum. HEX1 and HEX0 show the same number in decimal. HEX5 shows X on SW7…4, HEX3 shows Y on SW3…0, and SW8 supplies the carry-in.
Lab setup
Quartus Prime Lite 24.1 · Verilog · DE1-SoC
Physical DE1-SoCCyclone V · 5CSEMA5F31C6 · camera, switches and buttons in the browser
This activity requires Quartus RTL Viewer. Use desktop Quartus to compare the schematics, then test your bitstream on the remote board.
Build
Choose Download activity and files and extract the ZIP. It contains two Quartus projects in your selected HDL. Use the same Quartus Prime Lite release with Cyclone V support for both.
- Bring in your working gate adder from Part IV. If you used the LabsLand Online Editor, copy your completed
bcd_gatesHDL into the file of the same name incomparison-project/, keeping its extension. Opencomparison-project/bcd_gates.qpf. If you already built Part IV in Quartus, you can reopen that project instead. - Open
project/bcd_algorithm.qpfin another Quartus window and implement the arithmetic design. For each project, run Analysis & Synthesis, then open Tools → Netlist Viewers → RTL Viewer. Trace the correction path in both diagrams. Label the gates in the first and the comparison and selection in the second. - In the arithmetic project, run Processing → Start Compilation. Open the LabsLand Standard bitstream upload lab, select
project/output_files/bcd_algorithm.sofand choose Enter board with selected firmware. Change both operands and read the displays.
- Install Quartus Prime Lite with Cyclone V supportSkip this if it is already installed.
- Download the activityDownload worksheet and both Quartus projects Includes the worksheet, the Quartus project and a second project for comparison.
- Complete the design and compileStart with Design the circuit in the worksheet below, then complete the design as its build steps describe. Open
bcd_algorithm.qpfand choose Processing → Start Compilation. Quartus writesoutput_files/bcd_algorithm.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 · Quartus 24.1 · VHDL · Quartus 24.1 · SystemVerilog · Quartus 24.1
Worksheet and Quartus project (.zip) for offline work or printing
Design the circuit
Write the conversion with arithmetic, a comparison and a conditional choice. Keep the intermediate sum wide enough for 19. Predict which operations you will find in the schematic. Explain how each output is assigned on both sides of the conditional.
Build
Choose Download activity and files and extract the ZIP. It contains two Quartus projects in your selected HDL. Use the same Quartus Prime Lite release with Cyclone V support for both.
- Bring in your working gate adder from Part IV. If you used the LabsLand Online Editor, copy your completed
bcd_gatesHDL into the file of the same name incomparison-project/, keeping its extension. Opencomparison-project/bcd_gates.qpf. If you already built Part IV in Quartus, you can reopen that project instead. - Open
project/bcd_algorithm.qpfin another Quartus window and implement the arithmetic design. For each project, run Analysis & Synthesis, then open Tools → Netlist Viewers → RTL Viewer. Trace the correction path in both diagrams. Label the gates in the first and the comparison and selection in the second. - In the arithmetic project, run Processing → Start Compilation. Open the LabsLand Standard bitstream upload lab, select
project/output_files/bcd_algorithm.sofand choose Enter board with selected firmware. Change both operands and read the displays.
Test the board
| X | Y | Carry-in | Predicted LEDs and decimal digits | Camera reading |
|---|---|---|---|---|
| 0 | 0 | 0 | ||
| 5 | 4 | 0 | ||
| 5 | 4 | 1 | ||
| 9 | 7 | 0 | ||
| 9 | 9 | 1 |
Set X to binary 1010 with Y zero. Then set X zero and Y to 1100. Record LEDR9 in each case. Decimal results are specified only when both inputs are valid digits. Return all switches to zero before leaving.
Hand in
Submit the two labeled RTL diagrams and the camera table. Identify one operation that is easy to recognize in the algorithmic diagram and trace the equivalent signals in the gate design. State where you measured each result.
Adapted from FPGAcademy Digital Logic 21.1 · Lab 2, V · Verilog, VHDL. Original LabsLand programs, tests and worksheet. MIT
