Capture an operand and add a live byte
Online version: https://fpga.labsland.com/altera/digital-logic/lab-03/part-05/
How can eight switches enter two different numbers? Store the first byte in a register. The switches can then supply the second byte while the register holds the first. Read the six displays in pairs from left to right: sum, stored byte, live byte. Each pair is hexadecimal. LEDR0 shows the ninth bit of the sum.
Lab setup
LabsLand Online Editor · DE1-SoC
Physical DE1-SoCCyclone V · 5CSEMA5F31C6 · camera, switches and buttons in the browser
Compile the registered adder in Quartus
Extract the project for your HDL and open stored_sum.qpf in Quartus Prime Lite with Cyclone V support. Complete the assignment that captures SW7–0 when KEY1 is released. KEY0 clears the stored operand asynchronously. Keep the supplied LabsLand Standard pin assignments so the switches and buttons in the remote interface drive the intended signals. Run Processing → Start Compilation and confirm the target is 5CSEMA5F31C6.
Open the Standard DE1-SoC firmware uploader, upload output_files/stored_sum.sof, select the file and reserve a board. The three pairs of hexadecimal digits show the low byte of the sum, the stored byte and the live switches. Read LEDR0 for carry. Complete the table below and identify the first row that distinguishes the repaired register from the starter.
- Get the starterDownload
stored_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 edge in the worksheet below, then complete the design as its build steps describe. Open
stored_sum.qpfand choose Processing → Start Compilation. Quartus writesoutput_files/stored_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 edge
The buttons idle high. Pressing KEY1 makes its input low and releasing it makes the input high. Sketch the stored byte while KEY1 is pressed and then released. What should happen if you change the switches without touching KEY1? What should KEY0 do before another clock edge arrives?
Build
Open the stored_sum starter for your HDL in the Standard Online Editor. The active-low display decoder and the nine-bit adder are supplied. Implement the assignment that captures SW7…0 on the rising edge of KEY1. KEY0 clears the stored byte asynchronously while pressed. Synthesize the design, upload it, and wait for the board camera.
Collect evidence
Pulse a button by pressing and releasing it. Settle the switches before touching KEY1. Fill in your predictions before each observation.
| Action | Predicted sum / stored / live | Camera reading | LEDR0 |
|---|---|---|---|
| Set the switches to 24 hex, then pulse KEY0 | |||
| Pulse KEY1 with 24 still selected | |||
| Move the switches to 13 without pressing a button | |||
| Set F6, pulse KEY1, then set 1B | |||
| Pulse KEY0 while the switches still read 1B |
Explain how the last two rows distinguish an arithmetic overflow from a register reset. For one intermediate switch setting of your choice, show how you calculated all six displayed digits. Return the switches to zero and pulse KEY0 before leaving.
Source
Original LabsLand activity following FPGAcademy Digital Logic Lab 3, Part V. Verilog handout · VHDL handout · MIT
