Turn six switches into a two-digit decimal display
Online version: https://fpga.labsland.com/altera/digital-logic/lab-02/part-06/
Use SW5…SW0 to represent an unsigned number from 0 to 63. Display the tens on HEX1 and the ones on HEX0. Setting the input to 001010 should make the camera show 10.
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 six_bit_decimal.qpf in Quartus Prime Lite with the Cyclone V device package. Edit six_bit_decimal to turn the six input bits into separate tens and ones. Work through your trace before choosing Processing → Start Compilation. Check the fitted device is 5CSEMA5F31C6.
Open the DE1-SoC binary upload lab with the Standard interface. Browse to output_files/six_bit_decimal.sof. Once the firmware is selected, enter the board and use its switches and camera for the observation table.
- Get the starterDownload
six_bit_decimal.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 Design the converter in the worksheet below, then complete the design as its build steps describe. Open
six_bit_decimal.qpfand choose Processing → Start Compilation. Quartus writesoutput_files/six_bit_decimal.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
Design the converter
The two seven-segment decoders are already connected to the result nibbles. Complete the logic that produces those nibbles. One approach consumes the input from left to right, one bit per stage. Before each shift, add three to the ones digit if it is already five or more. Trace the six stages for 101101 and identify the first decimal carry.
Build
Download the starter in your language. Create a Standard DE1-SoC project in the Online Editor with six_bit_decimal as the top-level design. Synthesize, send the design to the board and wait for the display camera.
Test the boundaries
Predict the displays for 0, 9, 10, 19, 20, 45, 59, 60 and 63. Set each input and record both observed digits. Hold the six lower bits at 63 and turn on the four unused switches. Hand in the table and explain why the display retains its value.
Adapted from FPGAcademy Digital Logic 21.1, Verilog Lab 2, Part VI and the VHDL edition. LabsLand wrote the programs, tests and worksheet. MIT notice
