Build a class pack
Pick activities by their FPGAcademy lab and part numbers, set a common HDL and workflow, and share one link. Students open their own list with the right settings and downloads.
Choose the class setup
Applied to every activity you add. You can change any activity afterwards. If an activity cannot use this setup, it is flagged and the closest supported setup is used.
Choose activities
Lab 1 · Switches, LEDs and multiplexers
Lab 2 · Numbers and displays
Lab 3 · Latches and registers
Lab 4 · Counters
Lab 5 · Timing and clocks
Lab 6 · Arithmetic circuits
Lab 7 · Finite-state machines
Lab 8 · Memory
Lab 9 · A simple processor
Lab 10 · Extending the processor
Lab 11 · Programming the processor
Share or print
Digital Logic · Class activities
Your assigned activities
Your instructor chose these activities and how to build each one. Open an activity to start, or download its worksheet and files.
Digital Logic · Lab 1, Part I · DE1-SoC
This is your first circuit. Each slide switch supplies one input bit. When you change it in the browser, you should be able to identify exactly one red LED that changes on the board camera.
Predict
Sketch ten LED positions numbered 9 through 0. Predict the pattern for SW0 alone and for SW9 alone. What would change if the two ends of the bus were accidentally reversed?
Build
The screenshots show the Verilog editor. VHDL and SystemVerilog look the same apart from the file extension.
- If the editor tour is open, finish it or select Skip. If User interface shows a simulation, choose Change → Basic → Standard.
-
Select New. Name the file
switch_bank, choose the extension for your HDL (.v,.svor.vhd) and select Create.
-
Copy the starter into the file and choose
switch_bankunder Top level entity. Only SW0 is connected so far. - Complete the assignment so that LEDR[i] follows SW[i] for all ten bits.
-
Choose Synthesize. When a green message reports that the program was verified and compiled, choose Upload to FPGA.

-
Wait until the board page has finished programming the design. Select a switch to flip it and watch the red LEDs on the camera.

Read the board
Start with all switches off. Turn on just SW0 and identify LEDR0 on the camera. Turn it off and repeat with SW9. Now set the alternating patterns below. Record the ten LEDs from LEDR9 to LEDR0 before you move another switch.
| Switches 9…0 | Prediction | Camera reading |
|---|---|---|
| 0000000001 | ||
| 1000000000 | ||
| 0101010101 | ||
| 1010101010 |
When every switch is on, count the lit LEDs. Return the switches to zero before leaving the board.
Hand in
Submit the assignment statement, the four readings and one sentence describing how you established the order of the LEDs. Which test would still pass if two neighboring wires were swapped?
Adapted from FPGAcademy Digital Logic 21.1, Lab 1, Part I. LabsLand wrote the remote procedure, programs and tests. Original Verilog handout · Original VHDL handout · MIT notice
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Digital Logic · Lab 1, Part I · DE1-SoC
This is your first circuit. Each slide switch supplies one input bit. When you change it in the browser, you should be able to identify exactly one red LED that changes on the board camera.
Predict
Sketch ten LED positions numbered 9 through 0. Predict the pattern for SW0 alone and for SW9 alone. What would change if the two ends of the bus were accidentally reversed?
Build in Quartus and upload the bitstream
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Download the Quartus project for your HDL and extract the ZIP. Open the .qpf file in Quartus Prime Lite with Cyclone V device support installed. In the starter, only SW0 is connected. Complete the assignment so LEDR[i] follows SW[i] for all ten bits. The supplied .qsf connects the browser switches to the correct GPIO pins on the remote DE1-SoC.
Choose Processing → Start Compilation. Check the compilation report for a successful fit on device 5CSEMA5F31C6. Open the DE1-SoC binary upload lab, choose the standard interface, select output_files/switch_bank.sof and upload it. Wait for the board to confirm programming, then use the switches and camera for the readings below.
If your course uses a LabsLand classroom, the upload opens a firmware library instead. Choose Browse files, wait until the SOF is selected, then choose Enter board with selected firmware.
Read the board
Start with all switches off. Turn on just SW0 and identify LEDR0 on the camera. Turn it off and repeat with SW9. Now set the alternating patterns below. Record the ten LEDs from LEDR9 to LEDR0 before you move another switch.
| Switches 9…0 | Prediction | Camera reading |
|---|---|---|
| 0000000001 | ||
| 1000000000 | ||
| 0101010101 | ||
| 1010101010 |
When every switch is on, count the lit LEDs. Return the switches to zero before leaving the board.
Hand in
Submit the assignment statement, the four readings and one sentence describing how you established the order of the LEDs. Which test would still pass if two neighboring wires were swapped?
Adapted from FPGAcademy Digital Logic 21.1, Lab 1, Part I. LabsLand wrote the remote procedure, programs and tests. Original Verilog handout · Original VHDL handout · MIT notice
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Digital Logic · Lab 1, Part I · DE1-SoC
This is your first circuit. Each slide switch supplies one input bit. When you change it in the browser, you should be able to identify exactly one red LED that changes on the board camera.
Predict
Sketch ten LED positions numbered 9 through 0. Predict the pattern for SW0 alone and for SW9 alone. What would change if the two ends of the bus were accidentally reversed?
Build
The screenshots show the Verilog editor. VHDL and SystemVerilog look the same apart from the file extension.
- If the editor tour is open, finish it or select Skip. If User interface shows a simulation, choose Change → Basic → Standard.
-
Select New. Name the file
switch_bank, choose the extension for your HDL (.v,.svor.vhd) and select Create.
-
Copy the starter into the file and choose
switch_bankunder Top level entity. Only SW0 is connected so far. - Complete the assignment so that LEDR[i] follows SW[i] for all ten bits.
-
Choose Synthesize. When a green message reports that the program was verified and compiled, choose Upload to FPGA.

-
Wait until the board page has finished programming the design. Select a switch to flip it and watch the red LEDs on the camera.

Read the board
Start with all switches off. Turn on just SW0 and identify LEDR0 on the camera. Turn it off and repeat with SW9. Now set the alternating patterns below. Record the ten LEDs from LEDR9 to LEDR0 before you move another switch.
| Switches 9…0 | Prediction | Camera reading |
|---|---|---|
| 0000000001 | ||
| 1000000000 | ||
| 0101010101 | ||
| 1010101010 |
When every switch is on, count the lit LEDs. Return the switches to zero before leaving the board.
Hand in
Submit the assignment statement, the four readings and one sentence describing how you established the order of the LEDs. Which test would still pass if two neighboring wires were swapped?
Adapted from FPGAcademy Digital Logic 21.1, Lab 1, Part I. LabsLand wrote the remote procedure, programs and tests. Original Verilog handout · Original VHDL handout · MIT notice
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Digital Logic · Lab 1, Part I · DE1-SoC
This is your first circuit. Each slide switch supplies one input bit. When you change it in the browser, you should be able to identify exactly one red LED that changes on the board camera.
Predict
Sketch ten LED positions numbered 9 through 0. Predict the pattern for SW0 alone and for SW9 alone. What would change if the two ends of the bus were accidentally reversed?
Build in Quartus and upload the bitstream
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Download the Quartus project for your HDL and extract the ZIP. Open the .qpf file in Quartus Prime Lite with Cyclone V device support installed. In the starter, only SW0 is connected. Complete the assignment so LEDR[i] follows SW[i] for all ten bits. The supplied .qsf connects the browser switches to the correct GPIO pins on the remote DE1-SoC.
Choose Processing → Start Compilation. Check the compilation report for a successful fit on device 5CSEMA5F31C6. Open the DE1-SoC binary upload lab, choose the standard interface, select output_files/switch_bank.sof and upload it. Wait for the board to confirm programming, then use the switches and camera for the readings below.
If your course uses a LabsLand classroom, the upload opens a firmware library instead. Choose Browse files, wait until the SOF is selected, then choose Enter board with selected firmware.
Read the board
Start with all switches off. Turn on just SW0 and identify LEDR0 on the camera. Turn it off and repeat with SW9. Now set the alternating patterns below. Record the ten LEDs from LEDR9 to LEDR0 before you move another switch.
| Switches 9…0 | Prediction | Camera reading |
|---|---|---|
| 0000000001 | ||
| 1000000000 | ||
| 0101010101 | ||
| 1010101010 |
When every switch is on, count the lit LEDs. Return the switches to zero before leaving the board.
Hand in
Submit the assignment statement, the four readings and one sentence describing how you established the order of the LEDs. Which test would still pass if two neighboring wires were swapped?
Adapted from FPGAcademy Digital Logic 21.1, Lab 1, Part I. LabsLand wrote the remote procedure, programs and tests. Original Verilog handout · Original VHDL handout · MIT notice
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Digital Logic · Lab 1, Part I · DE1-SoC
This is your first circuit. Each slide switch supplies one input bit. When you change it in the browser, you should be able to identify exactly one red LED that changes on the board camera.
Predict
Sketch ten LED positions numbered 9 through 0. Predict the pattern for SW0 alone and for SW9 alone. What would change if the two ends of the bus were accidentally reversed?
Build
The screenshots show the Verilog editor. VHDL and SystemVerilog look the same apart from the file extension.
- If the editor tour is open, finish it or select Skip. If User interface shows a simulation, choose Change → Basic → Standard.
-
Select New. Name the file
switch_bank, choose the extension for your HDL (.v,.svor.vhd) and select Create.
-
Copy the starter into the file and choose
switch_bankunder Top level entity. Only SW0 is connected so far. - Complete the assignment so that LEDR[i] follows SW[i] for all ten bits.
-
Choose Synthesize. When a green message reports that the program was verified and compiled, choose Upload to FPGA.

-
Wait until the board page has finished programming the design. Select a switch to flip it and watch the red LEDs on the camera.

Read the board
Start with all switches off. Turn on just SW0 and identify LEDR0 on the camera. Turn it off and repeat with SW9. Now set the alternating patterns below. Record the ten LEDs from LEDR9 to LEDR0 before you move another switch.
| Switches 9…0 | Prediction | Camera reading |
|---|---|---|
| 0000000001 | ||
| 1000000000 | ||
| 0101010101 | ||
| 1010101010 |
When every switch is on, count the lit LEDs. Return the switches to zero before leaving the board.
Hand in
Submit the assignment statement, the four readings and one sentence describing how you established the order of the LEDs. Which test would still pass if two neighboring wires were swapped?
Adapted from FPGAcademy Digital Logic 21.1, Lab 1, Part I. LabsLand wrote the remote procedure, programs and tests. Original Verilog handout · Original VHDL handout · MIT notice
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Digital Logic · Lab 1, Part I · DE1-SoC
This is your first circuit. Each slide switch supplies one input bit. When you change it in the browser, you should be able to identify exactly one red LED that changes on the board camera.
Predict
Sketch ten LED positions numbered 9 through 0. Predict the pattern for SW0 alone and for SW9 alone. What would change if the two ends of the bus were accidentally reversed?
Build in Quartus and upload the bitstream
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Download the Quartus project for your HDL and extract the ZIP. Open the .qpf file in Quartus Prime Lite with Cyclone V device support installed. In the starter, only SW0 is connected. Complete the assignment so LEDR[i] follows SW[i] for all ten bits. The supplied .qsf connects the browser switches to the correct GPIO pins on the remote DE1-SoC.
Choose Processing → Start Compilation. Check the compilation report for a successful fit on device 5CSEMA5F31C6. Open the DE1-SoC binary upload lab, choose the standard interface, select output_files/switch_bank.sof and upload it. Wait for the board to confirm programming, then use the switches and camera for the readings below.
If your course uses a LabsLand classroom, the upload opens a firmware library instead. Choose Browse files, wait until the SOF is selected, then choose Enter board with selected firmware.
Read the board
Start with all switches off. Turn on just SW0 and identify LEDR0 on the camera. Turn it off and repeat with SW9. Now set the alternating patterns below. Record the ten LEDs from LEDR9 to LEDR0 before you move another switch.
| Switches 9…0 | Prediction | Camera reading |
|---|---|---|
| 0000000001 | ||
| 1000000000 | ||
| 0101010101 | ||
| 1010101010 |
When every switch is on, count the lit LEDs. Return the switches to zero before leaving the board.
Hand in
Submit the assignment statement, the four readings and one sentence describing how you established the order of the LEDs. Which test would still pass if two neighboring wires were swapped?
Adapted from FPGAcademy Digital Logic 21.1, Lab 1, Part I. LabsLand wrote the remote procedure, programs and tests. Original Verilog handout · Original VHDL handout · MIT notice
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Digital Logic · Lab 1, Part II · DE1-SoC
A selector lets two sources share one output. Build a four-bit selector and use the physical LEDs to find a fault that a single test would miss. You will need binary numbers, bit indexing and combinational logic.
Predict
Set the lower four switches to 0011 and the next four to 1010. Call those words X and Y. With SW9 down the selector must show X on LEDR3 through LEDR0. With SW9 up it must show Y. Write down which individual LEDs should light in each case. LEDR9 should follow SW9. SW8 has no function.
Build
Open the DE1-SoC Online Editor for your HDL. Create a file named selector with the appropriate extension and select it as the top-level file. Copy the starter into that file. It compiles, but it always sends X to the LEDs. Replace the marked line so that SW9 selects between the two whole words. Keep LEDR8 through LEDR4 off.
Choose the Standard board interface, synthesize, and upload the compiled design to the FPGA. Locate the row of red LEDs in the camera image. Read the hardware labels before interpreting left and right.
Test on the board
| SW9 | SW7…4 | SW3…0 | Predicted LEDR3…0 | Camera reading |
|---|---|---|---|---|
| 0 | 1010 | 0011 | ||
| 1 | 1010 | 0011 | ||
| 1 | 1010 | 0000 | ||
| 0 | 1010 | 0000 |
Leave the data switches in place between the first two rows. For the third row, change only X. Explain why the output should stay steady. Toggle SW8 once and record whether any LED changes. If the camera appears reversed, first light a single known LED and locate its board label.
Hand in
Submit your HDL, your four readings and an explanation of which row would reveal an accidentally hardwired X input. Include the state of LEDR9 for the first two rows.
Adapted from FPGAcademy Digital Logic 21.1, Lab 1, Part II. The remote procedure and starter are by LabsLand. Verilog source handout · VHDL source handout · FPGAcademy MIT notice
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Digital Logic · Lab 1, Part II · DE1-SoC
A selector lets two sources share one output. Build a four-bit selector and use the physical LEDs to find a fault that a single test would miss. You will need binary numbers, bit indexing and combinational logic.
Predict
Set the lower four switches to 0011 and the next four to 1010. Call those words X and Y. With SW9 down the selector must show X on LEDR3 through LEDR0. With SW9 up it must show Y. Write down which individual LEDs should light in each case. LEDR9 should follow SW9. SW8 has no function.
Build in Quartus and upload the bitstream
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Download and extract the Quartus project for your HDL. Open selector.qpf in Quartus Prime Lite with the Cyclone V device package. Edit the selector design. Replace the starter’s fixed X connection. When SW9 is low the four LED outputs must follow X, and when high they must follow Y. Keep LEDR9 tied to SW9 and the middle five LEDs dark.
Choose Processing → Start Compilation. Verify that the fitter completed for 5CSEMA5F31C6. In the DE1-SoC binary upload lab, choose Standard, upload output_files/selector.sof and wait for the programming confirmation. Locate the LED or HEX labels on the board camera before taking your readings.
If your course uses a LabsLand classroom, the upload opens a firmware library instead. Choose Browse files, wait until the SOF is selected, then choose Enter board with selected firmware.
Test on the board
| SW9 | SW7…4 | SW3…0 | Predicted LEDR3…0 | Camera reading |
|---|---|---|---|---|
| 0 | 1010 | 0011 | ||
| 1 | 1010 | 0011 | ||
| 1 | 1010 | 0000 | ||
| 0 | 1010 | 0000 |
Leave the data switches in place between the first two rows. For the third row, change only X. Explain why the output should stay steady. Toggle SW8 once and record whether any LED changes. If the camera appears reversed, first light a single known LED and locate its board label.
Hand in
Submit your HDL, your four readings and an explanation of which row would reveal an accidentally hardwired X input. Include the state of LEDR9 for the first two rows.
Adapted from FPGAcademy Digital Logic 21.1, Lab 1, Part II. The remote procedure and starter are by LabsLand. Verilog source handout · VHDL source handout · FPGAcademy MIT notice
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Digital Logic · Lab 1, Part II · DE1-SoC
A selector lets two sources share one output. Build a four-bit selector and use the physical LEDs to find a fault that a single test would miss. You will need binary numbers, bit indexing and combinational logic.
Predict
Set the lower four switches to 0011 and the next four to 1010. Call those words X and Y. With SW9 down the selector must show X on LEDR3 through LEDR0. With SW9 up it must show Y. Write down which individual LEDs should light in each case. LEDR9 should follow SW9. SW8 has no function.
Build
Open the DE1-SoC Online Editor for your HDL. Create a file named selector with the appropriate extension and select it as the top-level file. Copy the starter into that file. It compiles, but it always sends X to the LEDs. Replace the marked line so that SW9 selects between the two whole words. Keep LEDR8 through LEDR4 off.
Choose the Standard board interface, synthesize, and upload the compiled design to the FPGA. Locate the row of red LEDs in the camera image. Read the hardware labels before interpreting left and right.
Test on the board
| SW9 | SW7…4 | SW3…0 | Predicted LEDR3…0 | Camera reading |
|---|---|---|---|---|
| 0 | 1010 | 0011 | ||
| 1 | 1010 | 0011 | ||
| 1 | 1010 | 0000 | ||
| 0 | 1010 | 0000 |
Leave the data switches in place between the first two rows. For the third row, change only X. Explain why the output should stay steady. Toggle SW8 once and record whether any LED changes. If the camera appears reversed, first light a single known LED and locate its board label.
Hand in
Submit your HDL, your four readings and an explanation of which row would reveal an accidentally hardwired X input. Include the state of LEDR9 for the first two rows.
Adapted from FPGAcademy Digital Logic 21.1, Lab 1, Part II. The remote procedure and starter are by LabsLand. Verilog source handout · VHDL source handout · FPGAcademy MIT notice
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Digital Logic · Lab 1, Part II · DE1-SoC
A selector lets two sources share one output. Build a four-bit selector and use the physical LEDs to find a fault that a single test would miss. You will need binary numbers, bit indexing and combinational logic.
Predict
Set the lower four switches to 0011 and the next four to 1010. Call those words X and Y. With SW9 down the selector must show X on LEDR3 through LEDR0. With SW9 up it must show Y. Write down which individual LEDs should light in each case. LEDR9 should follow SW9. SW8 has no function.
Build in Quartus and upload the bitstream
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Download and extract the Quartus project for your HDL. Open selector.qpf in Quartus Prime Lite with the Cyclone V device package. Edit the selector design. Replace the starter’s fixed X connection. When SW9 is low the four LED outputs must follow X, and when high they must follow Y. Keep LEDR9 tied to SW9 and the middle five LEDs dark.
Choose Processing → Start Compilation. Verify that the fitter completed for 5CSEMA5F31C6. In the DE1-SoC binary upload lab, choose Standard, upload output_files/selector.sof and wait for the programming confirmation. Locate the LED or HEX labels on the board camera before taking your readings.
If your course uses a LabsLand classroom, the upload opens a firmware library instead. Choose Browse files, wait until the SOF is selected, then choose Enter board with selected firmware.
Test on the board
| SW9 | SW7…4 | SW3…0 | Predicted LEDR3…0 | Camera reading |
|---|---|---|---|---|
| 0 | 1010 | 0011 | ||
| 1 | 1010 | 0011 | ||
| 1 | 1010 | 0000 | ||
| 0 | 1010 | 0000 |
Leave the data switches in place between the first two rows. For the third row, change only X. Explain why the output should stay steady. Toggle SW8 once and record whether any LED changes. If the camera appears reversed, first light a single known LED and locate its board label.
Hand in
Submit your HDL, your four readings and an explanation of which row would reveal an accidentally hardwired X input. Include the state of LEDR9 for the first two rows.
Adapted from FPGAcademy Digital Logic 21.1, Lab 1, Part II. The remote procedure and starter are by LabsLand. Verilog source handout · VHDL source handout · FPGAcademy MIT notice
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Digital Logic · Lab 1, Part II · DE1-SoC
A selector lets two sources share one output. Build a four-bit selector and use the physical LEDs to find a fault that a single test would miss. You will need binary numbers, bit indexing and combinational logic.
Predict
Set the lower four switches to 0011 and the next four to 1010. Call those words X and Y. With SW9 down the selector must show X on LEDR3 through LEDR0. With SW9 up it must show Y. Write down which individual LEDs should light in each case. LEDR9 should follow SW9. SW8 has no function.
Build
Open the DE1-SoC Online Editor for your HDL. Create a file named selector with the appropriate extension and select it as the top-level file. Copy the starter into that file. It compiles, but it always sends X to the LEDs. Replace the marked line so that SW9 selects between the two whole words. Keep LEDR8 through LEDR4 off.
Choose the Standard board interface, synthesize, and upload the compiled design to the FPGA. Locate the row of red LEDs in the camera image. Read the hardware labels before interpreting left and right.
Test on the board
| SW9 | SW7…4 | SW3…0 | Predicted LEDR3…0 | Camera reading |
|---|---|---|---|---|
| 0 | 1010 | 0011 | ||
| 1 | 1010 | 0011 | ||
| 1 | 1010 | 0000 | ||
| 0 | 1010 | 0000 |
Leave the data switches in place between the first two rows. For the third row, change only X. Explain why the output should stay steady. Toggle SW8 once and record whether any LED changes. If the camera appears reversed, first light a single known LED and locate its board label.
Hand in
Submit your HDL, your four readings and an explanation of which row would reveal an accidentally hardwired X input. Include the state of LEDR9 for the first two rows.
Adapted from FPGAcademy Digital Logic 21.1, Lab 1, Part II. The remote procedure and starter are by LabsLand. Verilog source handout · VHDL source handout · FPGAcademy MIT notice
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Digital Logic · Lab 1, Part II · DE1-SoC
A selector lets two sources share one output. Build a four-bit selector and use the physical LEDs to find a fault that a single test would miss. You will need binary numbers, bit indexing and combinational logic.
Predict
Set the lower four switches to 0011 and the next four to 1010. Call those words X and Y. With SW9 down the selector must show X on LEDR3 through LEDR0. With SW9 up it must show Y. Write down which individual LEDs should light in each case. LEDR9 should follow SW9. SW8 has no function.
Build in Quartus and upload the bitstream
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Download and extract the Quartus project for your HDL. Open selector.qpf in Quartus Prime Lite with the Cyclone V device package. Edit the selector design. Replace the starter’s fixed X connection. When SW9 is low the four LED outputs must follow X, and when high they must follow Y. Keep LEDR9 tied to SW9 and the middle five LEDs dark.
Choose Processing → Start Compilation. Verify that the fitter completed for 5CSEMA5F31C6. In the DE1-SoC binary upload lab, choose Standard, upload output_files/selector.sof and wait for the programming confirmation. Locate the LED or HEX labels on the board camera before taking your readings.
If your course uses a LabsLand classroom, the upload opens a firmware library instead. Choose Browse files, wait until the SOF is selected, then choose Enter board with selected firmware.
Test on the board
| SW9 | SW7…4 | SW3…0 | Predicted LEDR3…0 | Camera reading |
|---|---|---|---|---|
| 0 | 1010 | 0011 | ||
| 1 | 1010 | 0011 | ||
| 1 | 1010 | 0000 | ||
| 0 | 1010 | 0000 |
Leave the data switches in place between the first two rows. For the third row, change only X. Explain why the output should stay steady. Toggle SW8 once and record whether any LED changes. If the camera appears reversed, first light a single known LED and locate its board label.
Hand in
Submit your HDL, your four readings and an explanation of which row would reveal an accidentally hardwired X input. Include the state of LEDR9 for the first two rows.
Adapted from FPGAcademy Digital Logic 21.1, Lab 1, Part II. The remote procedure and starter are by LabsLand. Verilog source handout · VHDL source handout · FPGAcademy MIT notice
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Digital Logic · Lab 1, Part III · DE1-SoC
Build a four-input selector from three two-input selectors. The lower select bit chooses a word within each pair. The upper select bit chooses which pair supplies the output. You can distinguish all four inputs with just two red LEDs.
Predict the route
Set SW7…6 to 00, SW5…4 to 01, SW3…2 to 10 and SW1…0 to 11. Call the four words U, V, W and X in that order. Write down which pair and which word should reach LEDR1…0 for each of the four possible values of SW9…8.
Build
Create four_sources in the editor for your HDL, choose it as the top-level file and paste the starter. Its first stage already chooses within both pairs. Complete the second stage. Keep the eight unused LEDs off. Choose Standard, synthesize and upload to the DE1-SoC.
Read the board
| SW9…8 | Word predicted | Predicted LEDR1…0 | Camera reading |
|---|---|---|---|
| 00 | |||
| 01 | |||
| 10 | |||
| 11 |
Keep the select bits at 10 and change W from 10 to 01. Then change U. Which change reaches the LEDs? A circuit that merely displays the binary select value can pass all four rows above. Use this last observation to rule it out.
Hand in
Submit a sketch of the three selectors with their control bits labeled, your four readings and the extra test with W changed. Explain which stage is responsible if U and V work but W and X never appear.
Adapted from FPGAcademy Digital Logic 21.1, Lab 1, Part III. LabsLand wrote the remote exercise and HDL. Original Verilog handout · Original VHDL handout · MIT notice
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Digital Logic · Lab 1, Part III · DE1-SoC
Build a four-input selector from three two-input selectors. The lower select bit chooses a word within each pair. The upper select bit chooses which pair supplies the output. You can distinguish all four inputs with just two red LEDs.
Predict the route
Set SW7…6 to 00, SW5…4 to 01, SW3…2 to 10 and SW1…0 to 11. Call the four words U, V, W and X in that order. Write down which pair and which word should reach LEDR1…0 for each of the four possible values of SW9…8.
Build in Quartus and upload the bitstream
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Download and extract the Quartus project for your HDL. Open four_sources.qpf in Quartus Prime Lite with the Cyclone V device package. Edit the four_sources design. Complete the second stage of the selector. The first stage already chooses within the two source pairs. Only LEDR1 and LEDR0 may light.
Choose Processing → Start Compilation. Verify that the fitter completed for 5CSEMA5F31C6. In the DE1-SoC binary upload lab, choose Standard, upload output_files/four_sources.sof and wait for the programming confirmation. Locate the LED or HEX labels on the board camera before taking your readings.
If your course uses a LabsLand classroom, the upload opens a firmware library instead. Choose Browse files, wait until the SOF is selected, then choose Enter board with selected firmware.
Read the board
| SW9…8 | Word predicted | Predicted LEDR1…0 | Camera reading |
|---|---|---|---|
| 00 | |||
| 01 | |||
| 10 | |||
| 11 |
Keep the select bits at 10 and change W from 10 to 01. Then change U. Which change reaches the LEDs? A circuit that merely displays the binary select value can pass all four rows above. Use this last observation to rule it out.
Hand in
Submit a sketch of the three selectors with their control bits labeled, your four readings and the extra test with W changed. Explain which stage is responsible if U and V work but W and X never appear.
Adapted from FPGAcademy Digital Logic 21.1, Lab 1, Part III. LabsLand wrote the remote exercise and HDL. Original Verilog handout · Original VHDL handout · MIT notice
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Digital Logic · Lab 1, Part III · DE1-SoC
Build a four-input selector from three two-input selectors. The lower select bit chooses a word within each pair. The upper select bit chooses which pair supplies the output. You can distinguish all four inputs with just two red LEDs.
Predict the route
Set SW7…6 to 00, SW5…4 to 01, SW3…2 to 10 and SW1…0 to 11. Call the four words U, V, W and X in that order. Write down which pair and which word should reach LEDR1…0 for each of the four possible values of SW9…8.
Build
Create four_sources in the editor for your HDL, choose it as the top-level file and paste the starter. Its first stage already chooses within both pairs. Complete the second stage. Keep the eight unused LEDs off. Choose Standard, synthesize and upload to the DE1-SoC.
Read the board
| SW9…8 | Word predicted | Predicted LEDR1…0 | Camera reading |
|---|---|---|---|
| 00 | |||
| 01 | |||
| 10 | |||
| 11 |
Keep the select bits at 10 and change W from 10 to 01. Then change U. Which change reaches the LEDs? A circuit that merely displays the binary select value can pass all four rows above. Use this last observation to rule it out.
Hand in
Submit a sketch of the three selectors with their control bits labeled, your four readings and the extra test with W changed. Explain which stage is responsible if U and V work but W and X never appear.
Adapted from FPGAcademy Digital Logic 21.1, Lab 1, Part III. LabsLand wrote the remote exercise and HDL. Original Verilog handout · Original VHDL handout · MIT notice
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Digital Logic · Lab 1, Part III · DE1-SoC
Build a four-input selector from three two-input selectors. The lower select bit chooses a word within each pair. The upper select bit chooses which pair supplies the output. You can distinguish all four inputs with just two red LEDs.
Predict the route
Set SW7…6 to 00, SW5…4 to 01, SW3…2 to 10 and SW1…0 to 11. Call the four words U, V, W and X in that order. Write down which pair and which word should reach LEDR1…0 for each of the four possible values of SW9…8.
Build in Quartus and upload the bitstream
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Download and extract the Quartus project for your HDL. Open four_sources.qpf in Quartus Prime Lite with the Cyclone V device package. Edit the four_sources design. Complete the second stage of the selector. The first stage already chooses within the two source pairs. Only LEDR1 and LEDR0 may light.
Choose Processing → Start Compilation. Verify that the fitter completed for 5CSEMA5F31C6. In the DE1-SoC binary upload lab, choose Standard, upload output_files/four_sources.sof and wait for the programming confirmation. Locate the LED or HEX labels on the board camera before taking your readings.
If your course uses a LabsLand classroom, the upload opens a firmware library instead. Choose Browse files, wait until the SOF is selected, then choose Enter board with selected firmware.
Read the board
| SW9…8 | Word predicted | Predicted LEDR1…0 | Camera reading |
|---|---|---|---|
| 00 | |||
| 01 | |||
| 10 | |||
| 11 |
Keep the select bits at 10 and change W from 10 to 01. Then change U. Which change reaches the LEDs? A circuit that merely displays the binary select value can pass all four rows above. Use this last observation to rule it out.
Hand in
Submit a sketch of the three selectors with their control bits labeled, your four readings and the extra test with W changed. Explain which stage is responsible if U and V work but W and X never appear.
Adapted from FPGAcademy Digital Logic 21.1, Lab 1, Part III. LabsLand wrote the remote exercise and HDL. Original Verilog handout · Original VHDL handout · MIT notice
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Digital Logic · Lab 1, Part III · DE1-SoC
Build a four-input selector from three two-input selectors. The lower select bit chooses a word within each pair. The upper select bit chooses which pair supplies the output. You can distinguish all four inputs with just two red LEDs.
Predict the route
Set SW7…6 to 00, SW5…4 to 01, SW3…2 to 10 and SW1…0 to 11. Call the four words U, V, W and X in that order. Write down which pair and which word should reach LEDR1…0 for each of the four possible values of SW9…8.
Build
Create four_sources in the editor for your HDL, choose it as the top-level file and paste the starter. Its first stage already chooses within both pairs. Complete the second stage. Keep the eight unused LEDs off. Choose Standard, synthesize and upload to the DE1-SoC.
Read the board
| SW9…8 | Word predicted | Predicted LEDR1…0 | Camera reading |
|---|---|---|---|
| 00 | |||
| 01 | |||
| 10 | |||
| 11 |
Keep the select bits at 10 and change W from 10 to 01. Then change U. Which change reaches the LEDs? A circuit that merely displays the binary select value can pass all four rows above. Use this last observation to rule it out.
Hand in
Submit a sketch of the three selectors with their control bits labeled, your four readings and the extra test with W changed. Explain which stage is responsible if U and V work but W and X never appear.
Adapted from FPGAcademy Digital Logic 21.1, Lab 1, Part III. LabsLand wrote the remote exercise and HDL. Original Verilog handout · Original VHDL handout · MIT notice
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Digital Logic · Lab 1, Part III · DE1-SoC
Build a four-input selector from three two-input selectors. The lower select bit chooses a word within each pair. The upper select bit chooses which pair supplies the output. You can distinguish all four inputs with just two red LEDs.
Predict the route
Set SW7…6 to 00, SW5…4 to 01, SW3…2 to 10 and SW1…0 to 11. Call the four words U, V, W and X in that order. Write down which pair and which word should reach LEDR1…0 for each of the four possible values of SW9…8.
Build in Quartus and upload the bitstream
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Download and extract the Quartus project for your HDL. Open four_sources.qpf in Quartus Prime Lite with the Cyclone V device package. Edit the four_sources design. Complete the second stage of the selector. The first stage already chooses within the two source pairs. Only LEDR1 and LEDR0 may light.
Choose Processing → Start Compilation. Verify that the fitter completed for 5CSEMA5F31C6. In the DE1-SoC binary upload lab, choose Standard, upload output_files/four_sources.sof and wait for the programming confirmation. Locate the LED or HEX labels on the board camera before taking your readings.
If your course uses a LabsLand classroom, the upload opens a firmware library instead. Choose Browse files, wait until the SOF is selected, then choose Enter board with selected firmware.
Read the board
| SW9…8 | Word predicted | Predicted LEDR1…0 | Camera reading |
|---|---|---|---|
| 00 | |||
| 01 | |||
| 10 | |||
| 11 |
Keep the select bits at 10 and change W from 10 to 01. Then change U. Which change reaches the LEDs? A circuit that merely displays the binary select value can pass all four rows above. Use this last observation to rule it out.
Hand in
Submit a sketch of the three selectors with their control bits labeled, your four readings and the extra test with W changed. Explain which stage is responsible if U and V work but W and X never appear.
Adapted from FPGAcademy Digital Logic 21.1, Lab 1, Part III. LabsLand wrote the remote exercise and HDL. Original Verilog handout · Original VHDL handout · MIT notice
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Digital Logic · Lab 1, Part IV · DE1-SoC
Your circuit translates a two-bit code into a character on HEX0. On this display a low pin lights its segment. You will derive a Boolean expression for each pin and check the characters on a real display.
Map the segments
Number the segments clockwise from the top. Segment 0 is the top bar, 1 the upper right, 2 the lower right, 3 the bottom, 4 the lower left and 5 the upper left. Segment 6 is the center. Sketch the lowercase d, capital E and digit 1 with these bars. For d, leave both the top and upper-left bars dark.
| SW1 SW0 | Character | Segments lit | Pin levels 6…0 |
|---|---|---|---|
| 00 | d | ||
| 01 | E | ||
| 10 | 1 | ||
| 11 | blank |
Read one column of your seven pin levels at a time. Which two input codes turn off the center bar? Find an expression for that pin, then do the other six.
Build
Create letter_decoder in your HDL editor, choose it as the top-level file and paste the starter. Its logic for segment 0 is supplied. Implement the other six pins as Boolean expressions. Choose Standard, synthesize and upload.
Read the board
Change SW1 and SW0 through the four codes and read HEX0 in the board camera. With E showing, flip SW2. Explain why the character should stay the same.
Hand in
Submit the table, one derivation and the four observed characters. If the blank code lights every segment, identify the convention your equations have reversed.
Adapted from FPGAcademy Digital Logic 21.1, Lab 1, Part IV. LabsLand wrote the remote exercise and HDL. Original Verilog handout · Original VHDL handout · MIT notice
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Digital Logic · Lab 1, Part IV · DE1-SoC
Your circuit translates a two-bit code into a character on HEX0. On this display a low pin lights its segment. You will derive a Boolean expression for each pin and check the characters on a real display.
Map the segments
Number the segments clockwise from the top. Segment 0 is the top bar, 1 the upper right, 2 the lower right, 3 the bottom, 4 the lower left and 5 the upper left. Segment 6 is the center. Sketch the lowercase d, capital E and digit 1 with these bars. For d, leave both the top and upper-left bars dark.
| SW1 SW0 | Character | Segments lit | Pin levels 6…0 |
|---|---|---|---|
| 00 | d | ||
| 01 | E | ||
| 10 | 1 | ||
| 11 | blank |
Read one column of your seven pin levels at a time. Which two input codes turn off the center bar? Find an expression for that pin, then do the other six.
Build in Quartus and upload the bitstream
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Download and extract the Quartus project for your HDL. Open letter_decoder.qpf in Quartus Prime Lite with the Cyclone V device package. Edit the letter_decoder design. Segment 0 is already wired. Derive and implement the other six active-low pins as Boolean expressions.
Choose Processing → Start Compilation. Verify that the fitter completed for 5CSEMA5F31C6. In the DE1-SoC binary upload lab, choose Standard, upload output_files/letter_decoder.sof and wait for the programming confirmation. Locate the LED or HEX labels on the board camera before taking your readings.
If your course uses a LabsLand classroom, the upload opens a firmware library instead. Choose Browse files, wait until the SOF is selected, then choose Enter board with selected firmware.
Read the board
Change SW1 and SW0 through the four codes and read HEX0 in the board camera. With E showing, flip SW2. Explain why the character should stay the same.
Hand in
Submit the table, one derivation and the four observed characters. If the blank code lights every segment, identify the convention your equations have reversed.
Adapted from FPGAcademy Digital Logic 21.1, Lab 1, Part IV. LabsLand wrote the remote exercise and HDL. Original Verilog handout · Original VHDL handout · MIT notice
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Digital Logic · Lab 1, Part IV · DE1-SoC
Your circuit translates a two-bit code into a character on HEX0. On this display a low pin lights its segment. You will derive a Boolean expression for each pin and check the characters on a real display.
Map the segments
Number the segments clockwise from the top. Segment 0 is the top bar, 1 the upper right, 2 the lower right, 3 the bottom, 4 the lower left and 5 the upper left. Segment 6 is the center. Sketch the lowercase d, capital E and digit 1 with these bars. For d, leave both the top and upper-left bars dark.
| SW1 SW0 | Character | Segments lit | Pin levels 6…0 |
|---|---|---|---|
| 00 | d | ||
| 01 | E | ||
| 10 | 1 | ||
| 11 | blank |
Read one column of your seven pin levels at a time. Which two input codes turn off the center bar? Find an expression for that pin, then do the other six.
Build
Create letter_decoder in your HDL editor, choose it as the top-level file and paste the starter. Its logic for segment 0 is supplied. Implement the other six pins as Boolean expressions. Choose Standard, synthesize and upload.
Read the board
Change SW1 and SW0 through the four codes and read HEX0 in the board camera. With E showing, flip SW2. Explain why the character should stay the same.
Hand in
Submit the table, one derivation and the four observed characters. If the blank code lights every segment, identify the convention your equations have reversed.
Adapted from FPGAcademy Digital Logic 21.1, Lab 1, Part IV. LabsLand wrote the remote exercise and HDL. Original Verilog handout · Original VHDL handout · MIT notice
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Digital Logic · Lab 1, Part IV · DE1-SoC
Your circuit translates a two-bit code into a character on HEX0. On this display a low pin lights its segment. You will derive a Boolean expression for each pin and check the characters on a real display.
Map the segments
Number the segments clockwise from the top. Segment 0 is the top bar, 1 the upper right, 2 the lower right, 3 the bottom, 4 the lower left and 5 the upper left. Segment 6 is the center. Sketch the lowercase d, capital E and digit 1 with these bars. For d, leave both the top and upper-left bars dark.
| SW1 SW0 | Character | Segments lit | Pin levels 6…0 |
|---|---|---|---|
| 00 | d | ||
| 01 | E | ||
| 10 | 1 | ||
| 11 | blank |
Read one column of your seven pin levels at a time. Which two input codes turn off the center bar? Find an expression for that pin, then do the other six.
Build in Quartus and upload the bitstream
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Download and extract the Quartus project for your HDL. Open letter_decoder.qpf in Quartus Prime Lite with the Cyclone V device package. Edit the letter_decoder design. Segment 0 is already wired. Derive and implement the other six active-low pins as Boolean expressions.
Choose Processing → Start Compilation. Verify that the fitter completed for 5CSEMA5F31C6. In the DE1-SoC binary upload lab, choose Standard, upload output_files/letter_decoder.sof and wait for the programming confirmation. Locate the LED or HEX labels on the board camera before taking your readings.
If your course uses a LabsLand classroom, the upload opens a firmware library instead. Choose Browse files, wait until the SOF is selected, then choose Enter board with selected firmware.
Read the board
Change SW1 and SW0 through the four codes and read HEX0 in the board camera. With E showing, flip SW2. Explain why the character should stay the same.
Hand in
Submit the table, one derivation and the four observed characters. If the blank code lights every segment, identify the convention your equations have reversed.
Adapted from FPGAcademy Digital Logic 21.1, Lab 1, Part IV. LabsLand wrote the remote exercise and HDL. Original Verilog handout · Original VHDL handout · MIT notice
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Digital Logic · Lab 1, Part IV · DE1-SoC
Your circuit translates a two-bit code into a character on HEX0. On this display a low pin lights its segment. You will derive a Boolean expression for each pin and check the characters on a real display.
Map the segments
Number the segments clockwise from the top. Segment 0 is the top bar, 1 the upper right, 2 the lower right, 3 the bottom, 4 the lower left and 5 the upper left. Segment 6 is the center. Sketch the lowercase d, capital E and digit 1 with these bars. For d, leave both the top and upper-left bars dark.
| SW1 SW0 | Character | Segments lit | Pin levels 6…0 |
|---|---|---|---|
| 00 | d | ||
| 01 | E | ||
| 10 | 1 | ||
| 11 | blank |
Read one column of your seven pin levels at a time. Which two input codes turn off the center bar? Find an expression for that pin, then do the other six.
Build
Create letter_decoder in your HDL editor, choose it as the top-level file and paste the starter. Its logic for segment 0 is supplied. Implement the other six pins as Boolean expressions. Choose Standard, synthesize and upload.
Read the board
Change SW1 and SW0 through the four codes and read HEX0 in the board camera. With E showing, flip SW2. Explain why the character should stay the same.
Hand in
Submit the table, one derivation and the four observed characters. If the blank code lights every segment, identify the convention your equations have reversed.
Adapted from FPGAcademy Digital Logic 21.1, Lab 1, Part IV. LabsLand wrote the remote exercise and HDL. Original Verilog handout · Original VHDL handout · MIT notice
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Digital Logic · Lab 1, Part IV · DE1-SoC
Your circuit translates a two-bit code into a character on HEX0. On this display a low pin lights its segment. You will derive a Boolean expression for each pin and check the characters on a real display.
Map the segments
Number the segments clockwise from the top. Segment 0 is the top bar, 1 the upper right, 2 the lower right, 3 the bottom, 4 the lower left and 5 the upper left. Segment 6 is the center. Sketch the lowercase d, capital E and digit 1 with these bars. For d, leave both the top and upper-left bars dark.
| SW1 SW0 | Character | Segments lit | Pin levels 6…0 |
|---|---|---|---|
| 00 | d | ||
| 01 | E | ||
| 10 | 1 | ||
| 11 | blank |
Read one column of your seven pin levels at a time. Which two input codes turn off the center bar? Find an expression for that pin, then do the other six.
Build in Quartus and upload the bitstream
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Download and extract the Quartus project for your HDL. Open letter_decoder.qpf in Quartus Prime Lite with the Cyclone V device package. Edit the letter_decoder design. Segment 0 is already wired. Derive and implement the other six active-low pins as Boolean expressions.
Choose Processing → Start Compilation. Verify that the fitter completed for 5CSEMA5F31C6. In the DE1-SoC binary upload lab, choose Standard, upload output_files/letter_decoder.sof and wait for the programming confirmation. Locate the LED or HEX labels on the board camera before taking your readings.
If your course uses a LabsLand classroom, the upload opens a firmware library instead. Choose Browse files, wait until the SOF is selected, then choose Enter board with selected firmware.
Read the board
Change SW1 and SW0 through the four codes and read HEX0 in the board camera. With E showing, flip SW2. Explain why the character should stay the same.
Hand in
Submit the table, one derivation and the four observed characters. If the blank code lights every segment, identify the convention your equations have reversed.
Adapted from FPGAcademy Digital Logic 21.1, Lab 1, Part IV. LabsLand wrote the remote exercise and HDL. Original Verilog handout · Original VHDL handout · MIT notice
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Digital Logic · Lab 1, Part V · DE1-SoC
Make a four-character message move one place to the left when the selection increases. A character leaving HEX3 must reappear on HEX0. Each display needs a selector for its character and a decoder for its seven segments.
Arrange the message
Read the displays from HEX3 to HEX0. At rotation zero they receive SW7…6, SW5…4, SW3…2 and SW1…0 respectively. Use 00 for d, 01 for E, 10 for 1 and 11 for blank. Set SW7…0 to 00011011. Draw a box for every display, including the blank, and predict what you will see for each setting of SW9…8.
Build
Create word_rotator in the Online Editor for your HDL, choose it as the top-level file and paste the starter. Its four lanes decode the initial message. Complete the selection in each lane. At one left rotation HEX0 must receive the old HEX3 character. Keep the LEDR outputs mirroring all ten switches. Select Standard, synthesize and upload to the FPGA.
Read the board
| SW9…8 | Prediction, HEX3 to HEX0 | Camera reading, HEX3 to HEX0 |
|---|---|---|
| 00 | ||
| 01 | ||
| 10 | ||
| 11 |
Read the four rightmost displays. Write a dash for a blank. Return to rotation zero and change the message switches to 01101100. Confirm that the displayed word changes. This test distinguishes a selector that reads your switches from a circuit that rotates a fixed word.
Hand in
Submit your HDL, the four readings and the result with the second message. Explain which source pair HEX1 receives when SW9…8 is 10.
Adapted from FPGAcademy Digital Logic 21.1, Lab 1, Part V. LabsLand wrote the programs and remote procedure. Verilog handout · VHDL handout · MIT notice
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Digital Logic · Lab 1, Part V · DE1-SoC
Make a four-character message move one place to the left when the selection increases. A character leaving HEX3 must reappear on HEX0. Each display needs a selector for its character and a decoder for its seven segments.
Arrange the message
Read the displays from HEX3 to HEX0. At rotation zero they receive SW7…6, SW5…4, SW3…2 and SW1…0 respectively. Use 00 for d, 01 for E, 10 for 1 and 11 for blank. Set SW7…0 to 00011011. Draw a box for every display, including the blank, and predict what you will see for each setting of SW9…8.
Build in Quartus and upload the bitstream
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Download and extract the Quartus project for your HDL. Open word_rotator.qpf in Quartus Prime Lite with the Cyclone V device package. Edit the word_rotator design. Complete the character selection in each of the four lanes. At one left rotation HEX0 must receive the initial HEX3 character. Keep the red LEDs mirroring all ten switches.
Choose Processing → Start Compilation. Verify that the fitter completed for 5CSEMA5F31C6. In the DE1-SoC binary upload lab, choose Standard, upload output_files/word_rotator.sof and wait for the programming confirmation. Locate the LED or HEX labels on the board camera before taking your readings.
If your course uses a LabsLand classroom, the upload opens a firmware library instead. Choose Browse files, wait until the SOF is selected, then choose Enter board with selected firmware.
Read the board
| SW9…8 | Prediction, HEX3 to HEX0 | Camera reading, HEX3 to HEX0 |
|---|---|---|
| 00 | ||
| 01 | ||
| 10 | ||
| 11 |
Read the four rightmost displays. Write a dash for a blank. Return to rotation zero and change the message switches to 01101100. Confirm that the displayed word changes. This test distinguishes a selector that reads your switches from a circuit that rotates a fixed word.
Hand in
Submit your HDL, the four readings and the result with the second message. Explain which source pair HEX1 receives when SW9…8 is 10.
Adapted from FPGAcademy Digital Logic 21.1, Lab 1, Part V. LabsLand wrote the programs and remote procedure. Verilog handout · VHDL handout · MIT notice
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Digital Logic · Lab 1, Part V · DE1-SoC
Make a four-character message move one place to the left when the selection increases. A character leaving HEX3 must reappear on HEX0. Each display needs a selector for its character and a decoder for its seven segments.
Arrange the message
Read the displays from HEX3 to HEX0. At rotation zero they receive SW7…6, SW5…4, SW3…2 and SW1…0 respectively. Use 00 for d, 01 for E, 10 for 1 and 11 for blank. Set SW7…0 to 00011011. Draw a box for every display, including the blank, and predict what you will see for each setting of SW9…8.
Build
Create word_rotator in the Online Editor for your HDL, choose it as the top-level file and paste the starter. Its four lanes decode the initial message. Complete the selection in each lane. At one left rotation HEX0 must receive the old HEX3 character. Keep the LEDR outputs mirroring all ten switches. Select Standard, synthesize and upload to the FPGA.
Read the board
| SW9…8 | Prediction, HEX3 to HEX0 | Camera reading, HEX3 to HEX0 |
|---|---|---|
| 00 | ||
| 01 | ||
| 10 | ||
| 11 |
Read the four rightmost displays. Write a dash for a blank. Return to rotation zero and change the message switches to 01101100. Confirm that the displayed word changes. This test distinguishes a selector that reads your switches from a circuit that rotates a fixed word.
Hand in
Submit your HDL, the four readings and the result with the second message. Explain which source pair HEX1 receives when SW9…8 is 10.
Adapted from FPGAcademy Digital Logic 21.1, Lab 1, Part V. LabsLand wrote the programs and remote procedure. Verilog handout · VHDL handout · MIT notice
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Digital Logic · Lab 1, Part V · DE1-SoC
Make a four-character message move one place to the left when the selection increases. A character leaving HEX3 must reappear on HEX0. Each display needs a selector for its character and a decoder for its seven segments.
Arrange the message
Read the displays from HEX3 to HEX0. At rotation zero they receive SW7…6, SW5…4, SW3…2 and SW1…0 respectively. Use 00 for d, 01 for E, 10 for 1 and 11 for blank. Set SW7…0 to 00011011. Draw a box for every display, including the blank, and predict what you will see for each setting of SW9…8.
Build in Quartus and upload the bitstream
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Download and extract the Quartus project for your HDL. Open word_rotator.qpf in Quartus Prime Lite with the Cyclone V device package. Edit the word_rotator design. Complete the character selection in each of the four lanes. At one left rotation HEX0 must receive the initial HEX3 character. Keep the red LEDs mirroring all ten switches.
Choose Processing → Start Compilation. Verify that the fitter completed for 5CSEMA5F31C6. In the DE1-SoC binary upload lab, choose Standard, upload output_files/word_rotator.sof and wait for the programming confirmation. Locate the LED or HEX labels on the board camera before taking your readings.
If your course uses a LabsLand classroom, the upload opens a firmware library instead. Choose Browse files, wait until the SOF is selected, then choose Enter board with selected firmware.
Read the board
| SW9…8 | Prediction, HEX3 to HEX0 | Camera reading, HEX3 to HEX0 |
|---|---|---|
| 00 | ||
| 01 | ||
| 10 | ||
| 11 |
Read the four rightmost displays. Write a dash for a blank. Return to rotation zero and change the message switches to 01101100. Confirm that the displayed word changes. This test distinguishes a selector that reads your switches from a circuit that rotates a fixed word.
Hand in
Submit your HDL, the four readings and the result with the second message. Explain which source pair HEX1 receives when SW9…8 is 10.
Adapted from FPGAcademy Digital Logic 21.1, Lab 1, Part V. LabsLand wrote the programs and remote procedure. Verilog handout · VHDL handout · MIT notice
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Digital Logic · Lab 1, Part V · DE1-SoC
Make a four-character message move one place to the left when the selection increases. A character leaving HEX3 must reappear on HEX0. Each display needs a selector for its character and a decoder for its seven segments.
Arrange the message
Read the displays from HEX3 to HEX0. At rotation zero they receive SW7…6, SW5…4, SW3…2 and SW1…0 respectively. Use 00 for d, 01 for E, 10 for 1 and 11 for blank. Set SW7…0 to 00011011. Draw a box for every display, including the blank, and predict what you will see for each setting of SW9…8.
Build
Create word_rotator in the Online Editor for your HDL, choose it as the top-level file and paste the starter. Its four lanes decode the initial message. Complete the selection in each lane. At one left rotation HEX0 must receive the old HEX3 character. Keep the LEDR outputs mirroring all ten switches. Select Standard, synthesize and upload to the FPGA.
Read the board
| SW9…8 | Prediction, HEX3 to HEX0 | Camera reading, HEX3 to HEX0 |
|---|---|---|
| 00 | ||
| 01 | ||
| 10 | ||
| 11 |
Read the four rightmost displays. Write a dash for a blank. Return to rotation zero and change the message switches to 01101100. Confirm that the displayed word changes. This test distinguishes a selector that reads your switches from a circuit that rotates a fixed word.
Hand in
Submit your HDL, the four readings and the result with the second message. Explain which source pair HEX1 receives when SW9…8 is 10.
Adapted from FPGAcademy Digital Logic 21.1, Lab 1, Part V. LabsLand wrote the programs and remote procedure. Verilog handout · VHDL handout · MIT notice
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Digital Logic · Lab 1, Part V · DE1-SoC
Make a four-character message move one place to the left when the selection increases. A character leaving HEX3 must reappear on HEX0. Each display needs a selector for its character and a decoder for its seven segments.
Arrange the message
Read the displays from HEX3 to HEX0. At rotation zero they receive SW7…6, SW5…4, SW3…2 and SW1…0 respectively. Use 00 for d, 01 for E, 10 for 1 and 11 for blank. Set SW7…0 to 00011011. Draw a box for every display, including the blank, and predict what you will see for each setting of SW9…8.
Build in Quartus and upload the bitstream
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Download and extract the Quartus project for your HDL. Open word_rotator.qpf in Quartus Prime Lite with the Cyclone V device package. Edit the word_rotator design. Complete the character selection in each of the four lanes. At one left rotation HEX0 must receive the initial HEX3 character. Keep the red LEDs mirroring all ten switches.
Choose Processing → Start Compilation. Verify that the fitter completed for 5CSEMA5F31C6. In the DE1-SoC binary upload lab, choose Standard, upload output_files/word_rotator.sof and wait for the programming confirmation. Locate the LED or HEX labels on the board camera before taking your readings.
If your course uses a LabsLand classroom, the upload opens a firmware library instead. Choose Browse files, wait until the SOF is selected, then choose Enter board with selected firmware.
Read the board
| SW9…8 | Prediction, HEX3 to HEX0 | Camera reading, HEX3 to HEX0 |
|---|---|---|
| 00 | ||
| 01 | ||
| 10 | ||
| 11 |
Read the four rightmost displays. Write a dash for a blank. Return to rotation zero and change the message switches to 01101100. Confirm that the displayed word changes. This test distinguishes a selector that reads your switches from a circuit that rotates a fixed word.
Hand in
Submit your HDL, the four readings and the result with the second message. Explain which source pair HEX1 receives when SW9…8 is 10.
Adapted from FPGAcademy Digital Logic 21.1, Lab 1, Part V. LabsLand wrote the programs and remote procedure. Verilog handout · VHDL handout · MIT notice
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Digital Logic · Lab 1, Part VI · DE1-SoC
Extend the four-display circuit to six positions. Store the message inside the circuit. Three switches now control its rotation, leaving the other switches free.
Predict the wrap
Read HEX5 through HEX0 from left to right. At rotation zero the three leftmost digits are blank and the three rightmost read dE1. Sketch the next six positions, including the return to zero. At which setting does the first character reappear on the right?
Build
Create marquee in your HDL editor, select it as the top-level file and paste the starter. Complete the source index so each display selects one of six stored characters using SW9…7. Each step from 0 to 5 moves the message one position left. In this activity both spare codes, 6 and 7, blank every display. Choose Standard, synthesize and upload.
Read the board
| SW9…7 | Prediction, HEX5 to HEX0 | Camera reading |
|---|---|---|
| 000 | ||
| 001 | ||
| 010 | ||
| 011 | ||
| 100 | ||
| 101 | ||
| 110 and 111 | ||
| 000 again |
Use a dash for each blank. Change one of the lower seven switches while SW9…7 remains fixed and check whether the message moves. Explain the difference between selecting a rotation directly and advancing a stored rotation counter.
Hand in
Submit a sketch of the six possible source positions for HEX0, the eight code readings and an explanation of how you wrap an index at six instead of eight.
Adapted from FPGAcademy Digital Logic 21.1, Lab 1, Part VI. LabsLand wrote the DE1-SoC test cases and reference implementations. Verilog handout · VHDL handout · MIT notice
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Digital Logic · Lab 1, Part VI · DE1-SoC
Extend the four-display circuit to six positions. Store the message inside the circuit. Three switches now control its rotation, leaving the other switches free.
Predict the wrap
Read HEX5 through HEX0 from left to right. At rotation zero the three leftmost digits are blank and the three rightmost read dE1. Sketch the next six positions, including the return to zero. At which setting does the first character reappear on the right?
Build in Quartus and upload the bitstream
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Download and extract the Quartus project for your HDL. Open marquee.qpf in Quartus Prime Lite with the Cyclone V device package. Edit the marquee design. Use SW9…7 to choose the source character for each display. Rotations 0 through 5 wrap the message. Codes 6 and 7 must blank it.
Choose Processing → Start Compilation. Verify that the fitter completed for 5CSEMA5F31C6. In the DE1-SoC binary upload lab, choose Standard, upload output_files/marquee.sof and wait for the programming confirmation. Locate the LED or HEX labels on the board camera before taking your readings.
If your course uses a LabsLand classroom, the upload opens a firmware library instead. Choose Browse files, wait until the SOF is selected, then choose Enter board with selected firmware.
Read the board
| SW9…7 | Prediction, HEX5 to HEX0 | Camera reading |
|---|---|---|
| 000 | ||
| 001 | ||
| 010 | ||
| 011 | ||
| 100 | ||
| 101 | ||
| 110 and 111 | ||
| 000 again |
Use a dash for each blank. Change one of the lower seven switches while SW9…7 remains fixed and check whether the message moves. Explain the difference between selecting a rotation directly and advancing a stored rotation counter.
Hand in
Submit a sketch of the six possible source positions for HEX0, the eight code readings and an explanation of how you wrap an index at six instead of eight.
Adapted from FPGAcademy Digital Logic 21.1, Lab 1, Part VI. LabsLand wrote the DE1-SoC test cases and reference implementations. Verilog handout · VHDL handout · MIT notice
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Digital Logic · Lab 1, Part VI · DE1-SoC
Extend the four-display circuit to six positions. Store the message inside the circuit. Three switches now control its rotation, leaving the other switches free.
Predict the wrap
Read HEX5 through HEX0 from left to right. At rotation zero the three leftmost digits are blank and the three rightmost read dE1. Sketch the next six positions, including the return to zero. At which setting does the first character reappear on the right?
Build
Create marquee in your HDL editor, select it as the top-level file and paste the starter. Complete the source index so each display selects one of six stored characters using SW9…7. Each step from 0 to 5 moves the message one position left. In this activity both spare codes, 6 and 7, blank every display. Choose Standard, synthesize and upload.
Read the board
| SW9…7 | Prediction, HEX5 to HEX0 | Camera reading |
|---|---|---|
| 000 | ||
| 001 | ||
| 010 | ||
| 011 | ||
| 100 | ||
| 101 | ||
| 110 and 111 | ||
| 000 again |
Use a dash for each blank. Change one of the lower seven switches while SW9…7 remains fixed and check whether the message moves. Explain the difference between selecting a rotation directly and advancing a stored rotation counter.
Hand in
Submit a sketch of the six possible source positions for HEX0, the eight code readings and an explanation of how you wrap an index at six instead of eight.
Adapted from FPGAcademy Digital Logic 21.1, Lab 1, Part VI. LabsLand wrote the DE1-SoC test cases and reference implementations. Verilog handout · VHDL handout · MIT notice
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Digital Logic · Lab 1, Part VI · DE1-SoC
Extend the four-display circuit to six positions. Store the message inside the circuit. Three switches now control its rotation, leaving the other switches free.
Predict the wrap
Read HEX5 through HEX0 from left to right. At rotation zero the three leftmost digits are blank and the three rightmost read dE1. Sketch the next six positions, including the return to zero. At which setting does the first character reappear on the right?
Build in Quartus and upload the bitstream
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Download and extract the Quartus project for your HDL. Open marquee.qpf in Quartus Prime Lite with the Cyclone V device package. Edit the marquee design. Use SW9…7 to choose the source character for each display. Rotations 0 through 5 wrap the message. Codes 6 and 7 must blank it.
Choose Processing → Start Compilation. Verify that the fitter completed for 5CSEMA5F31C6. In the DE1-SoC binary upload lab, choose Standard, upload output_files/marquee.sof and wait for the programming confirmation. Locate the LED or HEX labels on the board camera before taking your readings.
If your course uses a LabsLand classroom, the upload opens a firmware library instead. Choose Browse files, wait until the SOF is selected, then choose Enter board with selected firmware.
Read the board
| SW9…7 | Prediction, HEX5 to HEX0 | Camera reading |
|---|---|---|
| 000 | ||
| 001 | ||
| 010 | ||
| 011 | ||
| 100 | ||
| 101 | ||
| 110 and 111 | ||
| 000 again |
Use a dash for each blank. Change one of the lower seven switches while SW9…7 remains fixed and check whether the message moves. Explain the difference between selecting a rotation directly and advancing a stored rotation counter.
Hand in
Submit a sketch of the six possible source positions for HEX0, the eight code readings and an explanation of how you wrap an index at six instead of eight.
Adapted from FPGAcademy Digital Logic 21.1, Lab 1, Part VI. LabsLand wrote the DE1-SoC test cases and reference implementations. Verilog handout · VHDL handout · MIT notice
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Digital Logic · Lab 1, Part VI · DE1-SoC
Extend the four-display circuit to six positions. Store the message inside the circuit. Three switches now control its rotation, leaving the other switches free.
Predict the wrap
Read HEX5 through HEX0 from left to right. At rotation zero the three leftmost digits are blank and the three rightmost read dE1. Sketch the next six positions, including the return to zero. At which setting does the first character reappear on the right?
Build
Create marquee in your HDL editor, select it as the top-level file and paste the starter. Complete the source index so each display selects one of six stored characters using SW9…7. Each step from 0 to 5 moves the message one position left. In this activity both spare codes, 6 and 7, blank every display. Choose Standard, synthesize and upload.
Read the board
| SW9…7 | Prediction, HEX5 to HEX0 | Camera reading |
|---|---|---|
| 000 | ||
| 001 | ||
| 010 | ||
| 011 | ||
| 100 | ||
| 101 | ||
| 110 and 111 | ||
| 000 again |
Use a dash for each blank. Change one of the lower seven switches while SW9…7 remains fixed and check whether the message moves. Explain the difference between selecting a rotation directly and advancing a stored rotation counter.
Hand in
Submit a sketch of the six possible source positions for HEX0, the eight code readings and an explanation of how you wrap an index at six instead of eight.
Adapted from FPGAcademy Digital Logic 21.1, Lab 1, Part VI. LabsLand wrote the DE1-SoC test cases and reference implementations. Verilog handout · VHDL handout · MIT notice
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Digital Logic · Lab 1, Part VI · DE1-SoC
Extend the four-display circuit to six positions. Store the message inside the circuit. Three switches now control its rotation, leaving the other switches free.
Predict the wrap
Read HEX5 through HEX0 from left to right. At rotation zero the three leftmost digits are blank and the three rightmost read dE1. Sketch the next six positions, including the return to zero. At which setting does the first character reappear on the right?
Build in Quartus and upload the bitstream
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Download and extract the Quartus project for your HDL. Open marquee.qpf in Quartus Prime Lite with the Cyclone V device package. Edit the marquee design. Use SW9…7 to choose the source character for each display. Rotations 0 through 5 wrap the message. Codes 6 and 7 must blank it.
Choose Processing → Start Compilation. Verify that the fitter completed for 5CSEMA5F31C6. In the DE1-SoC binary upload lab, choose Standard, upload output_files/marquee.sof and wait for the programming confirmation. Locate the LED or HEX labels on the board camera before taking your readings.
If your course uses a LabsLand classroom, the upload opens a firmware library instead. Choose Browse files, wait until the SOF is selected, then choose Enter board with selected firmware.
Read the board
| SW9…7 | Prediction, HEX5 to HEX0 | Camera reading |
|---|---|---|
| 000 | ||
| 001 | ||
| 010 | ||
| 011 | ||
| 100 | ||
| 101 | ||
| 110 and 111 | ||
| 000 again |
Use a dash for each blank. Change one of the lower seven switches while SW9…7 remains fixed and check whether the message moves. Explain the difference between selecting a rotation directly and advancing a stored rotation counter.
Hand in
Submit a sketch of the six possible source positions for HEX0, the eight code readings and an explanation of how you wrap an index at six instead of eight.
Adapted from FPGAcademy Digital Logic 21.1, Lab 1, Part VI. LabsLand wrote the DE1-SoC test cases and reference implementations. Verilog handout · VHDL handout · MIT notice
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Digital Logic · Lab 2, Part I · DE1-SoC
A switch pattern of 0001 0010 should show 12 on the two rightmost displays. Each four-switch group encodes a decimal digit separately. Design one decoder and use it twice. You will need binary place value, Boolean algebra and the active-low segment convention from Lab 1.
Work out the decoder
Draw a seven-segment digit. Label the top bar 0, the upper-right bar 1, then continue clockwise around the outside to 5. The middle bar is 6. A zero on a segment pin lights that bar. For each digit 0–9 draw its shape and write the seven pin levels in order 6 to 0. For example, digit 1 uses the two right bars, so its pin word is 1111001.
For each segment make a four-input Karnaugh map. Mark the six unused codes 1010–1111 as don't-cares. Group the ones to derive an expression for when the segment is dark. The starter gives the top bar. Check its expression at 1, 4 and 8 before deriving the other six. Use Boolean operators in your HDL for every segment.
Build
Download the starter. Open your HDL in the DE1-SoC Online Editor, choose Standard and create the file decimal_pair. Paste the starter, finish the six equations and choose decimal_pair as the top level. Synthesize, upload and wait for the programming confirmation. Locate HEX1 immediately to the left of HEX0 in the camera.
Read the two displays
Set SW7…4 to the left digit and SW3…0 to the right digit. Before touching the switches, predict the two characters in each row. Record what you can actually read on the board.
| SW7…4 | SW3…0 | Prediction | Camera HEX1 HEX0 |
|---|---|---|---|
| 0000 | 0000 | ||
| 0001 | 0010 | ||
| 0011 | 0100 | ||
| 0101 | 0110 | ||
| 0111 | 1000 | ||
| 1001 | 0000 |
Leave 9 on the right and 0 on the left. Toggle SW8 and SW9. Then set only the left group to 1111. Which digit can you still predict from the specification?
Hand in
Submit one labeled Karnaugh map, its equation, your HDL and the six camera readings. Give a switch setting that would reveal swapped digit groups. Explain why 1001 0000 shows 90 even though the same eight bits represent 144 as an unsigned binary integer.
Adapted from FPGAcademy Digital Logic 21.1, Lab 2, Part I. LabsLand wrote the worksheets, starters and reference designs. Verilog source handout · VHDL source handout · MIT notice
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Digital Logic · Lab 2, Part I · DE1-SoC
A switch pattern of 0001 0010 should show 12 on the two rightmost displays. Each four-switch group encodes a decimal digit separately. Design one decoder and use it twice. You will need binary place value, Boolean algebra and the active-low segment convention from Lab 1.
Work out the decoder
Draw a seven-segment digit. Label the top bar 0, the upper-right bar 1, then continue clockwise around the outside to 5. The middle bar is 6. A zero on a segment pin lights that bar. For each digit 0–9 draw its shape and write the seven pin levels in order 6 to 0. For example, digit 1 uses the two right bars, so its pin word is 1111001.
For each segment make a four-input Karnaugh map. Mark the six unused codes 1010–1111 as don't-cares. Group the ones to derive an expression for when the segment is dark. The starter gives the top bar. Check its expression at 1, 4 and 8 before deriving the other six. Use Boolean operators in your HDL for every segment.
Build in Quartus and upload the bitstream
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Extract the project for your HDL and open decimal_pair.qpf in Quartus Prime Lite with the Cyclone V device package. Complete the six remaining segment equations. Choose Processing → Start Compilation and confirm the fitted device is 5CSEMA5F31C6.
In the Standard DE1-SoC binary upload lab, select output_files/decimal_pair.sof and enter the board. Locate HEX1 immediately to the left of HEX0 in the camera.
Read the two displays
Set SW7…4 to the left digit and SW3…0 to the right digit. Before touching the switches, predict the two characters in each row. Record what you can actually read on the board.
| SW7…4 | SW3…0 | Prediction | Camera HEX1 HEX0 |
|---|---|---|---|
| 0000 | 0000 | ||
| 0001 | 0010 | ||
| 0011 | 0100 | ||
| 0101 | 0110 | ||
| 0111 | 1000 | ||
| 1001 | 0000 |
Leave 9 on the right and 0 on the left. Toggle SW8 and SW9. Then set only the left group to 1111. Which digit can you still predict from the specification?
Hand in
Submit one labeled Karnaugh map, its equation, your HDL and the six camera readings. Give a switch setting that would reveal swapped digit groups. Explain why 1001 0000 shows 90 even though the same eight bits represent 144 as an unsigned binary integer.
Adapted from FPGAcademy Digital Logic 21.1, Lab 2, Part I. LabsLand wrote the worksheets, starters and reference designs. Verilog source handout · VHDL source handout · MIT notice
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Digital Logic · Lab 2, Part I · DE1-SoC
A switch pattern of 0001 0010 should show 12 on the two rightmost displays. Each four-switch group encodes a decimal digit separately. Design one decoder and use it twice. You will need binary place value, Boolean algebra and the active-low segment convention from Lab 1.
Work out the decoder
Draw a seven-segment digit. Label the top bar 0, the upper-right bar 1, then continue clockwise around the outside to 5. The middle bar is 6. A zero on a segment pin lights that bar. For each digit 0–9 draw its shape and write the seven pin levels in order 6 to 0. For example, digit 1 uses the two right bars, so its pin word is 1111001.
For each segment make a four-input Karnaugh map. Mark the six unused codes 1010–1111 as don't-cares. Group the ones to derive an expression for when the segment is dark. The starter gives the top bar. Check its expression at 1, 4 and 8 before deriving the other six. Use Boolean operators in your HDL for every segment.
Build
Download the starter. Open your HDL in the DE1-SoC Online Editor, choose Standard and create the file decimal_pair. Paste the starter, finish the six equations and choose decimal_pair as the top level. Synthesize, upload and wait for the programming confirmation. Locate HEX1 immediately to the left of HEX0 in the camera.
Read the two displays
Set SW7…4 to the left digit and SW3…0 to the right digit. Before touching the switches, predict the two characters in each row. Record what you can actually read on the board.
| SW7…4 | SW3…0 | Prediction | Camera HEX1 HEX0 |
|---|---|---|---|
| 0000 | 0000 | ||
| 0001 | 0010 | ||
| 0011 | 0100 | ||
| 0101 | 0110 | ||
| 0111 | 1000 | ||
| 1001 | 0000 |
Leave 9 on the right and 0 on the left. Toggle SW8 and SW9. Then set only the left group to 1111. Which digit can you still predict from the specification?
Hand in
Submit one labeled Karnaugh map, its equation, your HDL and the six camera readings. Give a switch setting that would reveal swapped digit groups. Explain why 1001 0000 shows 90 even though the same eight bits represent 144 as an unsigned binary integer.
Adapted from FPGAcademy Digital Logic 21.1, Lab 2, Part I. LabsLand wrote the worksheets, starters and reference designs. Verilog source handout · VHDL source handout · MIT notice
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Digital Logic · Lab 2, Part I · DE1-SoC
A switch pattern of 0001 0010 should show 12 on the two rightmost displays. Each four-switch group encodes a decimal digit separately. Design one decoder and use it twice. You will need binary place value, Boolean algebra and the active-low segment convention from Lab 1.
Work out the decoder
Draw a seven-segment digit. Label the top bar 0, the upper-right bar 1, then continue clockwise around the outside to 5. The middle bar is 6. A zero on a segment pin lights that bar. For each digit 0–9 draw its shape and write the seven pin levels in order 6 to 0. For example, digit 1 uses the two right bars, so its pin word is 1111001.
For each segment make a four-input Karnaugh map. Mark the six unused codes 1010–1111 as don't-cares. Group the ones to derive an expression for when the segment is dark. The starter gives the top bar. Check its expression at 1, 4 and 8 before deriving the other six. Use Boolean operators in your HDL for every segment.
Build in Quartus and upload the bitstream
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Extract the project for your HDL and open decimal_pair.qpf in Quartus Prime Lite with the Cyclone V device package. Complete the six remaining segment equations. Choose Processing → Start Compilation and confirm the fitted device is 5CSEMA5F31C6.
In the Standard DE1-SoC binary upload lab, select output_files/decimal_pair.sof and enter the board. Locate HEX1 immediately to the left of HEX0 in the camera.
Read the two displays
Set SW7…4 to the left digit and SW3…0 to the right digit. Before touching the switches, predict the two characters in each row. Record what you can actually read on the board.
| SW7…4 | SW3…0 | Prediction | Camera HEX1 HEX0 |
|---|---|---|---|
| 0000 | 0000 | ||
| 0001 | 0010 | ||
| 0011 | 0100 | ||
| 0101 | 0110 | ||
| 0111 | 1000 | ||
| 1001 | 0000 |
Leave 9 on the right and 0 on the left. Toggle SW8 and SW9. Then set only the left group to 1111. Which digit can you still predict from the specification?
Hand in
Submit one labeled Karnaugh map, its equation, your HDL and the six camera readings. Give a switch setting that would reveal swapped digit groups. Explain why 1001 0000 shows 90 even though the same eight bits represent 144 as an unsigned binary integer.
Adapted from FPGAcademy Digital Logic 21.1, Lab 2, Part I. LabsLand wrote the worksheets, starters and reference designs. Verilog source handout · VHDL source handout · MIT notice
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Digital Logic · Lab 2, Part I · DE1-SoC
A switch pattern of 0001 0010 should show 12 on the two rightmost displays. Each four-switch group encodes a decimal digit separately. Design one decoder and use it twice. You will need binary place value, Boolean algebra and the active-low segment convention from Lab 1.
Work out the decoder
Draw a seven-segment digit. Label the top bar 0, the upper-right bar 1, then continue clockwise around the outside to 5. The middle bar is 6. A zero on a segment pin lights that bar. For each digit 0–9 draw its shape and write the seven pin levels in order 6 to 0. For example, digit 1 uses the two right bars, so its pin word is 1111001.
For each segment make a four-input Karnaugh map. Mark the six unused codes 1010–1111 as don't-cares. Group the ones to derive an expression for when the segment is dark. The starter gives the top bar. Check its expression at 1, 4 and 8 before deriving the other six. Use Boolean operators in your HDL for every segment.
Build
Download the starter. Open your HDL in the DE1-SoC Online Editor, choose Standard and create the file decimal_pair. Paste the starter, finish the six equations and choose decimal_pair as the top level. Synthesize, upload and wait for the programming confirmation. Locate HEX1 immediately to the left of HEX0 in the camera.
Read the two displays
Set SW7…4 to the left digit and SW3…0 to the right digit. Before touching the switches, predict the two characters in each row. Record what you can actually read on the board.
| SW7…4 | SW3…0 | Prediction | Camera HEX1 HEX0 |
|---|---|---|---|
| 0000 | 0000 | ||
| 0001 | 0010 | ||
| 0011 | 0100 | ||
| 0101 | 0110 | ||
| 0111 | 1000 | ||
| 1001 | 0000 |
Leave 9 on the right and 0 on the left. Toggle SW8 and SW9. Then set only the left group to 1111. Which digit can you still predict from the specification?
Hand in
Submit one labeled Karnaugh map, its equation, your HDL and the six camera readings. Give a switch setting that would reveal swapped digit groups. Explain why 1001 0000 shows 90 even though the same eight bits represent 144 as an unsigned binary integer.
Adapted from FPGAcademy Digital Logic 21.1, Lab 2, Part I. LabsLand wrote the worksheets, starters and reference designs. Verilog source handout · VHDL source handout · MIT notice
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Digital Logic · Lab 2, Part I · DE1-SoC
A switch pattern of 0001 0010 should show 12 on the two rightmost displays. Each four-switch group encodes a decimal digit separately. Design one decoder and use it twice. You will need binary place value, Boolean algebra and the active-low segment convention from Lab 1.
Work out the decoder
Draw a seven-segment digit. Label the top bar 0, the upper-right bar 1, then continue clockwise around the outside to 5. The middle bar is 6. A zero on a segment pin lights that bar. For each digit 0–9 draw its shape and write the seven pin levels in order 6 to 0. For example, digit 1 uses the two right bars, so its pin word is 1111001.
For each segment make a four-input Karnaugh map. Mark the six unused codes 1010–1111 as don't-cares. Group the ones to derive an expression for when the segment is dark. The starter gives the top bar. Check its expression at 1, 4 and 8 before deriving the other six. Use Boolean operators in your HDL for every segment.
Build in Quartus and upload the bitstream
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Extract the project for your HDL and open decimal_pair.qpf in Quartus Prime Lite with the Cyclone V device package. Complete the six remaining segment equations. Choose Processing → Start Compilation and confirm the fitted device is 5CSEMA5F31C6.
In the Standard DE1-SoC binary upload lab, select output_files/decimal_pair.sof and enter the board. Locate HEX1 immediately to the left of HEX0 in the camera.
Read the two displays
Set SW7…4 to the left digit and SW3…0 to the right digit. Before touching the switches, predict the two characters in each row. Record what you can actually read on the board.
| SW7…4 | SW3…0 | Prediction | Camera HEX1 HEX0 |
|---|---|---|---|
| 0000 | 0000 | ||
| 0001 | 0010 | ||
| 0011 | 0100 | ||
| 0101 | 0110 | ||
| 0111 | 1000 | ||
| 1001 | 0000 |
Leave 9 on the right and 0 on the left. Toggle SW8 and SW9. Then set only the left group to 1111. Which digit can you still predict from the specification?
Hand in
Submit one labeled Karnaugh map, its equation, your HDL and the six camera readings. Give a switch setting that would reveal swapped digit groups. Explain why 1001 0000 shows 90 even though the same eight bits represent 144 as an unsigned binary integer.
Adapted from FPGAcademy Digital Logic 21.1, Lab 2, Part I. LabsLand wrote the worksheets, starters and reference designs. Verilog source handout · VHDL source handout · MIT notice
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Digital Logic · Lab 2, Part II · DE1-SoC
This time SW3…0 represents one unsigned binary number. Its maximum value is fifteen. Use two displays to show its decimal value, from 00 to 15. The digit decoders from Part I are supplied. Your job is to choose the correct two digits.
Design the conversion
Draw three blocks. A comparator produces z when the input is greater than nine. A correction network converts 1010…1111 to 0000…0101. A four-bit multiplexer selects the original nibble when z is zero and the corrected value when z is one. The tens digit is z padded to four bits. Fill in the six correction rows and mark the other ten inputs as don't-cares for that network. Which two input bits distinguish 8 and 9 from the six numbers that need correction?
Download and extract the complete worksheet. Edit starter/binary_to_decimal with the extension for your HDL. Complete the comparator and correction equations with Boolean operators. Implement the multiplexer with bit masks. Keep both digit decoders and use continuous or concurrent assignments throughout the converter.
Simulate the design
Run the testbench from the extracted worksheet folder. The testbench changes the input every 10 ns and saves the waveform in conversion.vcd.
Verilog uses Icarus Verilog.
iverilog -g2005 -s trace_tb -o bench starter/binary_to_decimal.v simulation/trace_tb.v
vvp bench
Open conversion.vcd in a waveform viewer such as Surfer. In trace_tb → dut, add v, z, adjusted, ones_digit, HEX1 and HEX0. Read the signals between stimulus changes. At 95 ns you are observing input 9. Move the cursor to 105 ns for input 10. Identify the comparator output, the selected multiplexer input and the active-low digit output. Repeat at 155 ns, then check all sixteen input words on the board.
Run each input from 0 to 15 in functional simulation. Record v, z, adjusted, ones_digit and both HEX outputs. At 9 and 10 inspect all three blocks. At 8 explain why adjusted has no effect on the result.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
binary_to_decimal, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Read the board
| Binary input | Decimal output predicted | Simulated HEX1 HEX0 | Camera HEX1 HEX0 |
|---|---|---|---|
| 0000–0011 | |||
| 0100–0111 | |||
| 1000–1011 | |||
| 1100–1111 |
Write four two-digit readings per row. Locate HEX1 and HEX0 on the board camera. Use the four lowest switches to step through the sixteen inputs. Leave the six higher switches unchanged. If a digit looks like a letter, check whether you bypassed the decimal correction.
Hand in
Submit the six-row truth table, your comparator expression, the 9→10 simulated trace and all sixteen hardware readings. Explain why the ones digit must fall from 9 to 0 at the same transition that turns the left digit from 0 to 1.
Adapted from FPGAcademy Digital Logic 21.1, Verilog Lab 2, Part II and the VHDL edition. LabsLand wrote the programs, tests and worksheet. MIT notice
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Digital Logic · Lab 2, Part II · DE1-SoC
This time SW3…0 represents one unsigned binary number. Its maximum value is fifteen. Use two displays to show its decimal value, from 00 to 15. The digit decoders from Part I are supplied. Your job is to choose the correct two digits.
Design the conversion
Draw three blocks. A comparator produces z when the input is greater than nine. A correction network converts 1010…1111 to 0000…0101. A four-bit multiplexer selects the original nibble when z is zero and the corrected value when z is one. The tens digit is z padded to four bits. Fill in the six correction rows and mark the other ten inputs as don't-cares for that network. Which two input bits distinguish 8 and 9 from the six numbers that need correction?
Download and extract the complete worksheet. Edit starter/binary_to_decimal with the extension for your HDL. Complete the comparator and correction equations with Boolean operators. Implement the multiplexer with bit masks. Keep both digit decoders and use continuous or concurrent assignments throughout the converter.
Simulate the design
Run the testbench from the extracted worksheet folder. The testbench changes the input every 10 ns and saves the waveform in conversion.vcd.
Verilog uses Icarus Verilog.
iverilog -g2005 -s trace_tb -o bench starter/binary_to_decimal.v simulation/trace_tb.v
vvp bench
Open conversion.vcd in a waveform viewer such as Surfer. In trace_tb → dut, add v, z, adjusted, ones_digit, HEX1 and HEX0. Read the signals between stimulus changes. At 95 ns you are observing input 9. Move the cursor to 105 ns for input 10. Identify the comparator output, the selected multiplexer input and the active-low digit output. Repeat at 155 ns, then check all sixteen input words on the board.
Run each input from 0 to 15 in functional simulation. Record v, z, adjusted, ones_digit and both HEX outputs. At 9 and 10 inspect all three blocks. At 8 explain why adjusted has no effect on the result.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/binary_to_decimal.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
binary_to_decimal. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/binary_to_decimal.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Read the board
| Binary input | Decimal output predicted | Simulated HEX1 HEX0 | Camera HEX1 HEX0 |
|---|---|---|---|
| 0000–0011 | |||
| 0100–0111 | |||
| 1000–1011 | |||
| 1100–1111 |
Write four two-digit readings per row. Locate HEX1 and HEX0 on the board camera. Use the four lowest switches to step through the sixteen inputs. Leave the six higher switches unchanged. If a digit looks like a letter, check whether you bypassed the decimal correction.
Hand in
Submit the six-row truth table, your comparator expression, the 9→10 simulated trace and all sixteen hardware readings. Explain why the ones digit must fall from 9 to 0 at the same transition that turns the left digit from 0 to 1.
Adapted from FPGAcademy Digital Logic 21.1, Verilog Lab 2, Part II and the VHDL edition. LabsLand wrote the programs, tests and worksheet. MIT notice
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Digital Logic · Lab 2, Part II · DE1-SoC
This time SW3…0 represents one unsigned binary number. Its maximum value is fifteen. Use two displays to show its decimal value, from 00 to 15. The digit decoders from Part I are supplied. Your job is to choose the correct two digits.
Design the conversion
Draw three blocks. A comparator produces z when the input is greater than nine. A correction network converts 1010…1111 to 0000…0101. A four-bit multiplexer selects the original nibble when z is zero and the corrected value when z is one. The tens digit is z padded to four bits. Fill in the six correction rows and mark the other ten inputs as don't-cares for that network. Which two input bits distinguish 8 and 9 from the six numbers that need correction?
Download and extract the complete worksheet. Edit starter/binary_to_decimal with the extension for your HDL. Complete the comparator and correction equations with Boolean operators. Implement the multiplexer with bit masks. Keep both digit decoders and use continuous or concurrent assignments throughout the converter.
Simulate the design
Run the testbench from the extracted worksheet folder. The testbench changes the input every 10 ns and saves the waveform in conversion.vcd.
VHDL uses NVC with VHDL-2008.
nvc --std=2008 -a starter/binary_to_decimal.vhd simulation/trace_tb.vhd
nvc --std=2008 -e trace_tb
nvc --std=2008 -r trace_tb --format=vcd --wave=conversion.vcd
Open conversion.vcd in a waveform viewer such as Surfer. In trace_tb → dut, add v, z, adjusted, ones_digit, HEX1 and HEX0. Read the signals between stimulus changes. At 95 ns you are observing input 9. Move the cursor to 105 ns for input 10. Identify the comparator output, the selected multiplexer input and the active-low digit output. Repeat at 155 ns, then check all sixteen input words on the board.
Run each input from 0 to 15 in functional simulation. Record v, z, adjusted, ones_digit and both HEX outputs. At 9 and 10 inspect all three blocks. At 8 explain why adjusted has no effect on the result.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
binary_to_decimal, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Read the board
| Binary input | Decimal output predicted | Simulated HEX1 HEX0 | Camera HEX1 HEX0 |
|---|---|---|---|
| 0000–0011 | |||
| 0100–0111 | |||
| 1000–1011 | |||
| 1100–1111 |
Write four two-digit readings per row. Locate HEX1 and HEX0 on the board camera. Use the four lowest switches to step through the sixteen inputs. Leave the six higher switches unchanged. If a digit looks like a letter, check whether you bypassed the decimal correction.
Hand in
Submit the six-row truth table, your comparator expression, the 9→10 simulated trace and all sixteen hardware readings. Explain why the ones digit must fall from 9 to 0 at the same transition that turns the left digit from 0 to 1.
Adapted from FPGAcademy Digital Logic 21.1, Verilog Lab 2, Part II and the VHDL edition. LabsLand wrote the programs, tests and worksheet. MIT notice
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Digital Logic · Lab 2, Part II · DE1-SoC
This time SW3…0 represents one unsigned binary number. Its maximum value is fifteen. Use two displays to show its decimal value, from 00 to 15. The digit decoders from Part I are supplied. Your job is to choose the correct two digits.
Design the conversion
Draw three blocks. A comparator produces z when the input is greater than nine. A correction network converts 1010…1111 to 0000…0101. A four-bit multiplexer selects the original nibble when z is zero and the corrected value when z is one. The tens digit is z padded to four bits. Fill in the six correction rows and mark the other ten inputs as don't-cares for that network. Which two input bits distinguish 8 and 9 from the six numbers that need correction?
Download and extract the complete worksheet. Edit starter/binary_to_decimal with the extension for your HDL. Complete the comparator and correction equations with Boolean operators. Implement the multiplexer with bit masks. Keep both digit decoders and use continuous or concurrent assignments throughout the converter.
Simulate the design
Run the testbench from the extracted worksheet folder. The testbench changes the input every 10 ns and saves the waveform in conversion.vcd.
VHDL uses NVC with VHDL-2008.
nvc --std=2008 -a starter/binary_to_decimal.vhd simulation/trace_tb.vhd
nvc --std=2008 -e trace_tb
nvc --std=2008 -r trace_tb --format=vcd --wave=conversion.vcd
Open conversion.vcd in a waveform viewer such as Surfer. In trace_tb → dut, add v, z, adjusted, ones_digit, HEX1 and HEX0. Read the signals between stimulus changes. At 95 ns you are observing input 9. Move the cursor to 105 ns for input 10. Identify the comparator output, the selected multiplexer input and the active-low digit output. Repeat at 155 ns, then check all sixteen input words on the board.
Run each input from 0 to 15 in functional simulation. Record v, z, adjusted, ones_digit and both HEX outputs. At 9 and 10 inspect all three blocks. At 8 explain why adjusted has no effect on the result.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/binary_to_decimal.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
binary_to_decimal. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/binary_to_decimal.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Read the board
| Binary input | Decimal output predicted | Simulated HEX1 HEX0 | Camera HEX1 HEX0 |
|---|---|---|---|
| 0000–0011 | |||
| 0100–0111 | |||
| 1000–1011 | |||
| 1100–1111 |
Write four two-digit readings per row. Locate HEX1 and HEX0 on the board camera. Use the four lowest switches to step through the sixteen inputs. Leave the six higher switches unchanged. If a digit looks like a letter, check whether you bypassed the decimal correction.
Hand in
Submit the six-row truth table, your comparator expression, the 9→10 simulated trace and all sixteen hardware readings. Explain why the ones digit must fall from 9 to 0 at the same transition that turns the left digit from 0 to 1.
Adapted from FPGAcademy Digital Logic 21.1, Verilog Lab 2, Part II and the VHDL edition. LabsLand wrote the programs, tests and worksheet. MIT notice
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Digital Logic · Lab 2, Part II · DE1-SoC
This time SW3…0 represents one unsigned binary number. Its maximum value is fifteen. Use two displays to show its decimal value, from 00 to 15. The digit decoders from Part I are supplied. Your job is to choose the correct two digits.
Design the conversion
Draw three blocks. A comparator produces z when the input is greater than nine. A correction network converts 1010…1111 to 0000…0101. A four-bit multiplexer selects the original nibble when z is zero and the corrected value when z is one. The tens digit is z padded to four bits. Fill in the six correction rows and mark the other ten inputs as don't-cares for that network. Which two input bits distinguish 8 and 9 from the six numbers that need correction?
Download and extract the complete worksheet. Edit starter/binary_to_decimal with the extension for your HDL. Complete the comparator and correction equations with Boolean operators. Implement the multiplexer with bit masks. Keep both digit decoders and use continuous or concurrent assignments throughout the converter.
Simulate the design
Run the testbench from the extracted worksheet folder. The testbench changes the input every 10 ns and saves the waveform in conversion.vcd.
SystemVerilog uses Icarus Verilog with SystemVerilog enabled.
iverilog -g2012 -s trace_tb -o bench starter/binary_to_decimal.sv simulation/trace_tb.v
vvp bench
Open conversion.vcd in a waveform viewer such as Surfer. In trace_tb → dut, add v, z, adjusted, ones_digit, HEX1 and HEX0. Read the signals between stimulus changes. At 95 ns you are observing input 9. Move the cursor to 105 ns for input 10. Identify the comparator output, the selected multiplexer input and the active-low digit output. Repeat at 155 ns, then check all sixteen input words on the board.
Run each input from 0 to 15 in functional simulation. Record v, z, adjusted, ones_digit and both HEX outputs. At 9 and 10 inspect all three blocks. At 8 explain why adjusted has no effect on the result.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
binary_to_decimal, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Read the board
| Binary input | Decimal output predicted | Simulated HEX1 HEX0 | Camera HEX1 HEX0 |
|---|---|---|---|
| 0000–0011 | |||
| 0100–0111 | |||
| 1000–1011 | |||
| 1100–1111 |
Write four two-digit readings per row. Locate HEX1 and HEX0 on the board camera. Use the four lowest switches to step through the sixteen inputs. Leave the six higher switches unchanged. If a digit looks like a letter, check whether you bypassed the decimal correction.
Hand in
Submit the six-row truth table, your comparator expression, the 9→10 simulated trace and all sixteen hardware readings. Explain why the ones digit must fall from 9 to 0 at the same transition that turns the left digit from 0 to 1.
Adapted from FPGAcademy Digital Logic 21.1, Verilog Lab 2, Part II and the VHDL edition. LabsLand wrote the programs, tests and worksheet. MIT notice
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Digital Logic · Lab 2, Part II · DE1-SoC
This time SW3…0 represents one unsigned binary number. Its maximum value is fifteen. Use two displays to show its decimal value, from 00 to 15. The digit decoders from Part I are supplied. Your job is to choose the correct two digits.
Design the conversion
Draw three blocks. A comparator produces z when the input is greater than nine. A correction network converts 1010…1111 to 0000…0101. A four-bit multiplexer selects the original nibble when z is zero and the corrected value when z is one. The tens digit is z padded to four bits. Fill in the six correction rows and mark the other ten inputs as don't-cares for that network. Which two input bits distinguish 8 and 9 from the six numbers that need correction?
Download and extract the complete worksheet. Edit starter/binary_to_decimal with the extension for your HDL. Complete the comparator and correction equations with Boolean operators. Implement the multiplexer with bit masks. Keep both digit decoders and use continuous or concurrent assignments throughout the converter.
Simulate the design
Run the testbench from the extracted worksheet folder. The testbench changes the input every 10 ns and saves the waveform in conversion.vcd.
SystemVerilog uses Icarus Verilog with SystemVerilog enabled.
iverilog -g2012 -s trace_tb -o bench starter/binary_to_decimal.sv simulation/trace_tb.v
vvp bench
Open conversion.vcd in a waveform viewer such as Surfer. In trace_tb → dut, add v, z, adjusted, ones_digit, HEX1 and HEX0. Read the signals between stimulus changes. At 95 ns you are observing input 9. Move the cursor to 105 ns for input 10. Identify the comparator output, the selected multiplexer input and the active-low digit output. Repeat at 155 ns, then check all sixteen input words on the board.
Run each input from 0 to 15 in functional simulation. Record v, z, adjusted, ones_digit and both HEX outputs. At 9 and 10 inspect all three blocks. At 8 explain why adjusted has no effect on the result.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/binary_to_decimal.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
binary_to_decimal. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/binary_to_decimal.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Read the board
| Binary input | Decimal output predicted | Simulated HEX1 HEX0 | Camera HEX1 HEX0 |
|---|---|---|---|
| 0000–0011 | |||
| 0100–0111 | |||
| 1000–1011 | |||
| 1100–1111 |
Write four two-digit readings per row. Locate HEX1 and HEX0 on the board camera. Use the four lowest switches to step through the sixteen inputs. Leave the six higher switches unchanged. If a digit looks like a letter, check whether you bypassed the decimal correction.
Hand in
Submit the six-row truth table, your comparator expression, the 9→10 simulated trace and all sixteen hardware readings. Explain why the ones digit must fall from 9 to 0 at the same transition that turns the left digit from 0 to 1.
Adapted from FPGAcademy Digital Logic 21.1, Verilog Lab 2, Part II and the VHDL edition. LabsLand wrote the programs, tests and worksheet. MIT notice
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
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.
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
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
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.
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 in Quartus and upload the bitstream
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
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.
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
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
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.
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
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
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.
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 in Quartus and upload the bitstream
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
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.
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
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
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.
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
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
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.
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 in Quartus and upload the bitstream
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
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.
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
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
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.
Design the circuit
The circuit already contains a four-stage ripple adder. Find its four sum bits and final carry. Design a signal that is high whenever the raw five-bit result is at least ten. Use Boolean gates to correct the low nibble to a decimal ones digit. Consider both 10–15 and 16–19. The left decimal digit can only be zero or one. Keep the two input displays and the invalid-input indicator connected.
Build
Download the starter in your HDL. In the DE1-SoC Online Editor, choose Standard and set bcd_gates as the top level. Synthesize, upload the program and wait for the physical board camera.
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 your decimal-carry equation, an annotated trace for 9 + 9 + 1 and the camera observations. Explain why checking the carry out of bit 3 alone misses a decimal carry.
Adapted from FPGAcademy Digital Logic 21.1 · Lab 2, IV · Verilog, VHDL. Original LabsLand programs, tests and worksheet. MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
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.
Design the circuit
The circuit already contains a four-stage ripple adder. Find its four sum bits and final carry. Design a signal that is high whenever the raw five-bit result is at least ten. Use Boolean gates to correct the low nibble to a decimal ones digit. Consider both 10–15 and 16–19. The left decimal digit can only be zero or one. Keep the two input displays and the invalid-input indicator connected.
Build in Quartus and upload the bitstream
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Download and extract the Quartus project for your HDL. Open bcd_gates.qpf in Quartus Prime Lite with the Cyclone V device package. Edit the bcd_gates design. Build the binary full-adder chain, decimal correction and invalid-input flag using gates. Use your sketch to identify the signals for the physical tests.
Choose Processing → Start Compilation. Verify that the fitter completed for 5CSEMA5F31C6. In the DE1-SoC binary upload lab, choose Standard, upload output_files/bcd_gates.sof and wait for the programming confirmation. Locate the LED or HEX labels on the board camera before taking your readings.
If your course uses a LabsLand classroom, the upload opens a firmware library instead. Choose Browse files, wait until the SOF is selected, then choose Enter board with selected firmware.
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 your decimal-carry equation, an annotated trace for 9 + 9 + 1 and the camera observations. Explain why checking the carry out of bit 3 alone misses a decimal carry.
Adapted from FPGAcademy Digital Logic 21.1 · Lab 2, IV · Verilog, VHDL. Original LabsLand programs, tests and worksheet. MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
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.
Design the circuit
The circuit already contains a four-stage ripple adder. Find its four sum bits and final carry. Design a signal that is high whenever the raw five-bit result is at least ten. Use Boolean gates to correct the low nibble to a decimal ones digit. Consider both 10–15 and 16–19. The left decimal digit can only be zero or one. Keep the two input displays and the invalid-input indicator connected.
Build
Download the starter in your HDL. In the DE1-SoC Online Editor, choose Standard and set bcd_gates as the top level. Synthesize, upload the program and wait for the physical board camera.
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 your decimal-carry equation, an annotated trace for 9 + 9 + 1 and the camera observations. Explain why checking the carry out of bit 3 alone misses a decimal carry.
Adapted from FPGAcademy Digital Logic 21.1 · Lab 2, IV · Verilog, VHDL. Original LabsLand programs, tests and worksheet. MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
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.
Design the circuit
The circuit already contains a four-stage ripple adder. Find its four sum bits and final carry. Design a signal that is high whenever the raw five-bit result is at least ten. Use Boolean gates to correct the low nibble to a decimal ones digit. Consider both 10–15 and 16–19. The left decimal digit can only be zero or one. Keep the two input displays and the invalid-input indicator connected.
Build in Quartus and upload the bitstream
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Download and extract the Quartus project for your HDL. Open bcd_gates.qpf in Quartus Prime Lite with the Cyclone V device package. Edit the bcd_gates design. Build the binary full-adder chain, decimal correction and invalid-input flag using gates. Use your sketch to identify the signals for the physical tests.
Choose Processing → Start Compilation. Verify that the fitter completed for 5CSEMA5F31C6. In the DE1-SoC binary upload lab, choose Standard, upload output_files/bcd_gates.sof and wait for the programming confirmation. Locate the LED or HEX labels on the board camera before taking your readings.
If your course uses a LabsLand classroom, the upload opens a firmware library instead. Choose Browse files, wait until the SOF is selected, then choose Enter board with selected firmware.
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 your decimal-carry equation, an annotated trace for 9 + 9 + 1 and the camera observations. Explain why checking the carry out of bit 3 alone misses a decimal carry.
Adapted from FPGAcademy Digital Logic 21.1 · Lab 2, IV · Verilog, VHDL. Original LabsLand programs, tests and worksheet. MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
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.
Design the circuit
The circuit already contains a four-stage ripple adder. Find its four sum bits and final carry. Design a signal that is high whenever the raw five-bit result is at least ten. Use Boolean gates to correct the low nibble to a decimal ones digit. Consider both 10–15 and 16–19. The left decimal digit can only be zero or one. Keep the two input displays and the invalid-input indicator connected.
Build
Download the starter in your HDL. In the DE1-SoC Online Editor, choose Standard and set bcd_gates as the top level. Synthesize, upload the program and wait for the physical board camera.
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 your decimal-carry equation, an annotated trace for 9 + 9 + 1 and the camera observations. Explain why checking the carry out of bit 3 alone misses a decimal carry.
Adapted from FPGAcademy Digital Logic 21.1 · Lab 2, IV · Verilog, VHDL. Original LabsLand programs, tests and worksheet. MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
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.
Design the circuit
The circuit already contains a four-stage ripple adder. Find its four sum bits and final carry. Design a signal that is high whenever the raw five-bit result is at least ten. Use Boolean gates to correct the low nibble to a decimal ones digit. Consider both 10–15 and 16–19. The left decimal digit can only be zero or one. Keep the two input displays and the invalid-input indicator connected.
Build in Quartus and upload the bitstream
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Download and extract the Quartus project for your HDL. Open bcd_gates.qpf in Quartus Prime Lite with the Cyclone V device package. Edit the bcd_gates design. Build the binary full-adder chain, decimal correction and invalid-input flag using gates. Use your sketch to identify the signals for the physical tests.
Choose Processing → Start Compilation. Verify that the fitter completed for 5CSEMA5F31C6. In the DE1-SoC binary upload lab, choose Standard, upload output_files/bcd_gates.sof and wait for the programming confirmation. Locate the LED or HEX labels on the board camera before taking your readings.
If your course uses a LabsLand classroom, the upload opens a firmware library instead. Choose Browse files, wait until the SOF is selected, then choose Enter board with selected firmware.
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 your decimal-carry equation, an annotated trace for 9 + 9 + 1 and the camera observations. Explain why checking the carry out of bit 3 alone misses a decimal carry.
Adapted from FPGAcademy Digital Logic 21.1 · Lab 2, IV · Verilog, VHDL. Original LabsLand programs, tests and worksheet. MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
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.
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
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
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
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
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.
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
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
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
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
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.
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
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
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
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
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.
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
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
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.
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 in Quartus and upload the bitstream
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
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.
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
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
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.
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
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
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.
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 in Quartus and upload the bitstream
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
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.
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
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
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.
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
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
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.
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 in Quartus and upload the bitstream
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
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.
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
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Build one bit of memory from two cross-coupled NOR gates. Use SW0 for set, SW1 for reset, SW2 for the gate and LED0 for Q. Predict whether the output changes when set goes high while the gate is closed.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Open project/gated_rs.qpf from your Quartus worksheet ZIP. The reset path is complete. Compare its gate polarity with the set path. Correct the path that can change Q with the gate closed. Preserve the marked intermediate signals. In RTL Viewer trace both feedback connections. Then open the post-mapping Technology Map Viewer and compare the LUTs with your gate drawing.
Simulate
Extract the complete worksheet ZIP. In the folder containing activity.md, run the commands below with Icarus Verilog for Verilog or SystemVerilog, or NVC for VHDL. The testbench applies the switch sequence and checks the observable retained states.
Verilog
iverilog -g2005 -s test_gated_rs -o bench project/gated_rs.v simulation/test_gated_rs.v
vvp bench
Test on the DE1-SoC
Upload output_files/gated_rs.sof through the DE1-SoC bitstream uploader. With the gate open, assert reset and release it. Assert set and release it. Close the gate, assert reset, then reopen the gate. Change one switch at a time. Keep set and reset from being asserted together. Annotate where the previous value survives.
| Switch action | Previous output | Predicted | Camera |
|---|---|---|---|
FPGAcademy · Digital Logic · Lab 3 · I. VERILOG · VHDL · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Build one bit of memory from two cross-coupled NOR gates. Use SW0 for set, SW1 for reset, SW2 for the gate and LED0 for Q. Predict whether the output changes when set goes high while the gate is closed.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Open project/gated_rs.qpf from your Quartus worksheet ZIP. The reset path is complete. Compare its gate polarity with the set path. Correct the path that can change Q with the gate closed. Preserve the marked intermediate signals. In RTL Viewer trace both feedback connections. Then open the post-mapping Technology Map Viewer and compare the LUTs with your gate drawing.
Simulate
Extract the complete worksheet ZIP. In the folder containing activity.md, run the commands below with Icarus Verilog for Verilog or SystemVerilog, or NVC for VHDL. The testbench applies the switch sequence and checks the observable retained states.
VHDL
nvc --std=2008 -a project/gated_rs.vhd simulation/test_gated_rs.vhd
nvc --std=2008 -e test_gated_rs
nvc --std=2008 -r test_gated_rs
Test on the DE1-SoC
Upload output_files/gated_rs.sof through the DE1-SoC bitstream uploader. With the gate open, assert reset and release it. Assert set and release it. Close the gate, assert reset, then reopen the gate. Change one switch at a time. Keep set and reset from being asserted together. Annotate where the previous value survives.
| Switch action | Previous output | Predicted | Camera |
|---|---|---|---|
FPGAcademy · Digital Logic · Lab 3 · I. VERILOG · VHDL · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Build one bit of memory from two cross-coupled NOR gates. Use SW0 for set, SW1 for reset, SW2 for the gate and LED0 for Q. Predict whether the output changes when set goes high while the gate is closed.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Open project/gated_rs.qpf from your Quartus worksheet ZIP. The reset path is complete. Compare its gate polarity with the set path. Correct the path that can change Q with the gate closed. Preserve the marked intermediate signals. In RTL Viewer trace both feedback connections. Then open the post-mapping Technology Map Viewer and compare the LUTs with your gate drawing.
Simulate
Extract the complete worksheet ZIP. In the folder containing activity.md, run the commands below with Icarus Verilog for Verilog or SystemVerilog, or NVC for VHDL. The testbench applies the switch sequence and checks the observable retained states.
SystemVerilog
iverilog -g2012 -s test_gated_rs -o bench project/gated_rs.sv simulation/test_gated_rs.v
vvp bench
Test on the DE1-SoC
Upload output_files/gated_rs.sof through the DE1-SoC bitstream uploader. With the gate open, assert reset and release it. Assert set and release it. Close the gate, assert reset, then reopen the gate. Change one switch at a time. Keep set and reset from being asserted together. Annotate where the previous value survives.
| Switch action | Previous output | Predicted | Camera |
|---|---|---|---|
FPGAcademy · Digital Logic · Lab 3 · I. VERILOG · VHDL · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Use one data input to generate complementary set and reset signals. SW0 supplies D, SW1 opens the latch and LED0 shows Q. Predict two different values of Q for the same closed-gate inputs by choosing two different histories.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Open project/gated_data.qpf from your Quartus worksheet ZIP. Inspect the gate connection at the top level and repair its active level. Preserve the individual data and gate terms. Compile and locate them in Technology Map Viewer (Post-Mapping). Run the functional bench. Open Timing Analyzer on the fitted Cyclone V design. Find the path from SW[0] to LEDR[0]. The fitted storage determines how Quartus reports it.
| Project | Command from the fitted project directory |
|---|---|
| Verilog or SystemVerilog | quartus_sta -t ../simulation/latch_path.tcl |
| VHDL | quartus_sta -t ../simulation/latch_feedback.tcl |
Open latch-path.txt. For Verilog or SystemVerilog, record the two paths on either side of the fitted latch. For VHDL, locate the stored feedback output in the full switch-to-LED report. Read the cumulative delay up to that row. Subtract it from the total to find the remaining delay to the LED. In both cases name the endpoints and timing corner, and identify one logic and one routing contribution.
Simulate
Extract the complete worksheet ZIP. In the folder containing activity.md, run the commands below with Icarus Verilog for Verilog or SystemVerilog, or NVC for VHDL. The testbench applies the switch sequence and checks the observable retained states.
Verilog
iverilog -g2005 -s test_gated_data -o bench project/gated_data.v simulation/test_gated_data.v
vvp bench
Test on the DE1-SoC
Upload output_files/gated_data.sof through the DE1-SoC bitstream uploader. Open the gate and switch D from 0 to 1. Close the gate and lower D. Reopen it. Repeat with the opposite stored value. Record both histories. Use the camera to record retained states and compare them with your functional predictions.
| Switch action | Previous output | Predicted | Camera |
|---|---|---|---|
FPGAcademy · Digital Logic · Lab 3 · II. VERILOG · VHDL · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Use one data input to generate complementary set and reset signals. SW0 supplies D, SW1 opens the latch and LED0 shows Q. Predict two different values of Q for the same closed-gate inputs by choosing two different histories.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Open project/gated_data.qpf from your Quartus worksheet ZIP. Inspect the gate connection at the top level and repair its active level. Preserve the individual data and gate terms. Compile and locate them in Technology Map Viewer (Post-Mapping). Run the functional bench. Open Timing Analyzer on the fitted Cyclone V design. Find the path from SW[0] to LEDR[0]. The fitted storage determines how Quartus reports it.
| Project | Command from the fitted project directory |
|---|---|
| Verilog or SystemVerilog | quartus_sta -t ../simulation/latch_path.tcl |
| VHDL | quartus_sta -t ../simulation/latch_feedback.tcl |
Open latch-path.txt. For Verilog or SystemVerilog, record the two paths on either side of the fitted latch. For VHDL, locate the stored feedback output in the full switch-to-LED report. Read the cumulative delay up to that row. Subtract it from the total to find the remaining delay to the LED. In both cases name the endpoints and timing corner, and identify one logic and one routing contribution.
Simulate
Extract the complete worksheet ZIP. In the folder containing activity.md, run the commands below with Icarus Verilog for Verilog or SystemVerilog, or NVC for VHDL. The testbench applies the switch sequence and checks the observable retained states.
VHDL
nvc --std=2008 -a project/gated_data.vhd simulation/test_gated_data.vhd
nvc --std=2008 -e test_gated_data
nvc --std=2008 -r test_gated_data
Test on the DE1-SoC
Upload output_files/gated_data.sof through the DE1-SoC bitstream uploader. Open the gate and switch D from 0 to 1. Close the gate and lower D. Reopen it. Repeat with the opposite stored value. Record both histories. Use the camera to record retained states and compare them with your functional predictions.
| Switch action | Previous output | Predicted | Camera |
|---|---|---|---|
FPGAcademy · Digital Logic · Lab 3 · II. VERILOG · VHDL · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Use one data input to generate complementary set and reset signals. SW0 supplies D, SW1 opens the latch and LED0 shows Q. Predict two different values of Q for the same closed-gate inputs by choosing two different histories.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Open project/gated_data.qpf from your Quartus worksheet ZIP. Inspect the gate connection at the top level and repair its active level. Preserve the individual data and gate terms. Compile and locate them in Technology Map Viewer (Post-Mapping). Run the functional bench. Open Timing Analyzer on the fitted Cyclone V design. Find the path from SW[0] to LEDR[0]. The fitted storage determines how Quartus reports it.
| Project | Command from the fitted project directory |
|---|---|
| Verilog or SystemVerilog | quartus_sta -t ../simulation/latch_path.tcl |
| VHDL | quartus_sta -t ../simulation/latch_feedback.tcl |
Open latch-path.txt. For Verilog or SystemVerilog, record the two paths on either side of the fitted latch. For VHDL, locate the stored feedback output in the full switch-to-LED report. Read the cumulative delay up to that row. Subtract it from the total to find the remaining delay to the LED. In both cases name the endpoints and timing corner, and identify one logic and one routing contribution.
Simulate
Extract the complete worksheet ZIP. In the folder containing activity.md, run the commands below with Icarus Verilog for Verilog or SystemVerilog, or NVC for VHDL. The testbench applies the switch sequence and checks the observable retained states.
SystemVerilog
iverilog -g2012 -s test_gated_data -o bench project/gated_data.sv simulation/test_gated_data.v
vvp bench
Test on the DE1-SoC
Upload output_files/gated_data.sof through the DE1-SoC bitstream uploader. Open the gate and switch D from 0 to 1. Close the gate and lower D. Reopen it. Repeat with the opposite stored value. Record both histories. Use the camera to record retained states and compare them with your functional predictions.
| Switch action | Previous output | Predicted | Camera |
|---|---|---|---|
FPGAcademy · Digital Logic · Lab 3 · II. VERILOG · VHDL · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Connect two D latches so only one is transparent at a time. SW0 is D and SW1 is the clock. LED1 shows the master. LED0 shows the slave output. Predict which LED can change while the clock is low.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Open project/master_slave.qpf from your Quartus worksheet ZIP. Inspect both gate connections. The starter can make both latches transparent together. Repair their clock phases so the slave presents the value captured on the rising edge. Run the bench, compile and trace the path through both stages in Technology Map Viewer (Post-Mapping).
Simulate
Extract the complete worksheet ZIP. In the folder containing activity.md, run the commands below with Icarus Verilog for Verilog or SystemVerilog, or NVC for VHDL. The testbench applies the switch sequence and checks the observable retained states.
Verilog
iverilog -g2005 -s test_master_slave -o bench project/master_slave.v simulation/test_master_slave.v
vvp bench
Test on the DE1-SoC
Upload output_files/master_slave.sof through the DE1-SoC bitstream uploader. Start with D and clock low. Pulse the clock high then low to establish a known output. Raise D with clock low. Raise the clock. Lower D while clock stays high, then lower the clock. Read the LEDs after each action. Explain the interval in which the master and slave disagree.
| Switch action | Previous output | Predicted | Camera |
|---|---|---|---|
FPGAcademy · Digital Logic · Lab 3 · III. VERILOG · VHDL · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Connect two D latches so only one is transparent at a time. SW0 is D and SW1 is the clock. LED1 shows the master. LED0 shows the slave output. Predict which LED can change while the clock is low.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Open project/master_slave.qpf from your Quartus worksheet ZIP. Inspect both gate connections. The starter can make both latches transparent together. Repair their clock phases so the slave presents the value captured on the rising edge. Run the bench, compile and trace the path through both stages in Technology Map Viewer (Post-Mapping).
Simulate
Extract the complete worksheet ZIP. In the folder containing activity.md, run the commands below with Icarus Verilog for Verilog or SystemVerilog, or NVC for VHDL. The testbench applies the switch sequence and checks the observable retained states.
VHDL
nvc --std=2008 -a project/master_slave.vhd simulation/test_master_slave.vhd
nvc --std=2008 -e test_master_slave
nvc --std=2008 -r test_master_slave
Test on the DE1-SoC
Upload output_files/master_slave.sof through the DE1-SoC bitstream uploader. Start with D and clock low. Pulse the clock high then low to establish a known output. Raise D with clock low. Raise the clock. Lower D while clock stays high, then lower the clock. Read the LEDs after each action. Explain the interval in which the master and slave disagree.
| Switch action | Previous output | Predicted | Camera |
|---|---|---|---|
FPGAcademy · Digital Logic · Lab 3 · III. VERILOG · VHDL · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Connect two D latches so only one is transparent at a time. SW0 is D and SW1 is the clock. LED1 shows the master. LED0 shows the slave output. Predict which LED can change while the clock is low.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Open project/master_slave.qpf from your Quartus worksheet ZIP. Inspect both gate connections. The starter can make both latches transparent together. Repair their clock phases so the slave presents the value captured on the rising edge. Run the bench, compile and trace the path through both stages in Technology Map Viewer (Post-Mapping).
Simulate
Extract the complete worksheet ZIP. In the folder containing activity.md, run the commands below with Icarus Verilog for Verilog or SystemVerilog, or NVC for VHDL. The testbench applies the switch sequence and checks the observable retained states.
SystemVerilog
iverilog -g2012 -s test_master_slave -o bench project/master_slave.sv simulation/test_master_slave.v
vvp bench
Test on the DE1-SoC
Upload output_files/master_slave.sof through the DE1-SoC bitstream uploader. Start with D and clock low. Pulse the clock high then low to establish a known output. Raise D with clock low. Raise the clock. Lower D while clock stays high, then lower the clock. Read the LEDs after each action. Explain the interval in which the master and slave disagree.
| Switch action | Previous output | Predicted | Camera |
|---|---|---|---|
FPGAcademy · Digital Logic · Lab 3 · III. VERILOG · VHDL · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Drive three storage elements from the same D and clock. LED0 shows the transparent latch, LED1 the positive-edge flip-flop and LED2 the negative-edge flip-flop. Draw three predicted output traces for one change on D during each clock level.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Open project/storage_edges.qpf from your Quartus worksheet ZIP. Read the three assignments in the starter. One uses the wrong clock edge. Correct it and run the bench. Compile without forcing the discrete gates from the earlier parts. Open Technology Map Viewer (Post-Mapping) and identify the storage primitive used for each output. Trace the clock sense of both flip-flops.
Simulate
Extract the complete worksheet ZIP. In the folder containing activity.md, run the commands below with Icarus Verilog for Verilog or SystemVerilog, or NVC for VHDL. The testbench applies the switch sequence and checks the observable retained states.
Verilog
iverilog -g2005 -s test_storage_edges -o bench project/storage_edges.v simulation/test_storage_edges.v
vvp bench
Test on the DE1-SoC
Upload output_files/storage_edges.sof through the DE1-SoC bitstream uploader. Use SW0 for D and SW1 for clock. With D low, raise and lower the clock once. Raise D with the clock low, then raise the clock. Lower D before the falling edge. Predict and read LED2–0 at each step. Repeat with D high across the falling edge and state which outputs must differ.
| Switch action | Previous output | Predicted | Camera |
|---|---|---|---|
FPGAcademy · Digital Logic · Lab 3 · IV. VERILOG · VHDL · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Drive three storage elements from the same D and clock. LED0 shows the transparent latch, LED1 the positive-edge flip-flop and LED2 the negative-edge flip-flop. Draw three predicted output traces for one change on D during each clock level.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Open project/storage_edges.qpf from your Quartus worksheet ZIP. Read the three assignments in the starter. One uses the wrong clock edge. Correct it and run the bench. Compile without forcing the discrete gates from the earlier parts. Open Technology Map Viewer (Post-Mapping) and identify the storage primitive used for each output. Trace the clock sense of both flip-flops.
Simulate
Extract the complete worksheet ZIP. In the folder containing activity.md, run the commands below with Icarus Verilog for Verilog or SystemVerilog, or NVC for VHDL. The testbench applies the switch sequence and checks the observable retained states.
VHDL
nvc --std=2008 -a project/storage_edges.vhd simulation/test_storage_edges.vhd
nvc --std=2008 -e test_storage_edges
nvc --std=2008 -r test_storage_edges
Test on the DE1-SoC
Upload output_files/storage_edges.sof through the DE1-SoC bitstream uploader. Use SW0 for D and SW1 for clock. With D low, raise and lower the clock once. Raise D with the clock low, then raise the clock. Lower D before the falling edge. Predict and read LED2–0 at each step. Repeat with D high across the falling edge and state which outputs must differ.
| Switch action | Previous output | Predicted | Camera |
|---|---|---|---|
FPGAcademy · Digital Logic · Lab 3 · IV. VERILOG · VHDL · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Drive three storage elements from the same D and clock. LED0 shows the transparent latch, LED1 the positive-edge flip-flop and LED2 the negative-edge flip-flop. Draw three predicted output traces for one change on D during each clock level.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Open project/storage_edges.qpf from your Quartus worksheet ZIP. Read the three assignments in the starter. One uses the wrong clock edge. Correct it and run the bench. Compile without forcing the discrete gates from the earlier parts. Open Technology Map Viewer (Post-Mapping) and identify the storage primitive used for each output. Trace the clock sense of both flip-flops.
Simulate
Extract the complete worksheet ZIP. In the folder containing activity.md, run the commands below with Icarus Verilog for Verilog or SystemVerilog, or NVC for VHDL. The testbench applies the switch sequence and checks the observable retained states.
SystemVerilog
iverilog -g2012 -s test_storage_edges -o bench project/storage_edges.sv simulation/test_storage_edges.v
vvp bench
Test on the DE1-SoC
Upload output_files/storage_edges.sof through the DE1-SoC bitstream uploader. Use SW0 for D and SW1 for clock. With D low, raise and lower the clock once. Raise D with the clock low, then raise the clock. Lower D before the falling edge. Predict and read LED2–0 at each step. Repeat with D high across the falling edge and state which outputs must differ.
| Switch action | Previous output | Predicted | Camera |
|---|---|---|---|
FPGAcademy · Digital Logic · Lab 3 · IV. VERILOG · VHDL · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
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.
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
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
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.
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?
Compile the registered adder in Quartus
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
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.
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
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
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.
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
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
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.
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?
Compile the registered adder in Quartus
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
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.
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
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
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.
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
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
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.
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?
Compile the registered adder in Quartus
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
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.
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
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Build an eight-bit synchronous counter, then inspect a four-bit version in Quartus. You will need Quartus Prime Lite with Cyclone V support and access to the LabsLand DE1-SoC bitstream uploader. You can do the prediction and simulation before reserving a board.
Predict the carry
All eight flip-flops share one clock. Write the condition that makes bit 0 toggle. Write the conditions for bits 1 and 2, and use them to predict which bits change at 03 → 04 and 0F → 10. Look for that pattern in the generated stages of toggle_counter.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Download the worksheet ZIP for your HDL and Quartus release. Open project/toggle_counter.qpf. The starter propagates the enable incorrectly between stages. Repair it and run the simulation below. Compile with Processing → Start Compilation. In Compilation Report → Fitter → Resource Section record the register and ALM counts. Include the display logic in your interpretation of the fit.
In the same worksheet ZIP open comparison-project/toggle_four.qpf. Apply the same repair, compile, and open Tools → Netlist Viewers → RTL Viewer. Trace the common clock and the enable path to each of the four registers. Which signals feed the toggle input of the highest stage? Keep a screenshot with that path marked.
Simulate
Extract the complete worksheet ZIP. In the folder containing activity.md, run the commands below with Icarus Verilog for Verilog or SystemVerilog, or NVC for VHDL. The bench checks every count through rollover, then holds and clears the counter.
Verilog
iverilog -g2005 -s test_toggle_counter -o bench project/toggle_counter.v simulation/test_toggle_counter.v
vvp bench
Run the four-bit comparison from the same folder.
Verilog
iverilog -g2005 -s test_toggle_four -o bench comparison-project/toggle_four.v simulation/test_toggle_four.v
vvp bench
Test the bitstream
Upload output_files/toggle_counter.sof from the eight-bit project to the remote board. SW0 is active-low synchronous clear. SW1 enables counting. KEY0 supplies the clock. Press and release once with SW0 down. Raise both switches and step slowly, waiting for the camera to settle after each release. The right-hand display is the low nibble.
| Action | Predicted HEX1–0 | Observed |
|---|---|---|
| Count through 0E, 0F and the next step | ||
| Lower SW1 and pulse KEY0 | ||
| Lower SW0 without pulsing KEY0 | ||
| Pulse KEY0 with SW0 down |
Compare the four-bit and eight-bit fitted resources. Explain why the change in ALMs need not equal the change in register count. Submit your trace, the marked RTL view and two adjacent readings across a carry.
FPGAcademy · Digital Logic · Lab 4 · I. VERILOG · VHDL · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Build an eight-bit synchronous counter, then inspect a four-bit version in Quartus. You will need Quartus Prime Lite with Cyclone V support and access to the LabsLand DE1-SoC bitstream uploader. You can do the prediction and simulation before reserving a board.
Predict the carry
All eight flip-flops share one clock. Write the condition that makes bit 0 toggle. Write the conditions for bits 1 and 2, and use them to predict which bits change at 03 → 04 and 0F → 10. Look for that pattern in the generated stages of toggle_counter.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Download the worksheet ZIP for your HDL and Quartus release. Open project/toggle_counter.qpf. The starter propagates the enable incorrectly between stages. Repair it and run the simulation below. Compile with Processing → Start Compilation. In Compilation Report → Fitter → Resource Section record the register and ALM counts. Include the display logic in your interpretation of the fit.
In the same worksheet ZIP open comparison-project/toggle_four.qpf. Apply the same repair, compile, and open Tools → Netlist Viewers → RTL Viewer. Trace the common clock and the enable path to each of the four registers. Which signals feed the toggle input of the highest stage? Keep a screenshot with that path marked.
Simulate
Extract the complete worksheet ZIP. In the folder containing activity.md, run the commands below with Icarus Verilog for Verilog or SystemVerilog, or NVC for VHDL. The bench checks every count through rollover, then holds and clears the counter.
VHDL
nvc --std=2008 -a project/toggle_counter.vhd simulation/test_toggle_counter.vhd
nvc --std=2008 -e test_toggle_counter
nvc --std=2008 -r test_toggle_counter
Run the four-bit comparison from the same folder.
VHDL
nvc --std=2008 -a comparison-project/toggle_four.vhd simulation/test_toggle_four.vhd
nvc --std=2008 -e test_toggle_four
nvc --std=2008 -r test_toggle_four
Test the bitstream
Upload output_files/toggle_counter.sof from the eight-bit project to the remote board. SW0 is active-low synchronous clear. SW1 enables counting. KEY0 supplies the clock. Press and release once with SW0 down. Raise both switches and step slowly, waiting for the camera to settle after each release. The right-hand display is the low nibble.
| Action | Predicted HEX1–0 | Observed |
|---|---|---|
| Count through 0E, 0F and the next step | ||
| Lower SW1 and pulse KEY0 | ||
| Lower SW0 without pulsing KEY0 | ||
| Pulse KEY0 with SW0 down |
Compare the four-bit and eight-bit fitted resources. Explain why the change in ALMs need not equal the change in register count. Submit your trace, the marked RTL view and two adjacent readings across a carry.
FPGAcademy · Digital Logic · Lab 4 · I. VERILOG · VHDL · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Build an eight-bit synchronous counter, then inspect a four-bit version in Quartus. You will need Quartus Prime Lite with Cyclone V support and access to the LabsLand DE1-SoC bitstream uploader. You can do the prediction and simulation before reserving a board.
Predict the carry
All eight flip-flops share one clock. Write the condition that makes bit 0 toggle. Write the conditions for bits 1 and 2, and use them to predict which bits change at 03 → 04 and 0F → 10. Look for that pattern in the generated stages of toggle_counter.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Download the worksheet ZIP for your HDL and Quartus release. Open project/toggle_counter.qpf. The starter propagates the enable incorrectly between stages. Repair it and run the simulation below. Compile with Processing → Start Compilation. In Compilation Report → Fitter → Resource Section record the register and ALM counts. Include the display logic in your interpretation of the fit.
In the same worksheet ZIP open comparison-project/toggle_four.qpf. Apply the same repair, compile, and open Tools → Netlist Viewers → RTL Viewer. Trace the common clock and the enable path to each of the four registers. Which signals feed the toggle input of the highest stage? Keep a screenshot with that path marked.
Simulate
Extract the complete worksheet ZIP. In the folder containing activity.md, run the commands below with Icarus Verilog for Verilog or SystemVerilog, or NVC for VHDL. The bench checks every count through rollover, then holds and clears the counter.
SystemVerilog
iverilog -g2012 -s test_toggle_counter -o bench project/toggle_counter.sv simulation/test_toggle_counter.v
vvp bench
Run the four-bit comparison from the same folder.
SystemVerilog
iverilog -g2012 -s test_toggle_four -o bench comparison-project/toggle_four.sv simulation/test_toggle_four.v
vvp bench
Test the bitstream
Upload output_files/toggle_counter.sof from the eight-bit project to the remote board. SW0 is active-low synchronous clear. SW1 enables counting. KEY0 supplies the clock. Press and release once with SW0 down. Raise both switches and step slowly, waiting for the camera to settle after each release. The right-hand display is the low nibble.
| Action | Predicted HEX1–0 | Observed |
|---|---|---|
| Count through 0E, 0F and the next step | ||
| Lower SW1 and pulse KEY0 | ||
| Lower SW0 without pulsing KEY0 | ||
| Pulse KEY0 with SW0 down |
Compare the four-bit and eight-bit fitted resources. Explain why the change in ALMs need not equal the change in register count. Submit your trace, the marked RTL view and two adjacent readings across a carry.
FPGAcademy · Digital Logic · Lab 4 · I. VERILOG · VHDL · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Use Quartus Prime Lite with Cyclone V support to compare an arithmetic counter with the toggle stages in Part I. Display the result in hexadecimal on four digits of a real DE1-SoC.
Predict
Sketch the data input of a 16-bit register that can clear, hold or increment. Which control should have priority? Predict the next state for 000F, 00FF and FFFF with counting enabled. Choose a test that would expose a faulty enable even when the arithmetic works.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Download the worksheet ZIP and open project/adder_counter.qpf. Repair the enable condition in the starter. Simulate, then select Processing → Start Compilation. In the Fitter report record ALM usage and the total registers. Open Tools → Netlist Viewers → RTL Viewer. Find the addition, the count register and the feedback path. Zoom in on the counter; the four display decoders can occupy most of the view.
Compare your schematic with the four-bit toggle implementation from Part I. The worksheet includes that project in comparison-project/toggle_four.qpf. Repair its toggle chain before compiling the comparison. Mark one structural difference and explain how both designs implement the same count sequence.
Simulate
Extract the complete worksheet ZIP. In the folder containing activity.md, run the commands below with Icarus Verilog for Verilog or SystemVerilog, or NVC for VHDL. The bench checks every count through rollover, then holds and clears the counter.
Verilog
iverilog -g2005 -s test_adder_counter -o bench project/adder_counter.v simulation/test_adder_counter.v
vvp bench
Run the four-bit comparison from the same folder.
Verilog
iverilog -g2005 -s test_toggle_four -o bench comparison-project/toggle_four.v simulation/test_toggle_four.v
vvp bench
Test the bitstream
Upload output_files/adder_counter.sof from the 16-bit project. Set SW0 low and pulse KEY0. Raise SW0 and SW1, then advance one release at a time until HEX3–0 crosses 000F. Lower SW1 and pulse KEY0 twice. Lower SW0, observe the display before the next release, then pulse KEY0.
| Observation | Expected | Measured |
|---|---|---|
| Carry out of the low digit | ||
| Two pulses with enable low | ||
| Clear asserted before a clock edge | ||
| First rising edge with clear asserted |
Submit one adjacent pair across a carry, the state held while disabled, and the fitter comparison. Use simulation to supply evidence for the full-width rollover.
FPGAcademy · Digital Logic · Lab 4 · II. VERILOG · VHDL · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Use Quartus Prime Lite with Cyclone V support to compare an arithmetic counter with the toggle stages in Part I. Display the result in hexadecimal on four digits of a real DE1-SoC.
Predict
Sketch the data input of a 16-bit register that can clear, hold or increment. Which control should have priority? Predict the next state for 000F, 00FF and FFFF with counting enabled. Choose a test that would expose a faulty enable even when the arithmetic works.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Download the worksheet ZIP and open project/adder_counter.qpf. Repair the enable condition in the starter. Simulate, then select Processing → Start Compilation. In the Fitter report record ALM usage and the total registers. Open Tools → Netlist Viewers → RTL Viewer. Find the addition, the count register and the feedback path. Zoom in on the counter; the four display decoders can occupy most of the view.
Compare your schematic with the four-bit toggle implementation from Part I. The worksheet includes that project in comparison-project/toggle_four.qpf. Repair its toggle chain before compiling the comparison. Mark one structural difference and explain how both designs implement the same count sequence.
Simulate
Extract the complete worksheet ZIP. In the folder containing activity.md, run the commands below with Icarus Verilog for Verilog or SystemVerilog, or NVC for VHDL. The bench checks every count through rollover, then holds and clears the counter.
VHDL
nvc --std=2008 -a project/adder_counter.vhd simulation/test_adder_counter.vhd
nvc --std=2008 -e test_adder_counter
nvc --std=2008 -r test_adder_counter
Run the four-bit comparison from the same folder.
VHDL
nvc --std=2008 -a comparison-project/toggle_four.vhd simulation/test_toggle_four.vhd
nvc --std=2008 -e test_toggle_four
nvc --std=2008 -r test_toggle_four
Test the bitstream
Upload output_files/adder_counter.sof from the 16-bit project. Set SW0 low and pulse KEY0. Raise SW0 and SW1, then advance one release at a time until HEX3–0 crosses 000F. Lower SW1 and pulse KEY0 twice. Lower SW0, observe the display before the next release, then pulse KEY0.
| Observation | Expected | Measured |
|---|---|---|
| Carry out of the low digit | ||
| Two pulses with enable low | ||
| Clear asserted before a clock edge | ||
| First rising edge with clear asserted |
Submit one adjacent pair across a carry, the state held while disabled, and the fitter comparison. Use simulation to supply evidence for the full-width rollover.
FPGAcademy · Digital Logic · Lab 4 · II. VERILOG · VHDL · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Use Quartus Prime Lite with Cyclone V support to compare an arithmetic counter with the toggle stages in Part I. Display the result in hexadecimal on four digits of a real DE1-SoC.
Predict
Sketch the data input of a 16-bit register that can clear, hold or increment. Which control should have priority? Predict the next state for 000F, 00FF and FFFF with counting enabled. Choose a test that would expose a faulty enable even when the arithmetic works.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Download the worksheet ZIP and open project/adder_counter.qpf. Repair the enable condition in the starter. Simulate, then select Processing → Start Compilation. In the Fitter report record ALM usage and the total registers. Open Tools → Netlist Viewers → RTL Viewer. Find the addition, the count register and the feedback path. Zoom in on the counter; the four display decoders can occupy most of the view.
Compare your schematic with the four-bit toggle implementation from Part I. The worksheet includes that project in comparison-project/toggle_four.qpf. Repair its toggle chain before compiling the comparison. Mark one structural difference and explain how both designs implement the same count sequence.
Simulate
Extract the complete worksheet ZIP. In the folder containing activity.md, run the commands below with Icarus Verilog for Verilog or SystemVerilog, or NVC for VHDL. The bench checks every count through rollover, then holds and clears the counter.
SystemVerilog
iverilog -g2012 -s test_adder_counter -o bench project/adder_counter.sv simulation/test_adder_counter.v
vvp bench
Run the four-bit comparison from the same folder.
SystemVerilog
iverilog -g2012 -s test_toggle_four -o bench comparison-project/toggle_four.sv simulation/test_toggle_four.v
vvp bench
Test the bitstream
Upload output_files/adder_counter.sof from the 16-bit project. Set SW0 low and pulse KEY0. Raise SW0 and SW1, then advance one release at a time until HEX3–0 crosses 000F. Lower SW1 and pulse KEY0 twice. Lower SW0, observe the display before the next release, then pulse KEY0.
| Observation | Expected | Measured |
|---|---|---|
| Carry out of the low digit | ||
| Two pulses with enable low | ||
| Clear asserted before a clock edge | ||
| First rising edge with clear asserted |
Submit one adjacent pair across a carry, the state held while disabled, and the fitter comparison. Use simulation to supply evidence for the full-width rollover.
FPGAcademy · Digital Logic · Lab 4 · II. VERILOG · VHDL · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
A board clock keeps ticking while your browser waits for the next camera frame. Use the DE1-SoC's 50 MHz clock to display 0 through 9 repeatedly on HEX0. SW8 resets the counter. SW9 pauses the count so you can read the display.
Design the interval
How many rising edges make one second? If the first count is zero, find the last count and the minimum width of the interval register. Draw the sequence across the last two clock edges before a tick and the first edge after it. Use a clock enable in one clock domain.
Build
Open the second_digit starter for your HDL in the Standard Online Editor. The two switches are already synchronized to CLOCK_50. The reset path and active-low display decoder are supplied. Implement the interval and decimal counters. Check that pause holds both counters and reset takes priority over pause. Keep the hardware parameter at 50,000,000 when you synthesize and upload the program.
Measure a complete cycle
Raise SW8 until HEX0 reads 0. Lower SW8 and start timing when the display changes from 0 to 1. Observe the sequence for a full turn. Time the interval from one transition to the same transition ten digits later. Camera updates can arrive unevenly, so measure the full cycle and divide by ten.
| Trial | First and last digits | Elapsed time | Observation |
|---|---|---|---|
| Ten transitions | |||
| SW9 held high for at least 3 seconds | |||
| Reset while paused, then release reset |
Resume and confirm that the next digit follows from the one you froze. Submit the table, one observation of 9 wrapping to 0 and your measured seconds per digit. Explain what happens if the terminal count is 24,999,999. Return both switches to zero before leaving.
Adapted from FPGAcademy Digital Logic 21.1 · Lab 4, III. verilog · vhdl · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
A board clock keeps ticking while your browser waits for the next camera frame. Use the DE1-SoC's 50 MHz clock to display 0 through 9 repeatedly on HEX0. SW8 resets the counter. SW9 pauses the count so you can read the display.
Design the interval
How many rising edges make one second? If the first count is zero, find the last count and the minimum width of the interval register. Draw the sequence across the last two clock edges before a tick and the first edge after it. Use a clock enable in one clock domain.
Compile and measure the clock on a DE1-SoC
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Extract the project for your HDL and open second_digit.qpf in Quartus Prime Lite with the Cyclone V device package. Complete the interval counter and decimal rollover in the starter. Leave CYCLES_PER_SECOND at 50,000,000. The supplied second_digit.sdc defines the 20 ns period of CLOCK_50. Run Processing → Start Compilation and check that the fitted device is 5CSEMA5F31C6.
Open the DE1-SoC binary-upload lab in the Standard interface. Upload output_files/second_digit.sof to the firmware library, select that file and enter the board. Use SW8 to reset, SW9 to pause and HEX0 to time a complete ten-digit cycle. Record the results in the observation table.
Measure a complete cycle
Raise SW8 until HEX0 reads 0. Lower SW8 and start timing when the display changes from 0 to 1. Observe the sequence for a full turn. Time the interval from one transition to the same transition ten digits later. Camera updates can arrive unevenly, so measure the full cycle and divide by ten.
| Trial | First and last digits | Elapsed time | Observation |
|---|---|---|---|
| Ten transitions | |||
| SW9 held high for at least 3 seconds | |||
| Reset while paused, then release reset |
Resume and confirm that the next digit follows from the one you froze. Submit the table, one observation of 9 wrapping to 0 and your measured seconds per digit. Explain what happens if the terminal count is 24,999,999. Return both switches to zero before leaving.
Adapted from FPGAcademy Digital Logic 21.1 · Lab 4, III. verilog · vhdl · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
A board clock keeps ticking while your browser waits for the next camera frame. Use the DE1-SoC's 50 MHz clock to display 0 through 9 repeatedly on HEX0. SW8 resets the counter. SW9 pauses the count so you can read the display.
Design the interval
How many rising edges make one second? If the first count is zero, find the last count and the minimum width of the interval register. Draw the sequence across the last two clock edges before a tick and the first edge after it. Use a clock enable in one clock domain.
Build
Open the second_digit starter for your HDL in the Standard Online Editor. The two switches are already synchronized to CLOCK_50. The reset path and active-low display decoder are supplied. Implement the interval and decimal counters. Check that pause holds both counters and reset takes priority over pause. Keep the hardware parameter at 50,000,000 when you synthesize and upload the program.
Measure a complete cycle
Raise SW8 until HEX0 reads 0. Lower SW8 and start timing when the display changes from 0 to 1. Observe the sequence for a full turn. Time the interval from one transition to the same transition ten digits later. Camera updates can arrive unevenly, so measure the full cycle and divide by ten.
| Trial | First and last digits | Elapsed time | Observation |
|---|---|---|---|
| Ten transitions | |||
| SW9 held high for at least 3 seconds | |||
| Reset while paused, then release reset |
Resume and confirm that the next digit follows from the one you froze. Submit the table, one observation of 9 wrapping to 0 and your measured seconds per digit. Explain what happens if the terminal count is 24,999,999. Return both switches to zero before leaving.
Adapted from FPGAcademy Digital Logic 21.1 · Lab 4, III. verilog · vhdl · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
A board clock keeps ticking while your browser waits for the next camera frame. Use the DE1-SoC's 50 MHz clock to display 0 through 9 repeatedly on HEX0. SW8 resets the counter. SW9 pauses the count so you can read the display.
Design the interval
How many rising edges make one second? If the first count is zero, find the last count and the minimum width of the interval register. Draw the sequence across the last two clock edges before a tick and the first edge after it. Use a clock enable in one clock domain.
Compile and measure the clock on a DE1-SoC
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Extract the project for your HDL and open second_digit.qpf in Quartus Prime Lite with the Cyclone V device package. Complete the interval counter and decimal rollover in the starter. Leave CYCLES_PER_SECOND at 50,000,000. The supplied second_digit.sdc defines the 20 ns period of CLOCK_50. Run Processing → Start Compilation and check that the fitted device is 5CSEMA5F31C6.
Open the DE1-SoC binary-upload lab in the Standard interface. Upload output_files/second_digit.sof to the firmware library, select that file and enter the board. Use SW8 to reset, SW9 to pause and HEX0 to time a complete ten-digit cycle. Record the results in the observation table.
Measure a complete cycle
Raise SW8 until HEX0 reads 0. Lower SW8 and start timing when the display changes from 0 to 1. Observe the sequence for a full turn. Time the interval from one transition to the same transition ten digits later. Camera updates can arrive unevenly, so measure the full cycle and divide by ten.
| Trial | First and last digits | Elapsed time | Observation |
|---|---|---|---|
| Ten transitions | |||
| SW9 held high for at least 3 seconds | |||
| Reset while paused, then release reset |
Resume and confirm that the next digit follows from the one you froze. Submit the table, one observation of 9 wrapping to 0 and your measured seconds per digit. Explain what happens if the terminal count is 24,999,999. Return both switches to zero before leaving.
Adapted from FPGAcademy Digital Logic 21.1 · Lab 4, III. verilog · vhdl · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
A board clock keeps ticking while your browser waits for the next camera frame. Use the DE1-SoC's 50 MHz clock to display 0 through 9 repeatedly on HEX0. SW8 resets the counter. SW9 pauses the count so you can read the display.
Design the interval
How many rising edges make one second? If the first count is zero, find the last count and the minimum width of the interval register. Draw the sequence across the last two clock edges before a tick and the first edge after it. Use a clock enable in one clock domain.
Build
Open the second_digit starter for your HDL in the Standard Online Editor. The two switches are already synchronized to CLOCK_50. The reset path and active-low display decoder are supplied. Implement the interval and decimal counters. Check that pause holds both counters and reset takes priority over pause. Keep the hardware parameter at 50,000,000 when you synthesize and upload the program.
Measure a complete cycle
Raise SW8 until HEX0 reads 0. Lower SW8 and start timing when the display changes from 0 to 1. Observe the sequence for a full turn. Time the interval from one transition to the same transition ten digits later. Camera updates can arrive unevenly, so measure the full cycle and divide by ten.
| Trial | First and last digits | Elapsed time | Observation |
|---|---|---|---|
| Ten transitions | |||
| SW9 held high for at least 3 seconds | |||
| Reset while paused, then release reset |
Resume and confirm that the next digit follows from the one you froze. Submit the table, one observation of 9 wrapping to 0 and your measured seconds per digit. Explain what happens if the terminal count is 24,999,999. Return both switches to zero before leaving.
Adapted from FPGAcademy Digital Logic 21.1 · Lab 4, III. verilog · vhdl · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
A board clock keeps ticking while your browser waits for the next camera frame. Use the DE1-SoC's 50 MHz clock to display 0 through 9 repeatedly on HEX0. SW8 resets the counter. SW9 pauses the count so you can read the display.
Design the interval
How many rising edges make one second? If the first count is zero, find the last count and the minimum width of the interval register. Draw the sequence across the last two clock edges before a tick and the first edge after it. Use a clock enable in one clock domain.
Compile and measure the clock on a DE1-SoC
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Extract the project for your HDL and open second_digit.qpf in Quartus Prime Lite with the Cyclone V device package. Complete the interval counter and decimal rollover in the starter. Leave CYCLES_PER_SECOND at 50,000,000. The supplied second_digit.sdc defines the 20 ns period of CLOCK_50. Run Processing → Start Compilation and check that the fitted device is 5CSEMA5F31C6.
Open the DE1-SoC binary-upload lab in the Standard interface. Upload output_files/second_digit.sof to the firmware library, select that file and enter the board. Use SW8 to reset, SW9 to pause and HEX0 to time a complete ten-digit cycle. Record the results in the observation table.
Measure a complete cycle
Raise SW8 until HEX0 reads 0. Lower SW8 and start timing when the display changes from 0 to 1. Observe the sequence for a full turn. Time the interval from one transition to the same transition ten digits later. Camera updates can arrive unevenly, so measure the full cycle and divide by ten.
| Trial | First and last digits | Elapsed time | Observation |
|---|---|---|---|
| Ten transitions | |||
| SW9 held high for at least 3 seconds | |||
| Reset while paused, then release reset |
Resume and confirm that the next digit follows from the one you froze. Submit the table, one observation of 9 wrapping to 0 and your measured seconds per digit. Explain what happens if the terminal count is 24,999,999. Return both switches to zero before leaving.
Adapted from FPGAcademy Digital Logic 21.1 · Lab 4, III. verilog · vhdl · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
You already know how to move a word with switches. Here the board moves it once per second. Read HEX3 through HEX0 from left to right. At reset the display reads -dE1, where a dash means a blank. The message on this DE1-SoC is dE1.
Predict a complete turn
Write one row for each of the 4 positions. Move the leftmost character to the right end at each tick. Pick one transition where a lit digit becomes blank and another where a character crosses the end of the display. Mark the two outputs you will watch.
Build
Open timed_word in the Standard Online Editor. The supplied counter produces the time interval and the current position. Complete the mapping between the output column, the position and the original character index. Derive a wrap rule that works for the last column at the last position. Keep the hardware clock parameter at 50,000,000.
Follow the physical word
Hold SW8 high to see the starting position. Lower it and observe a full rotation. Use SW9 to pause on one of your marked states. Record the entire display row and the time until that same state returns after you resume. Pressing reset while paused should restore the starting row. Lower both switches before leaving.
| Observation | Your prediction | Board camera |
|---|---|---|
| Initial word | ||
| A character crosses the end | ||
| Last position before wrap | ||
| First repeated state |
Submit your state table and measured rotation period. Explain why the complete word takes 4 seconds to return although each character moves once per second.
Adapted from FPGAcademy Digital Logic 21.1 · Lab 4, IV. verilog · vhdl · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
You already know how to move a word with switches. Here the board moves it once per second. Read HEX3 through HEX0 from left to right. At reset the display reads -dE1, where a dash means a blank. The message on this DE1-SoC is dE1.
Predict a complete turn
Write one row for each of the 4 positions. Move the leftmost character to the right end at each tick. Pick one transition where a lit digit becomes blank and another where a character crosses the end of the display. Mark the two outputs you will watch.
Compile the scrolling display on a DE1-SoC
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Extract the project for your HDL and open timed_word.qpf in Quartus Prime Lite with the Cyclone V device package. Complete the mapping from the character index to each output position. Leave CYCLES_PER_SECOND at 50,000,000. The supplied timed_word.sdc defines the 20 ns period of CLOCK_50. Run Processing → Start Compilation and check that the fitted device is 5CSEMA5F31C6.
Open the DE1-SoC binary-upload lab in the Standard interface. Upload output_files/timed_word.sof to the firmware library, select that file and enter the board. Use SW8 to reset, SW9 to pause and the displays to time a full rotation. At reset you should see -dE1, where each dash denotes a blank position. Record the results in the observation table.
Follow the physical word
Hold SW8 high to see the starting position. Lower it and observe a full rotation. Use SW9 to pause on one of your marked states. Record the entire display row and the time until that same state returns after you resume. Pressing reset while paused should restore the starting row. Lower both switches before leaving.
| Observation | Your prediction | Board camera |
|---|---|---|
| Initial word | ||
| A character crosses the end | ||
| Last position before wrap | ||
| First repeated state |
Submit your state table and measured rotation period. Explain why the complete word takes 4 seconds to return although each character moves once per second.
Adapted from FPGAcademy Digital Logic 21.1 · Lab 4, IV. verilog · vhdl · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
You already know how to move a word with switches. Here the board moves it once per second. Read HEX3 through HEX0 from left to right. At reset the display reads -dE1, where a dash means a blank. The message on this DE1-SoC is dE1.
Predict a complete turn
Write one row for each of the 4 positions. Move the leftmost character to the right end at each tick. Pick one transition where a lit digit becomes blank and another where a character crosses the end of the display. Mark the two outputs you will watch.
Build
Open timed_word in the Standard Online Editor. The supplied counter produces the time interval and the current position. Complete the mapping between the output column, the position and the original character index. Derive a wrap rule that works for the last column at the last position. Keep the hardware clock parameter at 50,000,000.
Follow the physical word
Hold SW8 high to see the starting position. Lower it and observe a full rotation. Use SW9 to pause on one of your marked states. Record the entire display row and the time until that same state returns after you resume. Pressing reset while paused should restore the starting row. Lower both switches before leaving.
| Observation | Your prediction | Board camera |
|---|---|---|
| Initial word | ||
| A character crosses the end | ||
| Last position before wrap | ||
| First repeated state |
Submit your state table and measured rotation period. Explain why the complete word takes 4 seconds to return although each character moves once per second.
Adapted from FPGAcademy Digital Logic 21.1 · Lab 4, IV. verilog · vhdl · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
You already know how to move a word with switches. Here the board moves it once per second. Read HEX3 through HEX0 from left to right. At reset the display reads -dE1, where a dash means a blank. The message on this DE1-SoC is dE1.
Predict a complete turn
Write one row for each of the 4 positions. Move the leftmost character to the right end at each tick. Pick one transition where a lit digit becomes blank and another where a character crosses the end of the display. Mark the two outputs you will watch.
Compile the scrolling display on a DE1-SoC
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Extract the project for your HDL and open timed_word.qpf in Quartus Prime Lite with the Cyclone V device package. Complete the mapping from the character index to each output position. Leave CYCLES_PER_SECOND at 50,000,000. The supplied timed_word.sdc defines the 20 ns period of CLOCK_50. Run Processing → Start Compilation and check that the fitted device is 5CSEMA5F31C6.
Open the DE1-SoC binary-upload lab in the Standard interface. Upload output_files/timed_word.sof to the firmware library, select that file and enter the board. Use SW8 to reset, SW9 to pause and the displays to time a full rotation. At reset you should see -dE1, where each dash denotes a blank position. Record the results in the observation table.
Follow the physical word
Hold SW8 high to see the starting position. Lower it and observe a full rotation. Use SW9 to pause on one of your marked states. Record the entire display row and the time until that same state returns after you resume. Pressing reset while paused should restore the starting row. Lower both switches before leaving.
| Observation | Your prediction | Board camera |
|---|---|---|
| Initial word | ||
| A character crosses the end | ||
| Last position before wrap | ||
| First repeated state |
Submit your state table and measured rotation period. Explain why the complete word takes 4 seconds to return although each character moves once per second.
Adapted from FPGAcademy Digital Logic 21.1 · Lab 4, IV. verilog · vhdl · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
You already know how to move a word with switches. Here the board moves it once per second. Read HEX3 through HEX0 from left to right. At reset the display reads -dE1, where a dash means a blank. The message on this DE1-SoC is dE1.
Predict a complete turn
Write one row for each of the 4 positions. Move the leftmost character to the right end at each tick. Pick one transition where a lit digit becomes blank and another where a character crosses the end of the display. Mark the two outputs you will watch.
Build
Open timed_word in the Standard Online Editor. The supplied counter produces the time interval and the current position. Complete the mapping between the output column, the position and the original character index. Derive a wrap rule that works for the last column at the last position. Keep the hardware clock parameter at 50,000,000.
Follow the physical word
Hold SW8 high to see the starting position. Lower it and observe a full rotation. Use SW9 to pause on one of your marked states. Record the entire display row and the time until that same state returns after you resume. Pressing reset while paused should restore the starting row. Lower both switches before leaving.
| Observation | Your prediction | Board camera |
|---|---|---|
| Initial word | ||
| A character crosses the end | ||
| Last position before wrap | ||
| First repeated state |
Submit your state table and measured rotation period. Explain why the complete word takes 4 seconds to return although each character moves once per second.
Adapted from FPGAcademy Digital Logic 21.1 · Lab 4, IV. verilog · vhdl · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
You already know how to move a word with switches. Here the board moves it once per second. Read HEX3 through HEX0 from left to right. At reset the display reads -dE1, where a dash means a blank. The message on this DE1-SoC is dE1.
Predict a complete turn
Write one row for each of the 4 positions. Move the leftmost character to the right end at each tick. Pick one transition where a lit digit becomes blank and another where a character crosses the end of the display. Mark the two outputs you will watch.
Compile the scrolling display on a DE1-SoC
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Extract the project for your HDL and open timed_word.qpf in Quartus Prime Lite with the Cyclone V device package. Complete the mapping from the character index to each output position. Leave CYCLES_PER_SECOND at 50,000,000. The supplied timed_word.sdc defines the 20 ns period of CLOCK_50. Run Processing → Start Compilation and check that the fitted device is 5CSEMA5F31C6.
Open the DE1-SoC binary-upload lab in the Standard interface. Upload output_files/timed_word.sof to the firmware library, select that file and enter the board. Use SW8 to reset, SW9 to pause and the displays to time a full rotation. At reset you should see -dE1, where each dash denotes a blank position. Record the results in the observation table.
Follow the physical word
Hold SW8 high to see the starting position. Lower it and observe a full rotation. Use SW9 to pause on one of your marked states. Record the entire display row and the time until that same state returns after you resume. Pressing reset while paused should restore the starting row. Lower both switches before leaving.
| Observation | Your prediction | Board camera |
|---|---|---|
| Initial word | ||
| A character crosses the end | ||
| Last position before wrap | ||
| First repeated state |
Submit your state table and measured rotation period. Explain why the complete word takes 4 seconds to return although each character moves once per second.
Adapted from FPGAcademy Digital Logic 21.1 · Lab 4, IV. verilog · vhdl · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
You already know how to move a word with switches. Here the board moves it once per second. Read HEX5 through HEX0 from left to right. At reset the display reads ---dE1, where a dash means a blank. The message on this DE1-SoC is dE1.
Predict a complete turn
Write one row for each of the 6 positions. Move the leftmost character to the right end at each tick. Pick one transition where a lit digit becomes blank and another where a character crosses the end of the display. Mark the two outputs you will watch.
Build
Open timed_marquee in the Standard Online Editor. The supplied counter produces the time interval and the current position. Complete the mapping between the output column, the position and the original character index. Derive a wrap rule that works for the last column at the last position. Keep the hardware clock parameter at 50,000,000.
Follow the physical word
Hold SW8 high to see the starting position. Lower it and observe a full rotation. Use SW9 to pause on one of your marked states. Record the entire display row and the time until that same state returns after you resume. Pressing reset while paused should restore the starting row. Lower both switches before leaving.
| Observation | Your prediction | Board camera |
|---|---|---|
| Initial word | ||
| A character crosses the end | ||
| Last position before wrap | ||
| First repeated state |
Submit your state table and measured rotation period. Explain why the complete word takes 6 seconds to return although each character moves once per second.
Compare a modulo-six state counter with a three-bit counter that wraps naturally at eight. Which two unwanted states must your design avoid?
Adapted from FPGAcademy Digital Logic 21.1 · Lab 4, V. verilog · vhdl · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
You already know how to move a word with switches. Here the board moves it once per second. Read HEX5 through HEX0 from left to right. At reset the display reads ---dE1, where a dash means a blank. The message on this DE1-SoC is dE1.
Predict a complete turn
Write one row for each of the 6 positions. Move the leftmost character to the right end at each tick. Pick one transition where a lit digit becomes blank and another where a character crosses the end of the display. Mark the two outputs you will watch.
Compile the scrolling display on a DE1-SoC
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Extract the project for your HDL and open timed_marquee.qpf in Quartus Prime Lite with the Cyclone V device package. Complete the mapping from the character index to each output position. Leave CYCLES_PER_SECOND at 50,000,000. The supplied timed_marquee.sdc defines the 20 ns period of CLOCK_50. Run Processing → Start Compilation and check that the fitted device is 5CSEMA5F31C6.
Open the DE1-SoC binary-upload lab in the Standard interface. Upload output_files/timed_marquee.sof to the firmware library, select that file and enter the board. Use SW8 to reset, SW9 to pause and the displays to time a full rotation. At reset you should see ---dE1, where each dash denotes a blank position. Record the results in the observation table.
Follow the physical word
Hold SW8 high to see the starting position. Lower it and observe a full rotation. Use SW9 to pause on one of your marked states. Record the entire display row and the time until that same state returns after you resume. Pressing reset while paused should restore the starting row. Lower both switches before leaving.
| Observation | Your prediction | Board camera |
|---|---|---|
| Initial word | ||
| A character crosses the end | ||
| Last position before wrap | ||
| First repeated state |
Submit your state table and measured rotation period. Explain why the complete word takes 6 seconds to return although each character moves once per second.
Compare a modulo-six state counter with a three-bit counter that wraps naturally at eight. Which two unwanted states must your design avoid?
Adapted from FPGAcademy Digital Logic 21.1 · Lab 4, V. verilog · vhdl · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
You already know how to move a word with switches. Here the board moves it once per second. Read HEX5 through HEX0 from left to right. At reset the display reads ---dE1, where a dash means a blank. The message on this DE1-SoC is dE1.
Predict a complete turn
Write one row for each of the 6 positions. Move the leftmost character to the right end at each tick. Pick one transition where a lit digit becomes blank and another where a character crosses the end of the display. Mark the two outputs you will watch.
Build
Open timed_marquee in the Standard Online Editor. The supplied counter produces the time interval and the current position. Complete the mapping between the output column, the position and the original character index. Derive a wrap rule that works for the last column at the last position. Keep the hardware clock parameter at 50,000,000.
Follow the physical word
Hold SW8 high to see the starting position. Lower it and observe a full rotation. Use SW9 to pause on one of your marked states. Record the entire display row and the time until that same state returns after you resume. Pressing reset while paused should restore the starting row. Lower both switches before leaving.
| Observation | Your prediction | Board camera |
|---|---|---|
| Initial word | ||
| A character crosses the end | ||
| Last position before wrap | ||
| First repeated state |
Submit your state table and measured rotation period. Explain why the complete word takes 6 seconds to return although each character moves once per second.
Compare a modulo-six state counter with a three-bit counter that wraps naturally at eight. Which two unwanted states must your design avoid?
Adapted from FPGAcademy Digital Logic 21.1 · Lab 4, V. verilog · vhdl · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
You already know how to move a word with switches. Here the board moves it once per second. Read HEX5 through HEX0 from left to right. At reset the display reads ---dE1, where a dash means a blank. The message on this DE1-SoC is dE1.
Predict a complete turn
Write one row for each of the 6 positions. Move the leftmost character to the right end at each tick. Pick one transition where a lit digit becomes blank and another where a character crosses the end of the display. Mark the two outputs you will watch.
Compile the scrolling display on a DE1-SoC
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Extract the project for your HDL and open timed_marquee.qpf in Quartus Prime Lite with the Cyclone V device package. Complete the mapping from the character index to each output position. Leave CYCLES_PER_SECOND at 50,000,000. The supplied timed_marquee.sdc defines the 20 ns period of CLOCK_50. Run Processing → Start Compilation and check that the fitted device is 5CSEMA5F31C6.
Open the DE1-SoC binary-upload lab in the Standard interface. Upload output_files/timed_marquee.sof to the firmware library, select that file and enter the board. Use SW8 to reset, SW9 to pause and the displays to time a full rotation. At reset you should see ---dE1, where each dash denotes a blank position. Record the results in the observation table.
Follow the physical word
Hold SW8 high to see the starting position. Lower it and observe a full rotation. Use SW9 to pause on one of your marked states. Record the entire display row and the time until that same state returns after you resume. Pressing reset while paused should restore the starting row. Lower both switches before leaving.
| Observation | Your prediction | Board camera |
|---|---|---|
| Initial word | ||
| A character crosses the end | ||
| Last position before wrap | ||
| First repeated state |
Submit your state table and measured rotation period. Explain why the complete word takes 6 seconds to return although each character moves once per second.
Compare a modulo-six state counter with a three-bit counter that wraps naturally at eight. Which two unwanted states must your design avoid?
Adapted from FPGAcademy Digital Logic 21.1 · Lab 4, V. verilog · vhdl · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
You already know how to move a word with switches. Here the board moves it once per second. Read HEX5 through HEX0 from left to right. At reset the display reads ---dE1, where a dash means a blank. The message on this DE1-SoC is dE1.
Predict a complete turn
Write one row for each of the 6 positions. Move the leftmost character to the right end at each tick. Pick one transition where a lit digit becomes blank and another where a character crosses the end of the display. Mark the two outputs you will watch.
Build
Open timed_marquee in the Standard Online Editor. The supplied counter produces the time interval and the current position. Complete the mapping between the output column, the position and the original character index. Derive a wrap rule that works for the last column at the last position. Keep the hardware clock parameter at 50,000,000.
Follow the physical word
Hold SW8 high to see the starting position. Lower it and observe a full rotation. Use SW9 to pause on one of your marked states. Record the entire display row and the time until that same state returns after you resume. Pressing reset while paused should restore the starting row. Lower both switches before leaving.
| Observation | Your prediction | Board camera |
|---|---|---|
| Initial word | ||
| A character crosses the end | ||
| Last position before wrap | ||
| First repeated state |
Submit your state table and measured rotation period. Explain why the complete word takes 6 seconds to return although each character moves once per second.
Compare a modulo-six state counter with a three-bit counter that wraps naturally at eight. Which two unwanted states must your design avoid?
Adapted from FPGAcademy Digital Logic 21.1 · Lab 4, V. verilog · vhdl · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
You already know how to move a word with switches. Here the board moves it once per second. Read HEX5 through HEX0 from left to right. At reset the display reads ---dE1, where a dash means a blank. The message on this DE1-SoC is dE1.
Predict a complete turn
Write one row for each of the 6 positions. Move the leftmost character to the right end at each tick. Pick one transition where a lit digit becomes blank and another where a character crosses the end of the display. Mark the two outputs you will watch.
Compile the scrolling display on a DE1-SoC
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Extract the project for your HDL and open timed_marquee.qpf in Quartus Prime Lite with the Cyclone V device package. Complete the mapping from the character index to each output position. Leave CYCLES_PER_SECOND at 50,000,000. The supplied timed_marquee.sdc defines the 20 ns period of CLOCK_50. Run Processing → Start Compilation and check that the fitted device is 5CSEMA5F31C6.
Open the DE1-SoC binary-upload lab in the Standard interface. Upload output_files/timed_marquee.sof to the firmware library, select that file and enter the board. Use SW8 to reset, SW9 to pause and the displays to time a full rotation. At reset you should see ---dE1, where each dash denotes a blank position. Record the results in the observation table.
Follow the physical word
Hold SW8 high to see the starting position. Lower it and observe a full rotation. Use SW9 to pause on one of your marked states. Record the entire display row and the time until that same state returns after you resume. Pressing reset while paused should restore the starting row. Lower both switches before leaving.
| Observation | Your prediction | Board camera |
|---|---|---|
| Initial word | ||
| A character crosses the end | ||
| Last position before wrap | ||
| First repeated state |
Submit your state table and measured rotation period. Explain why the complete word takes 6 seconds to return although each character moves once per second.
Compare a modulo-six state counter with a three-bit counter that wraps naturally at eight. Which two unwanted states must your design avoid?
Adapted from FPGAcademy Digital Logic 21.1 · Lab 4, V. verilog · vhdl · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Design a counter that repeats every twenty presses. LEDR4…0 show the count in binary. LEDR9 lights for one count to warn that the next press will return the value to zero.
Predict the rollover
Write down the five count bits and the warning light at 18, 19 and 0. How many different values would four bits represent? Choose a width that can represent every value from zero through nineteen.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
modulo_count, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
WIDTH sets the number of counter bits and MODULUS sets the number of states. Find the comparison that drives the warning light. Correct it so the last state is visible for a whole button press. Leave WIDTH at 5 and MODULUS at 20 for the board.
Simulate two sizes
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The testbench checks two counters with the same button inputs, one with twenty states and one with five. Run it on the starter first and note the first failing count. Then run it on your correction. A complete run checks 42 press/release pairs and reset between presses.
Verilog
iverilog -g2005 -s test_modulo_count -o bench starter/modulo_count.v simulation/test_modulo_count.v
vvp bench
Test the board
Synthesize and upload. Press KEY0 once to reset. Each press on KEY1 should advance by one, and releasing it should leave the count unchanged. Wait until the camera shows the new count before pressing again. Pause before each of the last three presses so you can record the warning light.
| Number of KEY1 presses after reset | LEDR4…0 | LEDR9 |
|---|---|---|
| 1 | ||
| 18 | ||
| 19 | ||
| 20 | ||
| 21 |
Press KEY0 while the count is nonzero and leave KEY1 alone. Explain what this observation tells you about asynchronous reset. Submit the predictions, the simulation result for each width, and your board observations.
Source
Original LabsLand activity following FPGAcademy Digital Logic Lab 5, Part I. Verilog handout · VHDL handout · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Design a counter that repeats every twenty presses. LEDR4…0 show the count in binary. LEDR9 lights for one count to warn that the next press will return the value to zero.
Predict the rollover
Write down the five count bits and the warning light at 18, 19 and 0. How many different values would four bits represent? Choose a width that can represent every value from zero through nineteen.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/modulo_count.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
modulo_count. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/modulo_count.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
WIDTH sets the number of counter bits and MODULUS sets the number of states. Find the comparison that drives the warning light. Correct it so the last state is visible for a whole button press. Leave WIDTH at 5 and MODULUS at 20 for the board.
Simulate two sizes
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The testbench checks two counters with the same button inputs, one with twenty states and one with five. Run it on the starter first and note the first failing count. Then run it on your correction. A complete run checks 42 press/release pairs and reset between presses.
Verilog
iverilog -g2005 -s test_modulo_count -o bench starter/modulo_count.v simulation/test_modulo_count.v
vvp bench
Test the board
Synthesize and upload. Press KEY0 once to reset. Each press on KEY1 should advance by one, and releasing it should leave the count unchanged. Wait until the camera shows the new count before pressing again. Pause before each of the last three presses so you can record the warning light.
| Number of KEY1 presses after reset | LEDR4…0 | LEDR9 |
|---|---|---|
| 1 | ||
| 18 | ||
| 19 | ||
| 20 | ||
| 21 |
Press KEY0 while the count is nonzero and leave KEY1 alone. Explain what this observation tells you about asynchronous reset. Submit the predictions, the simulation result for each width, and your board observations.
Source
Original LabsLand activity following FPGAcademy Digital Logic Lab 5, Part I. Verilog handout · VHDL handout · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Design a counter that repeats every twenty presses. LEDR4…0 show the count in binary. LEDR9 lights for one count to warn that the next press will return the value to zero.
Predict the rollover
Write down the five count bits and the warning light at 18, 19 and 0. How many different values would four bits represent? Choose a width that can represent every value from zero through nineteen.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
modulo_count, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
WIDTH sets the number of counter bits and MODULUS sets the number of states. Find the comparison that drives the warning light. Correct it so the last state is visible for a whole button press. Leave WIDTH at 5 and MODULUS at 20 for the board.
Simulate two sizes
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The testbench checks two counters with the same button inputs, one with twenty states and one with five. Run it on the starter first and note the first failing count. Then run it on your correction. A complete run checks 42 press/release pairs and reset between presses.
VHDL
nvc --std=2008 -a starter/modulo_count.vhd simulation/test_modulo_count.vhd
nvc --std=2008 -e test_modulo_count
nvc --std=2008 -r test_modulo_count
Test the board
Synthesize and upload. Press KEY0 once to reset. Each press on KEY1 should advance by one, and releasing it should leave the count unchanged. Wait until the camera shows the new count before pressing again. Pause before each of the last three presses so you can record the warning light.
| Number of KEY1 presses after reset | LEDR4…0 | LEDR9 |
|---|---|---|
| 1 | ||
| 18 | ||
| 19 | ||
| 20 | ||
| 21 |
Press KEY0 while the count is nonzero and leave KEY1 alone. Explain what this observation tells you about asynchronous reset. Submit the predictions, the simulation result for each width, and your board observations.
Source
Original LabsLand activity following FPGAcademy Digital Logic Lab 5, Part I. Verilog handout · VHDL handout · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Design a counter that repeats every twenty presses. LEDR4…0 show the count in binary. LEDR9 lights for one count to warn that the next press will return the value to zero.
Predict the rollover
Write down the five count bits and the warning light at 18, 19 and 0. How many different values would four bits represent? Choose a width that can represent every value from zero through nineteen.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/modulo_count.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
modulo_count. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/modulo_count.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
WIDTH sets the number of counter bits and MODULUS sets the number of states. Find the comparison that drives the warning light. Correct it so the last state is visible for a whole button press. Leave WIDTH at 5 and MODULUS at 20 for the board.
Simulate two sizes
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The testbench checks two counters with the same button inputs, one with twenty states and one with five. Run it on the starter first and note the first failing count. Then run it on your correction. A complete run checks 42 press/release pairs and reset between presses.
VHDL
nvc --std=2008 -a starter/modulo_count.vhd simulation/test_modulo_count.vhd
nvc --std=2008 -e test_modulo_count
nvc --std=2008 -r test_modulo_count
Test the board
Synthesize and upload. Press KEY0 once to reset. Each press on KEY1 should advance by one, and releasing it should leave the count unchanged. Wait until the camera shows the new count before pressing again. Pause before each of the last three presses so you can record the warning light.
| Number of KEY1 presses after reset | LEDR4…0 | LEDR9 |
|---|---|---|
| 1 | ||
| 18 | ||
| 19 | ||
| 20 | ||
| 21 |
Press KEY0 while the count is nonzero and leave KEY1 alone. Explain what this observation tells you about asynchronous reset. Submit the predictions, the simulation result for each width, and your board observations.
Source
Original LabsLand activity following FPGAcademy Digital Logic Lab 5, Part I. Verilog handout · VHDL handout · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Design a counter that repeats every twenty presses. LEDR4…0 show the count in binary. LEDR9 lights for one count to warn that the next press will return the value to zero.
Predict the rollover
Write down the five count bits and the warning light at 18, 19 and 0. How many different values would four bits represent? Choose a width that can represent every value from zero through nineteen.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
modulo_count, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
WIDTH sets the number of counter bits and MODULUS sets the number of states. Find the comparison that drives the warning light. Correct it so the last state is visible for a whole button press. Leave WIDTH at 5 and MODULUS at 20 for the board.
Simulate two sizes
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The testbench checks two counters with the same button inputs, one with twenty states and one with five. Run it on the starter first and note the first failing count. Then run it on your correction. A complete run checks 42 press/release pairs and reset between presses.
SystemVerilog
iverilog -g2012 -s test_modulo_count -o bench starter/modulo_count.sv simulation/test_modulo_count.v
vvp bench
Test the board
Synthesize and upload. Press KEY0 once to reset. Each press on KEY1 should advance by one, and releasing it should leave the count unchanged. Wait until the camera shows the new count before pressing again. Pause before each of the last three presses so you can record the warning light.
| Number of KEY1 presses after reset | LEDR4…0 | LEDR9 |
|---|---|---|
| 1 | ||
| 18 | ||
| 19 | ||
| 20 | ||
| 21 |
Press KEY0 while the count is nonzero and leave KEY1 alone. Explain what this observation tells you about asynchronous reset. Submit the predictions, the simulation result for each width, and your board observations.
Source
Original LabsLand activity following FPGAcademy Digital Logic Lab 5, Part I. Verilog handout · VHDL handout · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Design a counter that repeats every twenty presses. LEDR4…0 show the count in binary. LEDR9 lights for one count to warn that the next press will return the value to zero.
Predict the rollover
Write down the five count bits and the warning light at 18, 19 and 0. How many different values would four bits represent? Choose a width that can represent every value from zero through nineteen.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/modulo_count.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
modulo_count. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/modulo_count.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
WIDTH sets the number of counter bits and MODULUS sets the number of states. Find the comparison that drives the warning light. Correct it so the last state is visible for a whole button press. Leave WIDTH at 5 and MODULUS at 20 for the board.
Simulate two sizes
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The testbench checks two counters with the same button inputs, one with twenty states and one with five. Run it on the starter first and note the first failing count. Then run it on your correction. A complete run checks 42 press/release pairs and reset between presses.
SystemVerilog
iverilog -g2012 -s test_modulo_count -o bench starter/modulo_count.sv simulation/test_modulo_count.v
vvp bench
Test the board
Synthesize and upload. Press KEY0 once to reset. Each press on KEY1 should advance by one, and releasing it should leave the count unchanged. Wait until the camera shows the new count before pressing again. Pause before each of the last three presses so you can record the warning light.
| Number of KEY1 presses after reset | LEDR4…0 | LEDR9 |
|---|---|---|
| 1 | ||
| 18 | ||
| 19 | ||
| 20 | ||
| 21 |
Press KEY0 while the count is nonzero and leave KEY1 alone. Explain what this observation tells you about asynchronous reset. Submit the predictions, the simulation result for each width, and your board observations.
Source
Original LabsLand activity following FPGAcademy Digital Logic Lab 5, Part I. Verilog handout · VHDL handout · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Build a decimal counter for the three rightmost displays. One second after 099, the displays should read 100. At 999, all three return to zero. A single board clock drives three copies of the same decimal stage.
Predict the enables
Make a table for 008, 009, 098, 099 and 999. For each value, decide which digits should change on the next one-second tick. Name the conditions that advance the tens and the hundreds. Distinguish a digit holding 9 between ticks from a carry that a higher digit should act on.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
cascade_bcd, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
The starter includes a clock divider, one decimal stage and a display decoder. Complete the tens and hundreds enable connections. Use CLOCK_50 for every stage. Keep the hardware clock parameter at 50,000,000. Synthesize, upload, and read HEX2 through HEX0 from left to right.
Simulate the carries
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench runs all 1,000 values and checks the wrap, both presets and reset priority. It gives the divider two clock cycles per tick in simulation. Keep the original divider setting for the physical board. Compare the expected and observed three-digit readings at the first mismatch. Which digit missed its carry? Repair only that stage and rerun. Where does the next mismatch occur? Fix the remaining enable, then check that the bench reaches PASS.
Verilog
iverilog -g2005 -s test_cascade_bcd -o bench starter/cascade_bcd.v simulation/test_cascade_bcd.v
vvp bench
Test the boundaries
Press KEY0 with both switches down to clear the count. Release it and watch the units advance. Raise SW8 to load 098, then lower SW8 and record four successive readings. Repeat with SW9, which loads 998. The preset switches let you visit carry boundaries during one reservation. Keep the other preset switch down.
| Test | Prediction | First four readings | Time for three transitions |
|---|---|---|---|
| Release the 098 preset | |||
| Release the 998 preset |
While SW8 is up, hold KEY0 and read the displays. Release KEY0 while keeping SW8 up. Give the camera a few seconds to show the settled digits, then record the second reading. Which control takes priority? Explain why connecting the units carry output to a clock input would change the design. Finish with both preset switches down and press KEY0 once.
Source
Original LabsLand activity following FPGAcademy Digital Logic Lab 5, Part II. Verilog handout · VHDL handout · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Build a decimal counter for the three rightmost displays. One second after 099, the displays should read 100. At 999, all three return to zero. A single board clock drives three copies of the same decimal stage.
Predict the enables
Make a table for 008, 009, 098, 099 and 999. For each value, decide which digits should change on the next one-second tick. Name the conditions that advance the tens and the hundreds. Distinguish a digit holding 9 between ticks from a carry that a higher digit should act on.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/cascade_bcd.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
cascade_bcd. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/cascade_bcd.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
The starter includes a clock divider, one decimal stage and a display decoder. Complete the tens and hundreds enable connections. Use CLOCK_50 for every stage. Keep the hardware clock parameter at 50,000,000. Synthesize, upload, and read HEX2 through HEX0 from left to right.
Simulate the carries
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench runs all 1,000 values and checks the wrap, both presets and reset priority. It gives the divider two clock cycles per tick in simulation. Keep the original divider setting for the physical board. Compare the expected and observed three-digit readings at the first mismatch. Which digit missed its carry? Repair only that stage and rerun. Where does the next mismatch occur? Fix the remaining enable, then check that the bench reaches PASS.
Verilog
iverilog -g2005 -s test_cascade_bcd -o bench starter/cascade_bcd.v simulation/test_cascade_bcd.v
vvp bench
Test the boundaries
Press KEY0 with both switches down to clear the count. Release it and watch the units advance. Raise SW8 to load 098, then lower SW8 and record four successive readings. Repeat with SW9, which loads 998. The preset switches let you visit carry boundaries during one reservation. Keep the other preset switch down.
| Test | Prediction | First four readings | Time for three transitions |
|---|---|---|---|
| Release the 098 preset | |||
| Release the 998 preset |
While SW8 is up, hold KEY0 and read the displays. Release KEY0 while keeping SW8 up. Give the camera a few seconds to show the settled digits, then record the second reading. Which control takes priority? Explain why connecting the units carry output to a clock input would change the design. Finish with both preset switches down and press KEY0 once.
Source
Original LabsLand activity following FPGAcademy Digital Logic Lab 5, Part II. Verilog handout · VHDL handout · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Build a decimal counter for the three rightmost displays. One second after 099, the displays should read 100. At 999, all three return to zero. A single board clock drives three copies of the same decimal stage.
Predict the enables
Make a table for 008, 009, 098, 099 and 999. For each value, decide which digits should change on the next one-second tick. Name the conditions that advance the tens and the hundreds. Distinguish a digit holding 9 between ticks from a carry that a higher digit should act on.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
cascade_bcd, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
The starter includes a clock divider, one decimal stage and a display decoder. Complete the tens and hundreds enable connections. Use CLOCK_50 for every stage. Keep the hardware clock parameter at 50,000,000. Synthesize, upload, and read HEX2 through HEX0 from left to right.
Simulate the carries
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench runs all 1,000 values and checks the wrap, both presets and reset priority. It gives the divider two clock cycles per tick in simulation. Keep the original divider setting for the physical board. Compare the expected and observed three-digit readings at the first mismatch. Which digit missed its carry? Repair only that stage and rerun. Where does the next mismatch occur? Fix the remaining enable, then check that the bench reaches PASS.
VHDL
nvc --std=2008 -a starter/cascade_bcd.vhd simulation/test_cascade_bcd.vhd
nvc --std=2008 -e test_cascade_bcd
nvc --std=2008 -r test_cascade_bcd
Test the boundaries
Press KEY0 with both switches down to clear the count. Release it and watch the units advance. Raise SW8 to load 098, then lower SW8 and record four successive readings. Repeat with SW9, which loads 998. The preset switches let you visit carry boundaries during one reservation. Keep the other preset switch down.
| Test | Prediction | First four readings | Time for three transitions |
|---|---|---|---|
| Release the 098 preset | |||
| Release the 998 preset |
While SW8 is up, hold KEY0 and read the displays. Release KEY0 while keeping SW8 up. Give the camera a few seconds to show the settled digits, then record the second reading. Which control takes priority? Explain why connecting the units carry output to a clock input would change the design. Finish with both preset switches down and press KEY0 once.
Source
Original LabsLand activity following FPGAcademy Digital Logic Lab 5, Part II. Verilog handout · VHDL handout · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Build a decimal counter for the three rightmost displays. One second after 099, the displays should read 100. At 999, all three return to zero. A single board clock drives three copies of the same decimal stage.
Predict the enables
Make a table for 008, 009, 098, 099 and 999. For each value, decide which digits should change on the next one-second tick. Name the conditions that advance the tens and the hundreds. Distinguish a digit holding 9 between ticks from a carry that a higher digit should act on.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/cascade_bcd.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
cascade_bcd. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/cascade_bcd.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
The starter includes a clock divider, one decimal stage and a display decoder. Complete the tens and hundreds enable connections. Use CLOCK_50 for every stage. Keep the hardware clock parameter at 50,000,000. Synthesize, upload, and read HEX2 through HEX0 from left to right.
Simulate the carries
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench runs all 1,000 values and checks the wrap, both presets and reset priority. It gives the divider two clock cycles per tick in simulation. Keep the original divider setting for the physical board. Compare the expected and observed three-digit readings at the first mismatch. Which digit missed its carry? Repair only that stage and rerun. Where does the next mismatch occur? Fix the remaining enable, then check that the bench reaches PASS.
VHDL
nvc --std=2008 -a starter/cascade_bcd.vhd simulation/test_cascade_bcd.vhd
nvc --std=2008 -e test_cascade_bcd
nvc --std=2008 -r test_cascade_bcd
Test the boundaries
Press KEY0 with both switches down to clear the count. Release it and watch the units advance. Raise SW8 to load 098, then lower SW8 and record four successive readings. Repeat with SW9, which loads 998. The preset switches let you visit carry boundaries during one reservation. Keep the other preset switch down.
| Test | Prediction | First four readings | Time for three transitions |
|---|---|---|---|
| Release the 098 preset | |||
| Release the 998 preset |
While SW8 is up, hold KEY0 and read the displays. Release KEY0 while keeping SW8 up. Give the camera a few seconds to show the settled digits, then record the second reading. Which control takes priority? Explain why connecting the units carry output to a clock input would change the design. Finish with both preset switches down and press KEY0 once.
Source
Original LabsLand activity following FPGAcademy Digital Logic Lab 5, Part II. Verilog handout · VHDL handout · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Build a decimal counter for the three rightmost displays. One second after 099, the displays should read 100. At 999, all three return to zero. A single board clock drives three copies of the same decimal stage.
Predict the enables
Make a table for 008, 009, 098, 099 and 999. For each value, decide which digits should change on the next one-second tick. Name the conditions that advance the tens and the hundreds. Distinguish a digit holding 9 between ticks from a carry that a higher digit should act on.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
cascade_bcd, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
The starter includes a clock divider, one decimal stage and a display decoder. Complete the tens and hundreds enable connections. Use CLOCK_50 for every stage. Keep the hardware clock parameter at 50,000,000. Synthesize, upload, and read HEX2 through HEX0 from left to right.
Simulate the carries
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench runs all 1,000 values and checks the wrap, both presets and reset priority. It gives the divider two clock cycles per tick in simulation. Keep the original divider setting for the physical board. Compare the expected and observed three-digit readings at the first mismatch. Which digit missed its carry? Repair only that stage and rerun. Where does the next mismatch occur? Fix the remaining enable, then check that the bench reaches PASS.
SystemVerilog
iverilog -g2012 -s test_cascade_bcd -o bench starter/cascade_bcd.sv simulation/test_cascade_bcd.v
vvp bench
Test the boundaries
Press KEY0 with both switches down to clear the count. Release it and watch the units advance. Raise SW8 to load 098, then lower SW8 and record four successive readings. Repeat with SW9, which loads 998. The preset switches let you visit carry boundaries during one reservation. Keep the other preset switch down.
| Test | Prediction | First four readings | Time for three transitions |
|---|---|---|---|
| Release the 098 preset | |||
| Release the 998 preset |
While SW8 is up, hold KEY0 and read the displays. Release KEY0 while keeping SW8 up. Give the camera a few seconds to show the settled digits, then record the second reading. Which control takes priority? Explain why connecting the units carry output to a clock input would change the design. Finish with both preset switches down and press KEY0 once.
Source
Original LabsLand activity following FPGAcademy Digital Logic Lab 5, Part II. Verilog handout · VHDL handout · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Build a decimal counter for the three rightmost displays. One second after 099, the displays should read 100. At 999, all three return to zero. A single board clock drives three copies of the same decimal stage.
Predict the enables
Make a table for 008, 009, 098, 099 and 999. For each value, decide which digits should change on the next one-second tick. Name the conditions that advance the tens and the hundreds. Distinguish a digit holding 9 between ticks from a carry that a higher digit should act on.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/cascade_bcd.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
cascade_bcd. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/cascade_bcd.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
The starter includes a clock divider, one decimal stage and a display decoder. Complete the tens and hundreds enable connections. Use CLOCK_50 for every stage. Keep the hardware clock parameter at 50,000,000. Synthesize, upload, and read HEX2 through HEX0 from left to right.
Simulate the carries
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench runs all 1,000 values and checks the wrap, both presets and reset priority. It gives the divider two clock cycles per tick in simulation. Keep the original divider setting for the physical board. Compare the expected and observed three-digit readings at the first mismatch. Which digit missed its carry? Repair only that stage and rerun. Where does the next mismatch occur? Fix the remaining enable, then check that the bench reaches PASS.
SystemVerilog
iverilog -g2012 -s test_cascade_bcd -o bench starter/cascade_bcd.sv simulation/test_cascade_bcd.v
vvp bench
Test the boundaries
Press KEY0 with both switches down to clear the count. Release it and watch the units advance. Raise SW8 to load 098, then lower SW8 and record four successive readings. Repeat with SW9, which loads 998. The preset switches let you visit carry boundaries during one reservation. Keep the other preset switch down.
| Test | Prediction | First four readings | Time for three transitions |
|---|---|---|---|
| Release the 098 preset | |||
| Release the 998 preset |
While SW8 is up, hold KEY0 and read the displays. Release KEY0 while keeping SW8 up. Give the camera a few seconds to show the settled digits, then record the second reading. Which control takes priority? Explain why connecting the units carry output to a clock input would change the design. Finish with both preset switches down and press KEY0 once.
Source
Original LabsLand activity following FPGAcademy Digital Logic Lab 5, Part II. Verilog handout · VHDL handout · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Make six displays show minutes, seconds and hundredths of a second. Trace which digits change at 12:39.99 and at 59:59.99. Why do the two tens digits for minutes and seconds have a different last state from the other digits?
The starter lets the seconds count through 60. Run the starter in the simulator, then find the terminal count for the tens of seconds and correct the carry into minutes. Keep TICKS at 500,000 for the 50 MHz board clock. Calculate how many input edges occur in one hundredth of a second.
Simulate the carries
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The testbench models four input edges per hundredth to make the experiment quick. Run it on the starter, record the first failing rollover and repeat after your correction. The test tries an invalid tens digit and an invalid units digit separately. It checks both sides of 59:59.99, another 6,205 time steps, and the pause and restart controls on KEY0 and SW8.
Verilog
iverilog -g2005 -s test_clock -o bench starter/hundredth_clock.v simulation/test_clock.v
vvp bench
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
hundredth_clock, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Set and read the clock
On the programmed board, read HEX5…0 as three pairs, MM SS hh. Enter the minutes as two binary-coded decimal digits. SW7…4 set the tens and SW3…0 set the units. Press KEY1 to load them. With SW9 down this changes only the minutes. Hold KEY0 to pause and release it to continue.
SW8 lets you leave the clock paused while changing other controls. SW9 helps you reach the final hundredths in one reservation. When SW9 is up, a valid KEY1 load also sets seconds and hundredths to 59.98.
| Test | Controls | Camera reading |
|---|---|---|
| Start near the boundary | Raise SW8 and SW9, set the minute switches to 0101 1001, then press KEY1 | |
| Change minutes only | Leave SW8 up, lower SW9, set 0100 0010, press KEY1 | |
| Test the tens digit | Enter 0110 0010 (62) and press KEY1 | |
| Test the units digit | Enter 0100 1010 (4 and hexadecimal A) and press KEY1 | |
| Cross the boundary | Repeat the first row, lower SW9, then lower SW8 | |
| Pause and resume | Hold KEY0 for two seconds, record two readings, release and read again | |
| Pause with SW8 | Raise SW8. Read all six digits twice, two seconds apart. Lower SW8 and check that time advances. |
Which earlier reading should both invalid presets preserve? Explain what each one tests. Record the last state in the simulator and your first stable camera reading after the rollover. The hundredths can change between camera frames. Explain how your observations establish rollover and pause. Leave both SW8 and SW9 down when finished.
Source
Original LabsLand activity following FPGAcademy Digital Logic Lab 5, Part III. Verilog handout · VHDL handout · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Make six displays show minutes, seconds and hundredths of a second. Trace which digits change at 12:39.99 and at 59:59.99. Why do the two tens digits for minutes and seconds have a different last state from the other digits?
The starter lets the seconds count through 60. Run the starter in the simulator, then find the terminal count for the tens of seconds and correct the carry into minutes. Keep TICKS at 500,000 for the 50 MHz board clock. Calculate how many input edges occur in one hundredth of a second.
Simulate the carries
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The testbench models four input edges per hundredth to make the experiment quick. Run it on the starter, record the first failing rollover and repeat after your correction. The test tries an invalid tens digit and an invalid units digit separately. It checks both sides of 59:59.99, another 6,205 time steps, and the pause and restart controls on KEY0 and SW8.
Verilog
iverilog -g2005 -s test_clock -o bench starter/hundredth_clock.v simulation/test_clock.v
vvp bench
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/hundredth_clock.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
hundredth_clock. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/hundredth_clock.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Set and read the clock
On the programmed board, read HEX5…0 as three pairs, MM SS hh. Enter the minutes as two binary-coded decimal digits. SW7…4 set the tens and SW3…0 set the units. Press KEY1 to load them. With SW9 down this changes only the minutes. Hold KEY0 to pause and release it to continue.
SW8 lets you leave the clock paused while changing other controls. SW9 helps you reach the final hundredths in one reservation. When SW9 is up, a valid KEY1 load also sets seconds and hundredths to 59.98.
| Test | Controls | Camera reading |
|---|---|---|
| Start near the boundary | Raise SW8 and SW9, set the minute switches to 0101 1001, then press KEY1 | |
| Change minutes only | Leave SW8 up, lower SW9, set 0100 0010, press KEY1 | |
| Test the tens digit | Enter 0110 0010 (62) and press KEY1 | |
| Test the units digit | Enter 0100 1010 (4 and hexadecimal A) and press KEY1 | |
| Cross the boundary | Repeat the first row, lower SW9, then lower SW8 | |
| Pause and resume | Hold KEY0 for two seconds, record two readings, release and read again | |
| Pause with SW8 | Raise SW8. Read all six digits twice, two seconds apart. Lower SW8 and check that time advances. |
Which earlier reading should both invalid presets preserve? Explain what each one tests. Record the last state in the simulator and your first stable camera reading after the rollover. The hundredths can change between camera frames. Explain how your observations establish rollover and pause. Leave both SW8 and SW9 down when finished.
Source
Original LabsLand activity following FPGAcademy Digital Logic Lab 5, Part III. Verilog handout · VHDL handout · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Make six displays show minutes, seconds and hundredths of a second. Trace which digits change at 12:39.99 and at 59:59.99. Why do the two tens digits for minutes and seconds have a different last state from the other digits?
The starter lets the seconds count through 60. Run the starter in the simulator, then find the terminal count for the tens of seconds and correct the carry into minutes. Keep TICKS at 500,000 for the 50 MHz board clock. Calculate how many input edges occur in one hundredth of a second.
Simulate the carries
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The testbench models four input edges per hundredth to make the experiment quick. Run it on the starter, record the first failing rollover and repeat after your correction. The test tries an invalid tens digit and an invalid units digit separately. It checks both sides of 59:59.99, another 6,205 time steps, and the pause and restart controls on KEY0 and SW8.
VHDL
nvc --std=2008 -a starter/hundredth_clock.vhd simulation/test_clock.vhd
nvc --std=2008 -e test_clock
nvc --std=2008 -r test_clock
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
hundredth_clock, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Set and read the clock
On the programmed board, read HEX5…0 as three pairs, MM SS hh. Enter the minutes as two binary-coded decimal digits. SW7…4 set the tens and SW3…0 set the units. Press KEY1 to load them. With SW9 down this changes only the minutes. Hold KEY0 to pause and release it to continue.
SW8 lets you leave the clock paused while changing other controls. SW9 helps you reach the final hundredths in one reservation. When SW9 is up, a valid KEY1 load also sets seconds and hundredths to 59.98.
| Test | Controls | Camera reading |
|---|---|---|
| Start near the boundary | Raise SW8 and SW9, set the minute switches to 0101 1001, then press KEY1 | |
| Change minutes only | Leave SW8 up, lower SW9, set 0100 0010, press KEY1 | |
| Test the tens digit | Enter 0110 0010 (62) and press KEY1 | |
| Test the units digit | Enter 0100 1010 (4 and hexadecimal A) and press KEY1 | |
| Cross the boundary | Repeat the first row, lower SW9, then lower SW8 | |
| Pause and resume | Hold KEY0 for two seconds, record two readings, release and read again | |
| Pause with SW8 | Raise SW8. Read all six digits twice, two seconds apart. Lower SW8 and check that time advances. |
Which earlier reading should both invalid presets preserve? Explain what each one tests. Record the last state in the simulator and your first stable camera reading after the rollover. The hundredths can change between camera frames. Explain how your observations establish rollover and pause. Leave both SW8 and SW9 down when finished.
Source
Original LabsLand activity following FPGAcademy Digital Logic Lab 5, Part III. Verilog handout · VHDL handout · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Make six displays show minutes, seconds and hundredths of a second. Trace which digits change at 12:39.99 and at 59:59.99. Why do the two tens digits for minutes and seconds have a different last state from the other digits?
The starter lets the seconds count through 60. Run the starter in the simulator, then find the terminal count for the tens of seconds and correct the carry into minutes. Keep TICKS at 500,000 for the 50 MHz board clock. Calculate how many input edges occur in one hundredth of a second.
Simulate the carries
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The testbench models four input edges per hundredth to make the experiment quick. Run it on the starter, record the first failing rollover and repeat after your correction. The test tries an invalid tens digit and an invalid units digit separately. It checks both sides of 59:59.99, another 6,205 time steps, and the pause and restart controls on KEY0 and SW8.
VHDL
nvc --std=2008 -a starter/hundredth_clock.vhd simulation/test_clock.vhd
nvc --std=2008 -e test_clock
nvc --std=2008 -r test_clock
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/hundredth_clock.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
hundredth_clock. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/hundredth_clock.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Set and read the clock
On the programmed board, read HEX5…0 as three pairs, MM SS hh. Enter the minutes as two binary-coded decimal digits. SW7…4 set the tens and SW3…0 set the units. Press KEY1 to load them. With SW9 down this changes only the minutes. Hold KEY0 to pause and release it to continue.
SW8 lets you leave the clock paused while changing other controls. SW9 helps you reach the final hundredths in one reservation. When SW9 is up, a valid KEY1 load also sets seconds and hundredths to 59.98.
| Test | Controls | Camera reading |
|---|---|---|
| Start near the boundary | Raise SW8 and SW9, set the minute switches to 0101 1001, then press KEY1 | |
| Change minutes only | Leave SW8 up, lower SW9, set 0100 0010, press KEY1 | |
| Test the tens digit | Enter 0110 0010 (62) and press KEY1 | |
| Test the units digit | Enter 0100 1010 (4 and hexadecimal A) and press KEY1 | |
| Cross the boundary | Repeat the first row, lower SW9, then lower SW8 | |
| Pause and resume | Hold KEY0 for two seconds, record two readings, release and read again | |
| Pause with SW8 | Raise SW8. Read all six digits twice, two seconds apart. Lower SW8 and check that time advances. |
Which earlier reading should both invalid presets preserve? Explain what each one tests. Record the last state in the simulator and your first stable camera reading after the rollover. The hundredths can change between camera frames. Explain how your observations establish rollover and pause. Leave both SW8 and SW9 down when finished.
Source
Original LabsLand activity following FPGAcademy Digital Logic Lab 5, Part III. Verilog handout · VHDL handout · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Make six displays show minutes, seconds and hundredths of a second. Trace which digits change at 12:39.99 and at 59:59.99. Why do the two tens digits for minutes and seconds have a different last state from the other digits?
The starter lets the seconds count through 60. Run the starter in the simulator, then find the terminal count for the tens of seconds and correct the carry into minutes. Keep TICKS at 500,000 for the 50 MHz board clock. Calculate how many input edges occur in one hundredth of a second.
Simulate the carries
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The testbench models four input edges per hundredth to make the experiment quick. Run it on the starter, record the first failing rollover and repeat after your correction. The test tries an invalid tens digit and an invalid units digit separately. It checks both sides of 59:59.99, another 6,205 time steps, and the pause and restart controls on KEY0 and SW8.
SystemVerilog
iverilog -g2012 -s test_clock -o bench starter/hundredth_clock.sv simulation/test_clock.v
vvp bench
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
hundredth_clock, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Set and read the clock
On the programmed board, read HEX5…0 as three pairs, MM SS hh. Enter the minutes as two binary-coded decimal digits. SW7…4 set the tens and SW3…0 set the units. Press KEY1 to load them. With SW9 down this changes only the minutes. Hold KEY0 to pause and release it to continue.
SW8 lets you leave the clock paused while changing other controls. SW9 helps you reach the final hundredths in one reservation. When SW9 is up, a valid KEY1 load also sets seconds and hundredths to 59.98.
| Test | Controls | Camera reading |
|---|---|---|
| Start near the boundary | Raise SW8 and SW9, set the minute switches to 0101 1001, then press KEY1 | |
| Change minutes only | Leave SW8 up, lower SW9, set 0100 0010, press KEY1 | |
| Test the tens digit | Enter 0110 0010 (62) and press KEY1 | |
| Test the units digit | Enter 0100 1010 (4 and hexadecimal A) and press KEY1 | |
| Cross the boundary | Repeat the first row, lower SW9, then lower SW8 | |
| Pause and resume | Hold KEY0 for two seconds, record two readings, release and read again | |
| Pause with SW8 | Raise SW8. Read all six digits twice, two seconds apart. Lower SW8 and check that time advances. |
Which earlier reading should both invalid presets preserve? Explain what each one tests. Record the last state in the simulator and your first stable camera reading after the rollover. The hundredths can change between camera frames. Explain how your observations establish rollover and pause. Leave both SW8 and SW9 down when finished.
Source
Original LabsLand activity following FPGAcademy Digital Logic Lab 5, Part III. Verilog handout · VHDL handout · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Make six displays show minutes, seconds and hundredths of a second. Trace which digits change at 12:39.99 and at 59:59.99. Why do the two tens digits for minutes and seconds have a different last state from the other digits?
The starter lets the seconds count through 60. Run the starter in the simulator, then find the terminal count for the tens of seconds and correct the carry into minutes. Keep TICKS at 500,000 for the 50 MHz board clock. Calculate how many input edges occur in one hundredth of a second.
Simulate the carries
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The testbench models four input edges per hundredth to make the experiment quick. Run it on the starter, record the first failing rollover and repeat after your correction. The test tries an invalid tens digit and an invalid units digit separately. It checks both sides of 59:59.99, another 6,205 time steps, and the pause and restart controls on KEY0 and SW8.
SystemVerilog
iverilog -g2012 -s test_clock -o bench starter/hundredth_clock.sv simulation/test_clock.v
vvp bench
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/hundredth_clock.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
hundredth_clock. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/hundredth_clock.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Set and read the clock
On the programmed board, read HEX5…0 as three pairs, MM SS hh. Enter the minutes as two binary-coded decimal digits. SW7…4 set the tens and SW3…0 set the units. Press KEY1 to load them. With SW9 down this changes only the minutes. Hold KEY0 to pause and release it to continue.
SW8 lets you leave the clock paused while changing other controls. SW9 helps you reach the final hundredths in one reservation. When SW9 is up, a valid KEY1 load also sets seconds and hundredths to 59.98.
| Test | Controls | Camera reading |
|---|---|---|
| Start near the boundary | Raise SW8 and SW9, set the minute switches to 0101 1001, then press KEY1 | |
| Change minutes only | Leave SW8 up, lower SW9, set 0100 0010, press KEY1 | |
| Test the tens digit | Enter 0110 0010 (62) and press KEY1 | |
| Test the units digit | Enter 0100 1010 (4 and hexadecimal A) and press KEY1 | |
| Cross the boundary | Repeat the first row, lower SW9, then lower SW8 | |
| Pause and resume | Hold KEY0 for two seconds, record two readings, release and read again | |
| Pause with SW8 | Raise SW8. Read all six digits twice, two seconds apart. Lower SW8 and check that time advances. |
Which earlier reading should both invalid presets preserve? Explain what each one tests. Record the last state in the simulator and your first stable camera reading after the rollover. The hundredths can change between camera frames. Explain how your observations establish rollover and pause. Leave both SW8 and SW9 down when finished.
Source
Original LabsLand activity following FPGAcademy Digital Logic Lab 5, Part III. Verilog handout · VHDL handout · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Use one red LED to send one of eight letters. A dot lasts half a second, a dash lasts one and a half seconds, and successive symbols are separated by half a second of darkness. A has a short pulse then a long one. How could a classmate tell B and D apart?
| SW2…0 | Letter | Symbols | SW2…0 | Letter | Symbols |
|---|---|---|---|---|---|
| 000 | A | · — | 100 | E | · |
| 001 | B | — · · · | 101 | F | · · — · |
| 010 | C | — · — · | 110 | G | — — · |
| 011 | D | — · · | 111 | H | · · · · |
Locate where KEY1 captures both the pattern and the letter length. The starter gives a dash only two timing units. Find the two places a new pulse can start. Which one determines the first mark of B? Which one determines the second mark of A? Predict the total elapsed time from the first light to the end of the last light for A and B.
Simulate the signal
The testbench holds KEY1 down while sending E. Predict how many dots you should see before the key is released.
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench uses five clock edges per half-second unit and checks the light at every edge for all eight letters. It also changes the selector during a letter and asserts reset between clock edges. Run it on the starter, record the first pulse that is too short, and repeat after your correction.
Verilog
iverilog -g2005 -s test_morse -o bench starter/morse_sender.v simulation/test_morse.v
vvp bench
Build
When the corrected design reports PASS A-H, use the same source file for the board. Keep the half-second unit at 25,000,000 clock cycles.
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
morse_sender, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Read a letter from the board
Press and release KEY0 once. Select a letter with SW2…0 and press and release KEY1. Watch LEDR0, the rightmost red light. Wait until the letter is complete before starting again. Have a partner choose a letter out of sight and see whether you can read it from the pulses.
| Letter selected | Predicted symbols | Observed short and long pulses | Time from first light to last light going out |
|---|---|---|---|
| A | |||
| B | |||
| D | |||
| One letter chosen by a partner |
During a second B, change the selector to C (010) but leave KEY1 alone. Which letter finishes? Start another B and press KEY0 in its first dash. Check that the light stays off until you start a new letter. Use the simulation to measure exact pulse widths. Camera frames and hand timing give approximate durations.
Source
Original LabsLand activity following FPGAcademy Digital Logic Lab 5, Part IV. Verilog handout · VHDL handout · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Use one red LED to send one of eight letters. A dot lasts half a second, a dash lasts one and a half seconds, and successive symbols are separated by half a second of darkness. A has a short pulse then a long one. How could a classmate tell B and D apart?
| SW2…0 | Letter | Symbols | SW2…0 | Letter | Symbols |
|---|---|---|---|---|---|
| 000 | A | · — | 100 | E | · |
| 001 | B | — · · · | 101 | F | · · — · |
| 010 | C | — · — · | 110 | G | — — · |
| 011 | D | — · · | 111 | H | · · · · |
Locate where KEY1 captures both the pattern and the letter length. The starter gives a dash only two timing units. Find the two places a new pulse can start. Which one determines the first mark of B? Which one determines the second mark of A? Predict the total elapsed time from the first light to the end of the last light for A and B.
Simulate the signal
The testbench holds KEY1 down while sending E. Predict how many dots you should see before the key is released.
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench uses five clock edges per half-second unit and checks the light at every edge for all eight letters. It also changes the selector during a letter and asserts reset between clock edges. Run it on the starter, record the first pulse that is too short, and repeat after your correction.
Verilog
iverilog -g2005 -s test_morse -o bench starter/morse_sender.v simulation/test_morse.v
vvp bench
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
When the corrected design reports PASS A-H, use the same source file for the board. Keep the half-second unit at 25,000,000 clock cycles.
- From the extracted worksheet folder, open
starter/morse_sender.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
morse_sender. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/morse_sender.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Read a letter from the board
Press and release KEY0 once. Select a letter with SW2…0 and press and release KEY1. Watch LEDR0, the rightmost red light. Wait until the letter is complete before starting again. Have a partner choose a letter out of sight and see whether you can read it from the pulses.
| Letter selected | Predicted symbols | Observed short and long pulses | Time from first light to last light going out |
|---|---|---|---|
| A | |||
| B | |||
| D | |||
| One letter chosen by a partner |
During a second B, change the selector to C (010) but leave KEY1 alone. Which letter finishes? Start another B and press KEY0 in its first dash. Check that the light stays off until you start a new letter. Use the simulation to measure exact pulse widths. Camera frames and hand timing give approximate durations.
Source
Original LabsLand activity following FPGAcademy Digital Logic Lab 5, Part IV. Verilog handout · VHDL handout · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Use one red LED to send one of eight letters. A dot lasts half a second, a dash lasts one and a half seconds, and successive symbols are separated by half a second of darkness. A has a short pulse then a long one. How could a classmate tell B and D apart?
| SW2…0 | Letter | Symbols | SW2…0 | Letter | Symbols |
|---|---|---|---|---|---|
| 000 | A | · — | 100 | E | · |
| 001 | B | — · · · | 101 | F | · · — · |
| 010 | C | — · — · | 110 | G | — — · |
| 011 | D | — · · | 111 | H | · · · · |
Locate where KEY1 captures both the pattern and the letter length. The starter gives a dash only two timing units. Find the two places a new pulse can start. Which one determines the first mark of B? Which one determines the second mark of A? Predict the total elapsed time from the first light to the end of the last light for A and B.
Simulate the signal
The testbench holds KEY1 down while sending E. Predict how many dots you should see before the key is released.
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench uses five clock edges per half-second unit and checks the light at every edge for all eight letters. It also changes the selector during a letter and asserts reset between clock edges. Run it on the starter, record the first pulse that is too short, and repeat after your correction.
VHDL
nvc --std=2008 -a starter/morse_sender.vhd simulation/test_morse.vhd
nvc --std=2008 -e test_morse
nvc --std=2008 -r test_morse
Build
When the corrected design reports PASS A-H, use the same source file for the board. Keep the half-second unit at 25,000,000 clock cycles.
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
morse_sender, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Read a letter from the board
Press and release KEY0 once. Select a letter with SW2…0 and press and release KEY1. Watch LEDR0, the rightmost red light. Wait until the letter is complete before starting again. Have a partner choose a letter out of sight and see whether you can read it from the pulses.
| Letter selected | Predicted symbols | Observed short and long pulses | Time from first light to last light going out |
|---|---|---|---|
| A | |||
| B | |||
| D | |||
| One letter chosen by a partner |
During a second B, change the selector to C (010) but leave KEY1 alone. Which letter finishes? Start another B and press KEY0 in its first dash. Check that the light stays off until you start a new letter. Use the simulation to measure exact pulse widths. Camera frames and hand timing give approximate durations.
Source
Original LabsLand activity following FPGAcademy Digital Logic Lab 5, Part IV. Verilog handout · VHDL handout · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Use one red LED to send one of eight letters. A dot lasts half a second, a dash lasts one and a half seconds, and successive symbols are separated by half a second of darkness. A has a short pulse then a long one. How could a classmate tell B and D apart?
| SW2…0 | Letter | Symbols | SW2…0 | Letter | Symbols |
|---|---|---|---|---|---|
| 000 | A | · — | 100 | E | · |
| 001 | B | — · · · | 101 | F | · · — · |
| 010 | C | — · — · | 110 | G | — — · |
| 011 | D | — · · | 111 | H | · · · · |
Locate where KEY1 captures both the pattern and the letter length. The starter gives a dash only two timing units. Find the two places a new pulse can start. Which one determines the first mark of B? Which one determines the second mark of A? Predict the total elapsed time from the first light to the end of the last light for A and B.
Simulate the signal
The testbench holds KEY1 down while sending E. Predict how many dots you should see before the key is released.
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench uses five clock edges per half-second unit and checks the light at every edge for all eight letters. It also changes the selector during a letter and asserts reset between clock edges. Run it on the starter, record the first pulse that is too short, and repeat after your correction.
VHDL
nvc --std=2008 -a starter/morse_sender.vhd simulation/test_morse.vhd
nvc --std=2008 -e test_morse
nvc --std=2008 -r test_morse
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
When the corrected design reports PASS A-H, use the same source file for the board. Keep the half-second unit at 25,000,000 clock cycles.
- From the extracted worksheet folder, open
starter/morse_sender.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
morse_sender. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/morse_sender.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Read a letter from the board
Press and release KEY0 once. Select a letter with SW2…0 and press and release KEY1. Watch LEDR0, the rightmost red light. Wait until the letter is complete before starting again. Have a partner choose a letter out of sight and see whether you can read it from the pulses.
| Letter selected | Predicted symbols | Observed short and long pulses | Time from first light to last light going out |
|---|---|---|---|
| A | |||
| B | |||
| D | |||
| One letter chosen by a partner |
During a second B, change the selector to C (010) but leave KEY1 alone. Which letter finishes? Start another B and press KEY0 in its first dash. Check that the light stays off until you start a new letter. Use the simulation to measure exact pulse widths. Camera frames and hand timing give approximate durations.
Source
Original LabsLand activity following FPGAcademy Digital Logic Lab 5, Part IV. Verilog handout · VHDL handout · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Use one red LED to send one of eight letters. A dot lasts half a second, a dash lasts one and a half seconds, and successive symbols are separated by half a second of darkness. A has a short pulse then a long one. How could a classmate tell B and D apart?
| SW2…0 | Letter | Symbols | SW2…0 | Letter | Symbols |
|---|---|---|---|---|---|
| 000 | A | · — | 100 | E | · |
| 001 | B | — · · · | 101 | F | · · — · |
| 010 | C | — · — · | 110 | G | — — · |
| 011 | D | — · · | 111 | H | · · · · |
Locate where KEY1 captures both the pattern and the letter length. The starter gives a dash only two timing units. Find the two places a new pulse can start. Which one determines the first mark of B? Which one determines the second mark of A? Predict the total elapsed time from the first light to the end of the last light for A and B.
Simulate the signal
The testbench holds KEY1 down while sending E. Predict how many dots you should see before the key is released.
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench uses five clock edges per half-second unit and checks the light at every edge for all eight letters. It also changes the selector during a letter and asserts reset between clock edges. Run it on the starter, record the first pulse that is too short, and repeat after your correction.
SystemVerilog
iverilog -g2012 -s test_morse -o bench starter/morse_sender.sv simulation/test_morse.v
vvp bench
Build
When the corrected design reports PASS A-H, use the same source file for the board. Keep the half-second unit at 25,000,000 clock cycles.
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
morse_sender, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Read a letter from the board
Press and release KEY0 once. Select a letter with SW2…0 and press and release KEY1. Watch LEDR0, the rightmost red light. Wait until the letter is complete before starting again. Have a partner choose a letter out of sight and see whether you can read it from the pulses.
| Letter selected | Predicted symbols | Observed short and long pulses | Time from first light to last light going out |
|---|---|---|---|
| A | |||
| B | |||
| D | |||
| One letter chosen by a partner |
During a second B, change the selector to C (010) but leave KEY1 alone. Which letter finishes? Start another B and press KEY0 in its first dash. Check that the light stays off until you start a new letter. Use the simulation to measure exact pulse widths. Camera frames and hand timing give approximate durations.
Source
Original LabsLand activity following FPGAcademy Digital Logic Lab 5, Part IV. Verilog handout · VHDL handout · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Use one red LED to send one of eight letters. A dot lasts half a second, a dash lasts one and a half seconds, and successive symbols are separated by half a second of darkness. A has a short pulse then a long one. How could a classmate tell B and D apart?
| SW2…0 | Letter | Symbols | SW2…0 | Letter | Symbols |
|---|---|---|---|---|---|
| 000 | A | · — | 100 | E | · |
| 001 | B | — · · · | 101 | F | · · — · |
| 010 | C | — · — · | 110 | G | — — · |
| 011 | D | — · · | 111 | H | · · · · |
Locate where KEY1 captures both the pattern and the letter length. The starter gives a dash only two timing units. Find the two places a new pulse can start. Which one determines the first mark of B? Which one determines the second mark of A? Predict the total elapsed time from the first light to the end of the last light for A and B.
Simulate the signal
The testbench holds KEY1 down while sending E. Predict how many dots you should see before the key is released.
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench uses five clock edges per half-second unit and checks the light at every edge for all eight letters. It also changes the selector during a letter and asserts reset between clock edges. Run it on the starter, record the first pulse that is too short, and repeat after your correction.
SystemVerilog
iverilog -g2012 -s test_morse -o bench starter/morse_sender.sv simulation/test_morse.v
vvp bench
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
When the corrected design reports PASS A-H, use the same source file for the board. Keep the half-second unit at 25,000,000 clock cycles.
- From the extracted worksheet folder, open
starter/morse_sender.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
morse_sender. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/morse_sender.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Read a letter from the board
Press and release KEY0 once. Select a letter with SW2…0 and press and release KEY1. Watch LEDR0, the rightmost red light. Wait until the letter is complete before starting again. Have a partner choose a letter out of sight and see whether you can read it from the pulses.
| Letter selected | Predicted symbols | Observed short and long pulses | Time from first light to last light going out |
|---|---|---|---|
| A | |||
| B | |||
| D | |||
| One letter chosen by a partner |
During a second B, change the selector to C (010) but leave KEY1 alone. Which letter finishes? Start another B and press KEY0 in its first dash. Check that the light stays off until you start a new letter. Use the simulation to measure exact pulse widths. Camera frames and hand timing give approximate durations.
Source
Original LabsLand activity following FPGAcademy Digital Logic Lab 5, Part IV. Verilog handout · VHDL handout · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
An eight-bit sum has two interpretations. After adding 1 to 7F hexadecimal, what would an unsigned observer say happened? What would someone reading signed two’s-complement numbers say? Build an accumulator that reports both answers.
Trace the registers
HEX3…2 shows the captured operand A. HEX1…0 shows the accumulated value S. The eight rightmost red LEDs preview the sum of those two registers. When you release KEY1, the board saves that sum into S and samples SW7…0 as the next A. At the same instant, LEDR8 remembers the carry and LEDR9 remembers the signed overflow from the sum just saved.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
signed_accumulator, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
The starter wires the same flag into carry and overflow. Derive when two positive operands can produce a negative result and when two negative operands can produce a positive result. Correct the overflow register.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The testbench tries every pair of eight-bit values. It checks carry using the unsigned sum, then checks whether the signed sum fits in eight bits. It also checks all four display digits. Run the starter, record the first pair that fails, and repeat after your correction.
Verilog
iverilog -g2005 -s test_accumulator -o bench starter/signed_accumulator.v simulation/test_accumulator.v
vvp bench
Work through two sums on the board
Synthesize and upload. Press and release KEY0 to reset both registers and flags. Enter 7F on the switches. Before touching KEY1, check whether either register changed. For each row below, set the switches, press and release KEY1 once, then read the board. Record A, S and the preview on LEDR7–0 in hexadecimal. For carry (C, LEDR8) and signed overflow (V, LEDR9), write 1 for lit or 0 for dark.
| SW7–0 | A | S | LEDR7–0 | C | V |
|---|---|---|---|---|---|
| 7F | |||||
| 01 | |||||
| FF | |||||
| 80 | |||||
| 00 |
Reset again with KEY0. Set the switches to each value below and release KEY1 once per row.
| SW7–0 | A | S | LEDR7–0 | C | V |
|---|---|---|---|---|---|
| FF | |||||
| 01 | |||||
| 00 |
On which release does unsigned addition wrap to zero without signed overflow? Hand in both traces and explain why the preview LEDs sometimes disagree with the stored sum.
Original LabsLand activity following FPGAcademy Digital Logic Lab 6, Part I. Verilog PDF · VHDL PDF · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
An eight-bit sum has two interpretations. After adding 1 to 7F hexadecimal, what would an unsigned observer say happened? What would someone reading signed two’s-complement numbers say? Build an accumulator that reports both answers.
Trace the registers
HEX3…2 shows the captured operand A. HEX1…0 shows the accumulated value S. The eight rightmost red LEDs preview the sum of those two registers. When you release KEY1, the board saves that sum into S and samples SW7…0 as the next A. At the same instant, LEDR8 remembers the carry and LEDR9 remembers the signed overflow from the sum just saved.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/signed_accumulator.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
signed_accumulator. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/signed_accumulator.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
The starter wires the same flag into carry and overflow. Derive when two positive operands can produce a negative result and when two negative operands can produce a positive result. Correct the overflow register.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The testbench tries every pair of eight-bit values. It checks carry using the unsigned sum, then checks whether the signed sum fits in eight bits. It also checks all four display digits. Run the starter, record the first pair that fails, and repeat after your correction.
Verilog
iverilog -g2005 -s test_accumulator -o bench starter/signed_accumulator.v simulation/test_accumulator.v
vvp bench
Work through two sums on the board
Synthesize and upload. Press and release KEY0 to reset both registers and flags. Enter 7F on the switches. Before touching KEY1, check whether either register changed. For each row below, set the switches, press and release KEY1 once, then read the board. Record A, S and the preview on LEDR7–0 in hexadecimal. For carry (C, LEDR8) and signed overflow (V, LEDR9), write 1 for lit or 0 for dark.
| SW7–0 | A | S | LEDR7–0 | C | V |
|---|---|---|---|---|---|
| 7F | |||||
| 01 | |||||
| FF | |||||
| 80 | |||||
| 00 |
Reset again with KEY0. Set the switches to each value below and release KEY1 once per row.
| SW7–0 | A | S | LEDR7–0 | C | V |
|---|---|---|---|---|---|
| FF | |||||
| 01 | |||||
| 00 |
On which release does unsigned addition wrap to zero without signed overflow? Hand in both traces and explain why the preview LEDs sometimes disagree with the stored sum.
Original LabsLand activity following FPGAcademy Digital Logic Lab 6, Part I. Verilog PDF · VHDL PDF · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
An eight-bit sum has two interpretations. After adding 1 to 7F hexadecimal, what would an unsigned observer say happened? What would someone reading signed two’s-complement numbers say? Build an accumulator that reports both answers.
Trace the registers
HEX3…2 shows the captured operand A. HEX1…0 shows the accumulated value S. The eight rightmost red LEDs preview the sum of those two registers. When you release KEY1, the board saves that sum into S and samples SW7…0 as the next A. At the same instant, LEDR8 remembers the carry and LEDR9 remembers the signed overflow from the sum just saved.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
signed_accumulator, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
The starter wires the same flag into carry and overflow. Derive when two positive operands can produce a negative result and when two negative operands can produce a positive result. Correct the overflow register.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The testbench tries every pair of eight-bit values. It checks carry using the unsigned sum, then checks whether the signed sum fits in eight bits. It also checks all four display digits. Run the starter, record the first pair that fails, and repeat after your correction.
VHDL
nvc --std=2008 -a starter/signed_accumulator.vhd simulation/test_accumulator.vhd
nvc --std=2008 -e test_accumulator
nvc --std=2008 -r test_accumulator
Work through two sums on the board
Synthesize and upload. Press and release KEY0 to reset both registers and flags. Enter 7F on the switches. Before touching KEY1, check whether either register changed. For each row below, set the switches, press and release KEY1 once, then read the board. Record A, S and the preview on LEDR7–0 in hexadecimal. For carry (C, LEDR8) and signed overflow (V, LEDR9), write 1 for lit or 0 for dark.
| SW7–0 | A | S | LEDR7–0 | C | V |
|---|---|---|---|---|---|
| 7F | |||||
| 01 | |||||
| FF | |||||
| 80 | |||||
| 00 |
Reset again with KEY0. Set the switches to each value below and release KEY1 once per row.
| SW7–0 | A | S | LEDR7–0 | C | V |
|---|---|---|---|---|---|
| FF | |||||
| 01 | |||||
| 00 |
On which release does unsigned addition wrap to zero without signed overflow? Hand in both traces and explain why the preview LEDs sometimes disagree with the stored sum.
Original LabsLand activity following FPGAcademy Digital Logic Lab 6, Part I. Verilog PDF · VHDL PDF · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
An eight-bit sum has two interpretations. After adding 1 to 7F hexadecimal, what would an unsigned observer say happened? What would someone reading signed two’s-complement numbers say? Build an accumulator that reports both answers.
Trace the registers
HEX3…2 shows the captured operand A. HEX1…0 shows the accumulated value S. The eight rightmost red LEDs preview the sum of those two registers. When you release KEY1, the board saves that sum into S and samples SW7…0 as the next A. At the same instant, LEDR8 remembers the carry and LEDR9 remembers the signed overflow from the sum just saved.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/signed_accumulator.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
signed_accumulator. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/signed_accumulator.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
The starter wires the same flag into carry and overflow. Derive when two positive operands can produce a negative result and when two negative operands can produce a positive result. Correct the overflow register.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The testbench tries every pair of eight-bit values. It checks carry using the unsigned sum, then checks whether the signed sum fits in eight bits. It also checks all four display digits. Run the starter, record the first pair that fails, and repeat after your correction.
VHDL
nvc --std=2008 -a starter/signed_accumulator.vhd simulation/test_accumulator.vhd
nvc --std=2008 -e test_accumulator
nvc --std=2008 -r test_accumulator
Work through two sums on the board
Synthesize and upload. Press and release KEY0 to reset both registers and flags. Enter 7F on the switches. Before touching KEY1, check whether either register changed. For each row below, set the switches, press and release KEY1 once, then read the board. Record A, S and the preview on LEDR7–0 in hexadecimal. For carry (C, LEDR8) and signed overflow (V, LEDR9), write 1 for lit or 0 for dark.
| SW7–0 | A | S | LEDR7–0 | C | V |
|---|---|---|---|---|---|
| 7F | |||||
| 01 | |||||
| FF | |||||
| 80 | |||||
| 00 |
Reset again with KEY0. Set the switches to each value below and release KEY1 once per row.
| SW7–0 | A | S | LEDR7–0 | C | V |
|---|---|---|---|---|---|
| FF | |||||
| 01 | |||||
| 00 |
On which release does unsigned addition wrap to zero without signed overflow? Hand in both traces and explain why the preview LEDs sometimes disagree with the stored sum.
Original LabsLand activity following FPGAcademy Digital Logic Lab 6, Part I. Verilog PDF · VHDL PDF · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
An eight-bit sum has two interpretations. After adding 1 to 7F hexadecimal, what would an unsigned observer say happened? What would someone reading signed two’s-complement numbers say? Build an accumulator that reports both answers.
Trace the registers
HEX3…2 shows the captured operand A. HEX1…0 shows the accumulated value S. The eight rightmost red LEDs preview the sum of those two registers. When you release KEY1, the board saves that sum into S and samples SW7…0 as the next A. At the same instant, LEDR8 remembers the carry and LEDR9 remembers the signed overflow from the sum just saved.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
signed_accumulator, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
The starter wires the same flag into carry and overflow. Derive when two positive operands can produce a negative result and when two negative operands can produce a positive result. Correct the overflow register.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The testbench tries every pair of eight-bit values. It checks carry using the unsigned sum, then checks whether the signed sum fits in eight bits. It also checks all four display digits. Run the starter, record the first pair that fails, and repeat after your correction.
SystemVerilog
iverilog -g2012 -s test_accumulator -o bench starter/signed_accumulator.sv simulation/test_accumulator.v
vvp bench
Work through two sums on the board
Synthesize and upload. Press and release KEY0 to reset both registers and flags. Enter 7F on the switches. Before touching KEY1, check whether either register changed. For each row below, set the switches, press and release KEY1 once, then read the board. Record A, S and the preview on LEDR7–0 in hexadecimal. For carry (C, LEDR8) and signed overflow (V, LEDR9), write 1 for lit or 0 for dark.
| SW7–0 | A | S | LEDR7–0 | C | V |
|---|---|---|---|---|---|
| 7F | |||||
| 01 | |||||
| FF | |||||
| 80 | |||||
| 00 |
Reset again with KEY0. Set the switches to each value below and release KEY1 once per row.
| SW7–0 | A | S | LEDR7–0 | C | V |
|---|---|---|---|---|---|
| FF | |||||
| 01 | |||||
| 00 |
On which release does unsigned addition wrap to zero without signed overflow? Hand in both traces and explain why the preview LEDs sometimes disagree with the stored sum.
Original LabsLand activity following FPGAcademy Digital Logic Lab 6, Part I. Verilog PDF · VHDL PDF · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
An eight-bit sum has two interpretations. After adding 1 to 7F hexadecimal, what would an unsigned observer say happened? What would someone reading signed two’s-complement numbers say? Build an accumulator that reports both answers.
Trace the registers
HEX3…2 shows the captured operand A. HEX1…0 shows the accumulated value S. The eight rightmost red LEDs preview the sum of those two registers. When you release KEY1, the board saves that sum into S and samples SW7…0 as the next A. At the same instant, LEDR8 remembers the carry and LEDR9 remembers the signed overflow from the sum just saved.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/signed_accumulator.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
signed_accumulator. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/signed_accumulator.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
The starter wires the same flag into carry and overflow. Derive when two positive operands can produce a negative result and when two negative operands can produce a positive result. Correct the overflow register.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The testbench tries every pair of eight-bit values. It checks carry using the unsigned sum, then checks whether the signed sum fits in eight bits. It also checks all four display digits. Run the starter, record the first pair that fails, and repeat after your correction.
SystemVerilog
iverilog -g2012 -s test_accumulator -o bench starter/signed_accumulator.sv simulation/test_accumulator.v
vvp bench
Work through two sums on the board
Synthesize and upload. Press and release KEY0 to reset both registers and flags. Enter 7F on the switches. Before touching KEY1, check whether either register changed. For each row below, set the switches, press and release KEY1 once, then read the board. Record A, S and the preview on LEDR7–0 in hexadecimal. For carry (C, LEDR8) and signed overflow (V, LEDR9), write 1 for lit or 0 for dark.
| SW7–0 | A | S | LEDR7–0 | C | V |
|---|---|---|---|---|---|
| 7F | |||||
| 01 | |||||
| FF | |||||
| 80 | |||||
| 00 |
Reset again with KEY0. Set the switches to each value below and release KEY1 once per row.
| SW7–0 | A | S | LEDR7–0 | C | V |
|---|---|---|---|---|---|
| FF | |||||
| 01 | |||||
| 00 |
On which release does unsigned addition wrap to zero without signed overflow? Hand in both traces and explain why the preview LEDs sometimes disagree with the stored sum.
Original LabsLand activity following FPGAcademy Digital Logic Lab 6, Part I. Verilog PDF · VHDL PDF · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Use SW8 to choose addition (0) or subtraction (1). In subtraction mode the circuit computes S − A. The operand A is the value captured at the previous clock edge. A byte waiting on the switches enters the calculation one edge later.
Predict the carry input
Write 0 − 2 with eight bits using an adder. Which byte replaces the subtracted operand? What must enter the least significant carry input? For unsigned subtraction, a final carry of one means that no borrow was needed.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
add_sub_accumulator, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
The starter complements A when SW8 is high. Complete the carry input so the adder computes both operations. Check the flags: LEDR8 and LEDR9 hold the previous operation’s carry and signed overflow. LEDR7…0 previews the next operation.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The testbench tries every pair of eight-bit values in addition and subtraction. For subtraction, carry is 1 when the unsigned difference needs no borrow. Overflow tells you whether the signed result fits in eight bits. Run the starter, record the first failing operation and its operands, and repeat after your correction.
Verilog
iverilog -g2005 -s test_accumulator -o bench starter/add_sub_accumulator.v simulation/test_accumulator.v
vvp bench
Separate a mode change from a clock edge
Synthesize, upload and reset with KEY0. With SW8 low, enter 02 and press and release KEY1. HEX3…2 now shows A; HEX1…0 shows S. Change the switches to 01 and raise SW8 without touching KEY1. Predict the low LEDs and both register pairs before reading the camera.
| Action | A | S | Preview LEDs (hex) | Carry | Overflow |
|---|---|---|---|---|---|
| Select subtraction without clocking | |||||
| Release KEY1 with 01 on SW7…0 | |||||
| Release KEY1 with 00 on SW7…0 |
Reset and switch back to addition. Clock in 80 and then 01. With the mode now set to subtraction, clock in 00. Explain the flags for 80 − 01 using both signed and unsigned interpretations. Submit the table and your explanation.
Original LabsLand activity following FPGAcademy Digital Logic Lab 6, Part II. Verilog PDF · VHDL PDF · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Use SW8 to choose addition (0) or subtraction (1). In subtraction mode the circuit computes S − A. The operand A is the value captured at the previous clock edge. A byte waiting on the switches enters the calculation one edge later.
Predict the carry input
Write 0 − 2 with eight bits using an adder. Which byte replaces the subtracted operand? What must enter the least significant carry input? For unsigned subtraction, a final carry of one means that no borrow was needed.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/add_sub_accumulator.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
add_sub_accumulator. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/add_sub_accumulator.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
The starter complements A when SW8 is high. Complete the carry input so the adder computes both operations. Check the flags: LEDR8 and LEDR9 hold the previous operation’s carry and signed overflow. LEDR7…0 previews the next operation.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The testbench tries every pair of eight-bit values in addition and subtraction. For subtraction, carry is 1 when the unsigned difference needs no borrow. Overflow tells you whether the signed result fits in eight bits. Run the starter, record the first failing operation and its operands, and repeat after your correction.
Verilog
iverilog -g2005 -s test_accumulator -o bench starter/add_sub_accumulator.v simulation/test_accumulator.v
vvp bench
Separate a mode change from a clock edge
Synthesize, upload and reset with KEY0. With SW8 low, enter 02 and press and release KEY1. HEX3…2 now shows A; HEX1…0 shows S. Change the switches to 01 and raise SW8 without touching KEY1. Predict the low LEDs and both register pairs before reading the camera.
| Action | A | S | Preview LEDs (hex) | Carry | Overflow |
|---|---|---|---|---|---|
| Select subtraction without clocking | |||||
| Release KEY1 with 01 on SW7…0 | |||||
| Release KEY1 with 00 on SW7…0 |
Reset and switch back to addition. Clock in 80 and then 01. With the mode now set to subtraction, clock in 00. Explain the flags for 80 − 01 using both signed and unsigned interpretations. Submit the table and your explanation.
Original LabsLand activity following FPGAcademy Digital Logic Lab 6, Part II. Verilog PDF · VHDL PDF · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Use SW8 to choose addition (0) or subtraction (1). In subtraction mode the circuit computes S − A. The operand A is the value captured at the previous clock edge. A byte waiting on the switches enters the calculation one edge later.
Predict the carry input
Write 0 − 2 with eight bits using an adder. Which byte replaces the subtracted operand? What must enter the least significant carry input? For unsigned subtraction, a final carry of one means that no borrow was needed.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
add_sub_accumulator, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
The starter complements A when SW8 is high. Complete the carry input so the adder computes both operations. Check the flags: LEDR8 and LEDR9 hold the previous operation’s carry and signed overflow. LEDR7…0 previews the next operation.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The testbench tries every pair of eight-bit values in addition and subtraction. For subtraction, carry is 1 when the unsigned difference needs no borrow. Overflow tells you whether the signed result fits in eight bits. Run the starter, record the first failing operation and its operands, and repeat after your correction.
VHDL
nvc --std=2008 -a starter/add_sub_accumulator.vhd simulation/test_accumulator.vhd
nvc --std=2008 -e test_accumulator
nvc --std=2008 -r test_accumulator
Separate a mode change from a clock edge
Synthesize, upload and reset with KEY0. With SW8 low, enter 02 and press and release KEY1. HEX3…2 now shows A; HEX1…0 shows S. Change the switches to 01 and raise SW8 without touching KEY1. Predict the low LEDs and both register pairs before reading the camera.
| Action | A | S | Preview LEDs (hex) | Carry | Overflow |
|---|---|---|---|---|---|
| Select subtraction without clocking | |||||
| Release KEY1 with 01 on SW7…0 | |||||
| Release KEY1 with 00 on SW7…0 |
Reset and switch back to addition. Clock in 80 and then 01. With the mode now set to subtraction, clock in 00. Explain the flags for 80 − 01 using both signed and unsigned interpretations. Submit the table and your explanation.
Original LabsLand activity following FPGAcademy Digital Logic Lab 6, Part II. Verilog PDF · VHDL PDF · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Use SW8 to choose addition (0) or subtraction (1). In subtraction mode the circuit computes S − A. The operand A is the value captured at the previous clock edge. A byte waiting on the switches enters the calculation one edge later.
Predict the carry input
Write 0 − 2 with eight bits using an adder. Which byte replaces the subtracted operand? What must enter the least significant carry input? For unsigned subtraction, a final carry of one means that no borrow was needed.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/add_sub_accumulator.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
add_sub_accumulator. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/add_sub_accumulator.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
The starter complements A when SW8 is high. Complete the carry input so the adder computes both operations. Check the flags: LEDR8 and LEDR9 hold the previous operation’s carry and signed overflow. LEDR7…0 previews the next operation.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The testbench tries every pair of eight-bit values in addition and subtraction. For subtraction, carry is 1 when the unsigned difference needs no borrow. Overflow tells you whether the signed result fits in eight bits. Run the starter, record the first failing operation and its operands, and repeat after your correction.
VHDL
nvc --std=2008 -a starter/add_sub_accumulator.vhd simulation/test_accumulator.vhd
nvc --std=2008 -e test_accumulator
nvc --std=2008 -r test_accumulator
Separate a mode change from a clock edge
Synthesize, upload and reset with KEY0. With SW8 low, enter 02 and press and release KEY1. HEX3…2 now shows A; HEX1…0 shows S. Change the switches to 01 and raise SW8 without touching KEY1. Predict the low LEDs and both register pairs before reading the camera.
| Action | A | S | Preview LEDs (hex) | Carry | Overflow |
|---|---|---|---|---|---|
| Select subtraction without clocking | |||||
| Release KEY1 with 01 on SW7…0 | |||||
| Release KEY1 with 00 on SW7…0 |
Reset and switch back to addition. Clock in 80 and then 01. With the mode now set to subtraction, clock in 00. Explain the flags for 80 − 01 using both signed and unsigned interpretations. Submit the table and your explanation.
Original LabsLand activity following FPGAcademy Digital Logic Lab 6, Part II. Verilog PDF · VHDL PDF · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Use SW8 to choose addition (0) or subtraction (1). In subtraction mode the circuit computes S − A. The operand A is the value captured at the previous clock edge. A byte waiting on the switches enters the calculation one edge later.
Predict the carry input
Write 0 − 2 with eight bits using an adder. Which byte replaces the subtracted operand? What must enter the least significant carry input? For unsigned subtraction, a final carry of one means that no borrow was needed.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
add_sub_accumulator, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
The starter complements A when SW8 is high. Complete the carry input so the adder computes both operations. Check the flags: LEDR8 and LEDR9 hold the previous operation’s carry and signed overflow. LEDR7…0 previews the next operation.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The testbench tries every pair of eight-bit values in addition and subtraction. For subtraction, carry is 1 when the unsigned difference needs no borrow. Overflow tells you whether the signed result fits in eight bits. Run the starter, record the first failing operation and its operands, and repeat after your correction.
SystemVerilog
iverilog -g2012 -s test_accumulator -o bench starter/add_sub_accumulator.sv simulation/test_accumulator.v
vvp bench
Separate a mode change from a clock edge
Synthesize, upload and reset with KEY0. With SW8 low, enter 02 and press and release KEY1. HEX3…2 now shows A; HEX1…0 shows S. Change the switches to 01 and raise SW8 without touching KEY1. Predict the low LEDs and both register pairs before reading the camera.
| Action | A | S | Preview LEDs (hex) | Carry | Overflow |
|---|---|---|---|---|---|
| Select subtraction without clocking | |||||
| Release KEY1 with 01 on SW7…0 | |||||
| Release KEY1 with 00 on SW7…0 |
Reset and switch back to addition. Clock in 80 and then 01. With the mode now set to subtraction, clock in 00. Explain the flags for 80 − 01 using both signed and unsigned interpretations. Submit the table and your explanation.
Original LabsLand activity following FPGAcademy Digital Logic Lab 6, Part II. Verilog PDF · VHDL PDF · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Use SW8 to choose addition (0) or subtraction (1). In subtraction mode the circuit computes S − A. The operand A is the value captured at the previous clock edge. A byte waiting on the switches enters the calculation one edge later.
Predict the carry input
Write 0 − 2 with eight bits using an adder. Which byte replaces the subtracted operand? What must enter the least significant carry input? For unsigned subtraction, a final carry of one means that no borrow was needed.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/add_sub_accumulator.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
add_sub_accumulator. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/add_sub_accumulator.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
The starter complements A when SW8 is high. Complete the carry input so the adder computes both operations. Check the flags: LEDR8 and LEDR9 hold the previous operation’s carry and signed overflow. LEDR7…0 previews the next operation.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The testbench tries every pair of eight-bit values in addition and subtraction. For subtraction, carry is 1 when the unsigned difference needs no borrow. Overflow tells you whether the signed result fits in eight bits. Run the starter, record the first failing operation and its operands, and repeat after your correction.
SystemVerilog
iverilog -g2012 -s test_accumulator -o bench starter/add_sub_accumulator.sv simulation/test_accumulator.v
vvp bench
Separate a mode change from a clock edge
Synthesize, upload and reset with KEY0. With SW8 low, enter 02 and press and release KEY1. HEX3…2 now shows A; HEX1…0 shows S. Change the switches to 01 and raise SW8 without touching KEY1. Predict the low LEDs and both register pairs before reading the camera.
| Action | A | S | Preview LEDs (hex) | Carry | Overflow |
|---|---|---|---|---|---|
| Select subtraction without clocking | |||||
| Release KEY1 with 01 on SW7…0 | |||||
| Release KEY1 with 00 on SW7…0 |
Reset and switch back to addition. Clock in 80 and then 01. With the mode now set to subtraction, clock in 00. Explain the flags for 80 − 01 using both signed and unsigned interpretations. Submit the table and your explanation.
Original LabsLand activity following FPGAcademy Digital Logic Lab 6, Part II. Verilog PDF · VHDL PDF · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Set A on switches SW7 through SW4 and B on SW3 through SW0. Each group represents one hexadecimal digit. Your circuit will show their product on the two leftmost displays. A single hexadecimal digit represents values up to 15. What is the largest product, and how many binary digits does it need?
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
array_product, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Locate the row selected by bit 2 of B. When A is 3, that row should contribute either 0 or 12. Draw its eight columns and fix the alignment of the partial product before it enters the row of full adders. Keep the sum and carry wiring. Use the same rule for all four rows.
Check all inputs
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The testbench checks all six display outputs against arithmetic multiplication for all 1,024 switch settings. Try the starter, record the first pair that fails, and repeat after aligning the rows.
Verilog
iverilog -g2005 -s test_array -o bench starter/array_product.v simulation/test_array.v
vvp bench
Read your multiplier
Upload your repaired design and set the input pairs from the table. Look at HEX5 and HEX4 for the product, HEX2 for A and HEX0 for B. HEX3 and HEX1 separate the readings. Hexadecimal b and d appear in lowercase on the physical displays.
| A | B | Predicted product (hex) | Product on HEX5…4 |
|---|---|---|---|
| 3 | 1 | ||
| 3 | 2 | ||
| 3 | 6 | ||
| b | C | ||
| C | b | ||
| F | F |
For 3 × 6, identify the two rows that contribute. Swap the inputs of b × C and compare both the displayed product and your sketch of the active rows. Try changing SW8 and SW9 while the other switches stay still. Submit the table, one observed carry into the upper digit, and your sketch.
Original LabsLand activity following FPGAcademy Digital Logic Lab 6, Part III. Verilog handout · VHDL handout · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Set A on switches SW7 through SW4 and B on SW3 through SW0. Each group represents one hexadecimal digit. Your circuit will show their product on the two leftmost displays. A single hexadecimal digit represents values up to 15. What is the largest product, and how many binary digits does it need?
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/array_product.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
array_product. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/array_product.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Locate the row selected by bit 2 of B. When A is 3, that row should contribute either 0 or 12. Draw its eight columns and fix the alignment of the partial product before it enters the row of full adders. Keep the sum and carry wiring. Use the same rule for all four rows.
Check all inputs
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The testbench checks all six display outputs against arithmetic multiplication for all 1,024 switch settings. Try the starter, record the first pair that fails, and repeat after aligning the rows.
Verilog
iverilog -g2005 -s test_array -o bench starter/array_product.v simulation/test_array.v
vvp bench
Read your multiplier
Upload your repaired design and set the input pairs from the table. Look at HEX5 and HEX4 for the product, HEX2 for A and HEX0 for B. HEX3 and HEX1 separate the readings. Hexadecimal b and d appear in lowercase on the physical displays.
| A | B | Predicted product (hex) | Product on HEX5…4 |
|---|---|---|---|
| 3 | 1 | ||
| 3 | 2 | ||
| 3 | 6 | ||
| b | C | ||
| C | b | ||
| F | F |
For 3 × 6, identify the two rows that contribute. Swap the inputs of b × C and compare both the displayed product and your sketch of the active rows. Try changing SW8 and SW9 while the other switches stay still. Submit the table, one observed carry into the upper digit, and your sketch.
Original LabsLand activity following FPGAcademy Digital Logic Lab 6, Part III. Verilog handout · VHDL handout · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Set A on switches SW7 through SW4 and B on SW3 through SW0. Each group represents one hexadecimal digit. Your circuit will show their product on the two leftmost displays. A single hexadecimal digit represents values up to 15. What is the largest product, and how many binary digits does it need?
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
array_product, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Locate the row selected by bit 2 of B. When A is 3, that row should contribute either 0 or 12. Draw its eight columns and fix the alignment of the partial product before it enters the row of full adders. Keep the sum and carry wiring. Use the same rule for all four rows.
Check all inputs
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The testbench checks all six display outputs against arithmetic multiplication for all 1,024 switch settings. Try the starter, record the first pair that fails, and repeat after aligning the rows.
VHDL
nvc --std=2008 -a starter/array_product.vhd simulation/test_array.vhd
nvc --std=2008 -e test_array
nvc --std=2008 -r test_array
Read your multiplier
Upload your repaired design and set the input pairs from the table. Look at HEX5 and HEX4 for the product, HEX2 for A and HEX0 for B. HEX3 and HEX1 separate the readings. Hexadecimal b and d appear in lowercase on the physical displays.
| A | B | Predicted product (hex) | Product on HEX5…4 |
|---|---|---|---|
| 3 | 1 | ||
| 3 | 2 | ||
| 3 | 6 | ||
| b | C | ||
| C | b | ||
| F | F |
For 3 × 6, identify the two rows that contribute. Swap the inputs of b × C and compare both the displayed product and your sketch of the active rows. Try changing SW8 and SW9 while the other switches stay still. Submit the table, one observed carry into the upper digit, and your sketch.
Original LabsLand activity following FPGAcademy Digital Logic Lab 6, Part III. Verilog handout · VHDL handout · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Set A on switches SW7 through SW4 and B on SW3 through SW0. Each group represents one hexadecimal digit. Your circuit will show their product on the two leftmost displays. A single hexadecimal digit represents values up to 15. What is the largest product, and how many binary digits does it need?
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/array_product.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
array_product. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/array_product.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Locate the row selected by bit 2 of B. When A is 3, that row should contribute either 0 or 12. Draw its eight columns and fix the alignment of the partial product before it enters the row of full adders. Keep the sum and carry wiring. Use the same rule for all four rows.
Check all inputs
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The testbench checks all six display outputs against arithmetic multiplication for all 1,024 switch settings. Try the starter, record the first pair that fails, and repeat after aligning the rows.
VHDL
nvc --std=2008 -a starter/array_product.vhd simulation/test_array.vhd
nvc --std=2008 -e test_array
nvc --std=2008 -r test_array
Read your multiplier
Upload your repaired design and set the input pairs from the table. Look at HEX5 and HEX4 for the product, HEX2 for A and HEX0 for B. HEX3 and HEX1 separate the readings. Hexadecimal b and d appear in lowercase on the physical displays.
| A | B | Predicted product (hex) | Product on HEX5…4 |
|---|---|---|---|
| 3 | 1 | ||
| 3 | 2 | ||
| 3 | 6 | ||
| b | C | ||
| C | b | ||
| F | F |
For 3 × 6, identify the two rows that contribute. Swap the inputs of b × C and compare both the displayed product and your sketch of the active rows. Try changing SW8 and SW9 while the other switches stay still. Submit the table, one observed carry into the upper digit, and your sketch.
Original LabsLand activity following FPGAcademy Digital Logic Lab 6, Part III. Verilog handout · VHDL handout · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Set A on switches SW7 through SW4 and B on SW3 through SW0. Each group represents one hexadecimal digit. Your circuit will show their product on the two leftmost displays. A single hexadecimal digit represents values up to 15. What is the largest product, and how many binary digits does it need?
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
array_product, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Locate the row selected by bit 2 of B. When A is 3, that row should contribute either 0 or 12. Draw its eight columns and fix the alignment of the partial product before it enters the row of full adders. Keep the sum and carry wiring. Use the same rule for all four rows.
Check all inputs
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The testbench checks all six display outputs against arithmetic multiplication for all 1,024 switch settings. Try the starter, record the first pair that fails, and repeat after aligning the rows.
SystemVerilog
iverilog -g2012 -s test_array -o bench starter/array_product.sv simulation/test_array.v
vvp bench
Read your multiplier
Upload your repaired design and set the input pairs from the table. Look at HEX5 and HEX4 for the product, HEX2 for A and HEX0 for B. HEX3 and HEX1 separate the readings. Hexadecimal b and d appear in lowercase on the physical displays.
| A | B | Predicted product (hex) | Product on HEX5…4 |
|---|---|---|---|
| 3 | 1 | ||
| 3 | 2 | ||
| 3 | 6 | ||
| b | C | ||
| C | b | ||
| F | F |
For 3 × 6, identify the two rows that contribute. Swap the inputs of b × C and compare both the displayed product and your sketch of the active rows. Try changing SW8 and SW9 while the other switches stay still. Submit the table, one observed carry into the upper digit, and your sketch.
Original LabsLand activity following FPGAcademy Digital Logic Lab 6, Part III. Verilog handout · VHDL handout · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Set A on switches SW7 through SW4 and B on SW3 through SW0. Each group represents one hexadecimal digit. Your circuit will show their product on the two leftmost displays. A single hexadecimal digit represents values up to 15. What is the largest product, and how many binary digits does it need?
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/array_product.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
array_product. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/array_product.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Locate the row selected by bit 2 of B. When A is 3, that row should contribute either 0 or 12. Draw its eight columns and fix the alignment of the partial product before it enters the row of full adders. Keep the sum and carry wiring. Use the same rule for all four rows.
Check all inputs
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The testbench checks all six display outputs against arithmetic multiplication for all 1,024 switch settings. Try the starter, record the first pair that fails, and repeat after aligning the rows.
SystemVerilog
iverilog -g2012 -s test_array -o bench starter/array_product.sv simulation/test_array.v
vvp bench
Read your multiplier
Upload your repaired design and set the input pairs from the table. Look at HEX5 and HEX4 for the product, HEX2 for A and HEX0 for B. HEX3 and HEX1 separate the readings. Hexadecimal b and d appear in lowercase on the physical displays.
| A | B | Predicted product (hex) | Product on HEX5…4 |
|---|---|---|---|
| 3 | 1 | ||
| 3 | 2 | ||
| 3 | 6 | ||
| b | C | ||
| C | b | ||
| F | F |
For 3 × 6, identify the two rows that contribute. Swap the inputs of b × C and compare both the displayed product and your sketch of the active rows. Try changing SW8 and SW9 while the other switches stay still. Submit the table, one observed carry into the upper digit, and your sketch.
Original LabsLand activity following FPGAcademy Digital Logic Lab 6, Part III. Verilog handout · VHDL handout · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Use eight shifted rows to multiply unsigned bytes. Separate enables let you enter two operands through one switch bank. The four displays show a registered 16-bit product. They reveal which input values were in the registers immediately before the last clock edge.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
registered_product, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Draw the row generated by B bit 7 when A is FF. Compare it with the row for bit 0. Inspect the eight additions and find the final connection that drops the highest partial product. Write your correction without using a multiplication operator in the circuit. SW9 enables register A, SW8 enables register B, and SW7–0 supply the byte. LED7–0 read back A when SW9 is high, otherwise B when SW8 is high. With neither enabled they are dark.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench checks 65,536 operand pairs, separate and simultaneous operand loads, registered output latency and the clocked reset. It calculates expected products independently using integer multiplication. Record the first pair for which the starter fails.
Verilog
iverilog -g2005 -s test_product -o bench starter/registered_product.v simulation/test_product.v
vvp bench
Take one clock edge at a time
Synthesize and upload. With both enables on and the data switches at 00, press and release KEY1 twice. This initializes both operands and then clocks their zero product into the output. In simulation also try holding the active-low KEY0 reset while a KEY1 rising edge occurs.
Work down the table in order. The first two bits are SW9 and SW8. The byte after the dot is the hexadecimal value on SW7–0. Press and release KEY1 once in each row except “No pulse”. After each action, record LED7–0 and HEX3–0 in hexadecimal. Before each pulse, predict which two stored operands the output register will multiply.
| SW9–8 · SW7–0 | KEY1 | LED7–0 | HEX3–0 |
|---|---|---|---|
| 10 · 12 | Load A | ||
| 01 · 34 | Load B | ||
| 00 · 34 | Hold A and B | ||
| 10 · FF | No pulse | ||
| 10 · FF | Load A | ||
| 01 · 80 | Load B | ||
| 01 · 80 | Repeat | ||
| 11 · FF | Load A and B | ||
| 00 · 00 | Hold A and B | ||
| 11 · 00 | Load A and B | ||
| 00 · 00 | Hold A and B |
Explain why FF × 80 exposes an omitted row even if a small product is correct. Identify one clock edge where the LEDs already show the new B while the displays still show the product from the old B. Submit your readings, your circuit change and a sketch of the adder structure.
Original LabsLand activity following FPGAcademy Digital Logic Lab 6, Part IV. verilog PDF · vhdl PDF · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Use eight shifted rows to multiply unsigned bytes. Separate enables let you enter two operands through one switch bank. The four displays show a registered 16-bit product. They reveal which input values were in the registers immediately before the last clock edge.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/registered_product.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
registered_product. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/registered_product.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Draw the row generated by B bit 7 when A is FF. Compare it with the row for bit 0. Inspect the eight additions and find the final connection that drops the highest partial product. Write your correction without using a multiplication operator in the circuit. SW9 enables register A, SW8 enables register B, and SW7–0 supply the byte. LED7–0 read back A when SW9 is high, otherwise B when SW8 is high. With neither enabled they are dark.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench checks 65,536 operand pairs, separate and simultaneous operand loads, registered output latency and the clocked reset. It calculates expected products independently using integer multiplication. Record the first pair for which the starter fails.
Verilog
iverilog -g2005 -s test_product -o bench starter/registered_product.v simulation/test_product.v
vvp bench
Take one clock edge at a time
Synthesize and upload. With both enables on and the data switches at 00, press and release KEY1 twice. This initializes both operands and then clocks their zero product into the output. In simulation also try holding the active-low KEY0 reset while a KEY1 rising edge occurs.
Work down the table in order. The first two bits are SW9 and SW8. The byte after the dot is the hexadecimal value on SW7–0. Press and release KEY1 once in each row except “No pulse”. After each action, record LED7–0 and HEX3–0 in hexadecimal. Before each pulse, predict which two stored operands the output register will multiply.
| SW9–8 · SW7–0 | KEY1 | LED7–0 | HEX3–0 |
|---|---|---|---|
| 10 · 12 | Load A | ||
| 01 · 34 | Load B | ||
| 00 · 34 | Hold A and B | ||
| 10 · FF | No pulse | ||
| 10 · FF | Load A | ||
| 01 · 80 | Load B | ||
| 01 · 80 | Repeat | ||
| 11 · FF | Load A and B | ||
| 00 · 00 | Hold A and B | ||
| 11 · 00 | Load A and B | ||
| 00 · 00 | Hold A and B |
Explain why FF × 80 exposes an omitted row even if a small product is correct. Identify one clock edge where the LEDs already show the new B while the displays still show the product from the old B. Submit your readings, your circuit change and a sketch of the adder structure.
Original LabsLand activity following FPGAcademy Digital Logic Lab 6, Part IV. verilog PDF · vhdl PDF · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Use eight shifted rows to multiply unsigned bytes. Separate enables let you enter two operands through one switch bank. The four displays show a registered 16-bit product. They reveal which input values were in the registers immediately before the last clock edge.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
registered_product, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Draw the row generated by B bit 7 when A is FF. Compare it with the row for bit 0. Inspect the eight additions and find the final connection that drops the highest partial product. Write your correction without using a multiplication operator in the circuit. SW9 enables register A, SW8 enables register B, and SW7–0 supply the byte. LED7–0 read back A when SW9 is high, otherwise B when SW8 is high. With neither enabled they are dark.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench checks 65,536 operand pairs, separate and simultaneous operand loads, registered output latency and the clocked reset. It calculates expected products independently using integer multiplication. Record the first pair for which the starter fails.
VHDL
nvc --std=2008 -a starter/registered_product.vhd simulation/test_product.vhd
nvc --std=2008 -e test_product
nvc --std=2008 -r test_product
Take one clock edge at a time
Synthesize and upload. With both enables on and the data switches at 00, press and release KEY1 twice. This initializes both operands and then clocks their zero product into the output. In simulation also try holding the active-low KEY0 reset while a KEY1 rising edge occurs.
Work down the table in order. The first two bits are SW9 and SW8. The byte after the dot is the hexadecimal value on SW7–0. Press and release KEY1 once in each row except “No pulse”. After each action, record LED7–0 and HEX3–0 in hexadecimal. Before each pulse, predict which two stored operands the output register will multiply.
| SW9–8 · SW7–0 | KEY1 | LED7–0 | HEX3–0 |
|---|---|---|---|
| 10 · 12 | Load A | ||
| 01 · 34 | Load B | ||
| 00 · 34 | Hold A and B | ||
| 10 · FF | No pulse | ||
| 10 · FF | Load A | ||
| 01 · 80 | Load B | ||
| 01 · 80 | Repeat | ||
| 11 · FF | Load A and B | ||
| 00 · 00 | Hold A and B | ||
| 11 · 00 | Load A and B | ||
| 00 · 00 | Hold A and B |
Explain why FF × 80 exposes an omitted row even if a small product is correct. Identify one clock edge where the LEDs already show the new B while the displays still show the product from the old B. Submit your readings, your circuit change and a sketch of the adder structure.
Original LabsLand activity following FPGAcademy Digital Logic Lab 6, Part IV. verilog PDF · vhdl PDF · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Use eight shifted rows to multiply unsigned bytes. Separate enables let you enter two operands through one switch bank. The four displays show a registered 16-bit product. They reveal which input values were in the registers immediately before the last clock edge.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/registered_product.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
registered_product. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/registered_product.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Draw the row generated by B bit 7 when A is FF. Compare it with the row for bit 0. Inspect the eight additions and find the final connection that drops the highest partial product. Write your correction without using a multiplication operator in the circuit. SW9 enables register A, SW8 enables register B, and SW7–0 supply the byte. LED7–0 read back A when SW9 is high, otherwise B when SW8 is high. With neither enabled they are dark.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench checks 65,536 operand pairs, separate and simultaneous operand loads, registered output latency and the clocked reset. It calculates expected products independently using integer multiplication. Record the first pair for which the starter fails.
VHDL
nvc --std=2008 -a starter/registered_product.vhd simulation/test_product.vhd
nvc --std=2008 -e test_product
nvc --std=2008 -r test_product
Take one clock edge at a time
Synthesize and upload. With both enables on and the data switches at 00, press and release KEY1 twice. This initializes both operands and then clocks their zero product into the output. In simulation also try holding the active-low KEY0 reset while a KEY1 rising edge occurs.
Work down the table in order. The first two bits are SW9 and SW8. The byte after the dot is the hexadecimal value on SW7–0. Press and release KEY1 once in each row except “No pulse”. After each action, record LED7–0 and HEX3–0 in hexadecimal. Before each pulse, predict which two stored operands the output register will multiply.
| SW9–8 · SW7–0 | KEY1 | LED7–0 | HEX3–0 |
|---|---|---|---|
| 10 · 12 | Load A | ||
| 01 · 34 | Load B | ||
| 00 · 34 | Hold A and B | ||
| 10 · FF | No pulse | ||
| 10 · FF | Load A | ||
| 01 · 80 | Load B | ||
| 01 · 80 | Repeat | ||
| 11 · FF | Load A and B | ||
| 00 · 00 | Hold A and B | ||
| 11 · 00 | Load A and B | ||
| 00 · 00 | Hold A and B |
Explain why FF × 80 exposes an omitted row even if a small product is correct. Identify one clock edge where the LEDs already show the new B while the displays still show the product from the old B. Submit your readings, your circuit change and a sketch of the adder structure.
Original LabsLand activity following FPGAcademy Digital Logic Lab 6, Part IV. verilog PDF · vhdl PDF · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Use eight shifted rows to multiply unsigned bytes. Separate enables let you enter two operands through one switch bank. The four displays show a registered 16-bit product. They reveal which input values were in the registers immediately before the last clock edge.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
registered_product, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Draw the row generated by B bit 7 when A is FF. Compare it with the row for bit 0. Inspect the eight additions and find the final connection that drops the highest partial product. Write your correction without using a multiplication operator in the circuit. SW9 enables register A, SW8 enables register B, and SW7–0 supply the byte. LED7–0 read back A when SW9 is high, otherwise B when SW8 is high. With neither enabled they are dark.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench checks 65,536 operand pairs, separate and simultaneous operand loads, registered output latency and the clocked reset. It calculates expected products independently using integer multiplication. Record the first pair for which the starter fails.
SystemVerilog
iverilog -g2012 -s test_product -o bench starter/registered_product.sv simulation/test_product.v
vvp bench
Take one clock edge at a time
Synthesize and upload. With both enables on and the data switches at 00, press and release KEY1 twice. This initializes both operands and then clocks their zero product into the output. In simulation also try holding the active-low KEY0 reset while a KEY1 rising edge occurs.
Work down the table in order. The first two bits are SW9 and SW8. The byte after the dot is the hexadecimal value on SW7–0. Press and release KEY1 once in each row except “No pulse”. After each action, record LED7–0 and HEX3–0 in hexadecimal. Before each pulse, predict which two stored operands the output register will multiply.
| SW9–8 · SW7–0 | KEY1 | LED7–0 | HEX3–0 |
|---|---|---|---|
| 10 · 12 | Load A | ||
| 01 · 34 | Load B | ||
| 00 · 34 | Hold A and B | ||
| 10 · FF | No pulse | ||
| 10 · FF | Load A | ||
| 01 · 80 | Load B | ||
| 01 · 80 | Repeat | ||
| 11 · FF | Load A and B | ||
| 00 · 00 | Hold A and B | ||
| 11 · 00 | Load A and B | ||
| 00 · 00 | Hold A and B |
Explain why FF × 80 exposes an omitted row even if a small product is correct. Identify one clock edge where the LEDs already show the new B while the displays still show the product from the old B. Submit your readings, your circuit change and a sketch of the adder structure.
Original LabsLand activity following FPGAcademy Digital Logic Lab 6, Part IV. verilog PDF · vhdl PDF · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Use eight shifted rows to multiply unsigned bytes. Separate enables let you enter two operands through one switch bank. The four displays show a registered 16-bit product. They reveal which input values were in the registers immediately before the last clock edge.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/registered_product.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
registered_product. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/registered_product.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Draw the row generated by B bit 7 when A is FF. Compare it with the row for bit 0. Inspect the eight additions and find the final connection that drops the highest partial product. Write your correction without using a multiplication operator in the circuit. SW9 enables register A, SW8 enables register B, and SW7–0 supply the byte. LED7–0 read back A when SW9 is high, otherwise B when SW8 is high. With neither enabled they are dark.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench checks 65,536 operand pairs, separate and simultaneous operand loads, registered output latency and the clocked reset. It calculates expected products independently using integer multiplication. Record the first pair for which the starter fails.
SystemVerilog
iverilog -g2012 -s test_product -o bench starter/registered_product.sv simulation/test_product.v
vvp bench
Take one clock edge at a time
Synthesize and upload. With both enables on and the data switches at 00, press and release KEY1 twice. This initializes both operands and then clocks their zero product into the output. In simulation also try holding the active-low KEY0 reset while a KEY1 rising edge occurs.
Work down the table in order. The first two bits are SW9 and SW8. The byte after the dot is the hexadecimal value on SW7–0. Press and release KEY1 once in each row except “No pulse”. After each action, record LED7–0 and HEX3–0 in hexadecimal. Before each pulse, predict which two stored operands the output register will multiply.
| SW9–8 · SW7–0 | KEY1 | LED7–0 | HEX3–0 |
|---|---|---|---|
| 10 · 12 | Load A | ||
| 01 · 34 | Load B | ||
| 00 · 34 | Hold A and B | ||
| 10 · FF | No pulse | ||
| 10 · FF | Load A | ||
| 01 · 80 | Load B | ||
| 01 · 80 | Repeat | ||
| 11 · FF | Load A and B | ||
| 00 · 00 | Hold A and B | ||
| 11 · 00 | Load A and B | ||
| 00 · 00 | Hold A and B |
Explain why FF × 80 exposes an omitted row even if a small product is correct. Identify one clock edge where the LEDs already show the new B while the displays still show the product from the old B. Submit your readings, your circuit change and a sketch of the adder structure.
Original LabsLand activity following FPGAcademy Digital Logic Lab 6, Part IV. verilog PDF · vhdl PDF · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
A balanced tree adds eight partial products in three levels. Its input and output registers have the same behavior as the serial adder chain. You will test whether every row reaches the output and distinguish the number of adder levels from the number of clock edges.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
tree_product, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Draw the four first-level pairs, two second-level sums and final addition. Label which multiplier bits contribute to each half of the final result. Locate the starter expression that uses one of those halves twice. Write your correction without using a multiplication operator in the circuit. SW9 enables register A, SW8 enables register B, and SW7–0 supply the byte. LED7–0 read back A when SW9 is high, otherwise B when SW8 is high. With neither enabled they are dark.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench checks 65,536 operand pairs, separate and simultaneous operand loads, registered output latency and the clocked reset. It calculates expected products independently using integer multiplication. Record the first pair for which the starter fails.
Verilog
iverilog -g2005 -s test_product -o bench starter/tree_product.v simulation/test_product.v
vvp bench
Take one clock edge at a time
Synthesize and upload. With both enables on and the data switches at 00, press and release KEY1 twice. This initializes both operands and then clocks their zero product into the output. In simulation also try holding the active-low KEY0 reset while a KEY1 rising edge occurs.
Work down the table in order. The first two bits are SW9 and SW8. The byte after the dot is the hexadecimal value on SW7–0. Press and release KEY1 once in each row except “No pulse”. After each action, record LED7–0 and HEX3–0 in hexadecimal. Before each pulse, predict which two stored operands the output register will multiply.
| SW9–8 · SW7–0 | KEY1 | LED7–0 | HEX3–0 |
|---|---|---|---|
| 10 · 12 | Load A | ||
| 01 · 34 | Load B | ||
| 00 · 34 | Hold A and B | ||
| 10 · FF | No pulse | ||
| 10 · FF | Load A | ||
| 01 · 80 | Load B | ||
| 01 · 80 | Repeat | ||
| 11 · FF | Load A and B | ||
| 00 · 00 | Hold A and B | ||
| 11 · 00 | Load A and B | ||
| 00 · 00 | Hold A and B |
Compare the balanced and chain versions for 12 × 34 and FF × 80. The observations should agree once both programs are repaired. Count the longest path through adders for both architectures. Explain what you would need to measure before claiming a higher clock frequency. Submit your readings, your circuit change and a sketch of the adder structure.
If you use desktop Quartus, open the Compilation Report for each repaired design. In Timing Analyzer, find the Slow 1100mV 85C Model Fmax Summary and record the Fmax for KEY[1]. Repeat for the 0C model. In Fitter Summary, record the ALMs and registers. Compare both circuits at the same temperature. Which one uses fewer resources, and which one has the higher estimated clock frequency?
Original LabsLand activity following FPGAcademy Digital Logic Lab 6, Part V. verilog PDF · vhdl PDF · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
A balanced tree adds eight partial products in three levels. Its input and output registers have the same behavior as the serial adder chain. You will test whether every row reaches the output and distinguish the number of adder levels from the number of clock edges.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/tree_product.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
tree_product. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/tree_product.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Draw the four first-level pairs, two second-level sums and final addition. Label which multiplier bits contribute to each half of the final result. Locate the starter expression that uses one of those halves twice. Write your correction without using a multiplication operator in the circuit. SW9 enables register A, SW8 enables register B, and SW7–0 supply the byte. LED7–0 read back A when SW9 is high, otherwise B when SW8 is high. With neither enabled they are dark.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench checks 65,536 operand pairs, separate and simultaneous operand loads, registered output latency and the clocked reset. It calculates expected products independently using integer multiplication. Record the first pair for which the starter fails.
Verilog
iverilog -g2005 -s test_product -o bench starter/tree_product.v simulation/test_product.v
vvp bench
Take one clock edge at a time
Synthesize and upload. With both enables on and the data switches at 00, press and release KEY1 twice. This initializes both operands and then clocks their zero product into the output. In simulation also try holding the active-low KEY0 reset while a KEY1 rising edge occurs.
Work down the table in order. The first two bits are SW9 and SW8. The byte after the dot is the hexadecimal value on SW7–0. Press and release KEY1 once in each row except “No pulse”. After each action, record LED7–0 and HEX3–0 in hexadecimal. Before each pulse, predict which two stored operands the output register will multiply.
| SW9–8 · SW7–0 | KEY1 | LED7–0 | HEX3–0 |
|---|---|---|---|
| 10 · 12 | Load A | ||
| 01 · 34 | Load B | ||
| 00 · 34 | Hold A and B | ||
| 10 · FF | No pulse | ||
| 10 · FF | Load A | ||
| 01 · 80 | Load B | ||
| 01 · 80 | Repeat | ||
| 11 · FF | Load A and B | ||
| 00 · 00 | Hold A and B | ||
| 11 · 00 | Load A and B | ||
| 00 · 00 | Hold A and B |
Compare the balanced and chain versions for 12 × 34 and FF × 80. The observations should agree once both programs are repaired. Count the longest path through adders for both architectures. Explain what you would need to measure before claiming a higher clock frequency. Submit your readings, your circuit change and a sketch of the adder structure.
If you use desktop Quartus, open the Compilation Report for each repaired design. In Timing Analyzer, find the Slow 1100mV 85C Model Fmax Summary and record the Fmax for KEY[1]. Repeat for the 0C model. In Fitter Summary, record the ALMs and registers. Compare both circuits at the same temperature. Which one uses fewer resources, and which one has the higher estimated clock frequency?
Original LabsLand activity following FPGAcademy Digital Logic Lab 6, Part V. verilog PDF · vhdl PDF · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
A balanced tree adds eight partial products in three levels. Its input and output registers have the same behavior as the serial adder chain. You will test whether every row reaches the output and distinguish the number of adder levels from the number of clock edges.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
tree_product, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Draw the four first-level pairs, two second-level sums and final addition. Label which multiplier bits contribute to each half of the final result. Locate the starter expression that uses one of those halves twice. Write your correction without using a multiplication operator in the circuit. SW9 enables register A, SW8 enables register B, and SW7–0 supply the byte. LED7–0 read back A when SW9 is high, otherwise B when SW8 is high. With neither enabled they are dark.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench checks 65,536 operand pairs, separate and simultaneous operand loads, registered output latency and the clocked reset. It calculates expected products independently using integer multiplication. Record the first pair for which the starter fails.
VHDL
nvc --std=2008 -a starter/tree_product.vhd simulation/test_product.vhd
nvc --std=2008 -e test_product
nvc --std=2008 -r test_product
Take one clock edge at a time
Synthesize and upload. With both enables on and the data switches at 00, press and release KEY1 twice. This initializes both operands and then clocks their zero product into the output. In simulation also try holding the active-low KEY0 reset while a KEY1 rising edge occurs.
Work down the table in order. The first two bits are SW9 and SW8. The byte after the dot is the hexadecimal value on SW7–0. Press and release KEY1 once in each row except “No pulse”. After each action, record LED7–0 and HEX3–0 in hexadecimal. Before each pulse, predict which two stored operands the output register will multiply.
| SW9–8 · SW7–0 | KEY1 | LED7–0 | HEX3–0 |
|---|---|---|---|
| 10 · 12 | Load A | ||
| 01 · 34 | Load B | ||
| 00 · 34 | Hold A and B | ||
| 10 · FF | No pulse | ||
| 10 · FF | Load A | ||
| 01 · 80 | Load B | ||
| 01 · 80 | Repeat | ||
| 11 · FF | Load A and B | ||
| 00 · 00 | Hold A and B | ||
| 11 · 00 | Load A and B | ||
| 00 · 00 | Hold A and B |
Compare the balanced and chain versions for 12 × 34 and FF × 80. The observations should agree once both programs are repaired. Count the longest path through adders for both architectures. Explain what you would need to measure before claiming a higher clock frequency. Submit your readings, your circuit change and a sketch of the adder structure.
If you use desktop Quartus, open the Compilation Report for each repaired design. In Timing Analyzer, find the Slow 1100mV 85C Model Fmax Summary and record the Fmax for KEY[1]. Repeat for the 0C model. In Fitter Summary, record the ALMs and registers. Compare both circuits at the same temperature. Which one uses fewer resources, and which one has the higher estimated clock frequency?
Original LabsLand activity following FPGAcademy Digital Logic Lab 6, Part V. verilog PDF · vhdl PDF · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
A balanced tree adds eight partial products in three levels. Its input and output registers have the same behavior as the serial adder chain. You will test whether every row reaches the output and distinguish the number of adder levels from the number of clock edges.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/tree_product.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
tree_product. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/tree_product.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Draw the four first-level pairs, two second-level sums and final addition. Label which multiplier bits contribute to each half of the final result. Locate the starter expression that uses one of those halves twice. Write your correction without using a multiplication operator in the circuit. SW9 enables register A, SW8 enables register B, and SW7–0 supply the byte. LED7–0 read back A when SW9 is high, otherwise B when SW8 is high. With neither enabled they are dark.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench checks 65,536 operand pairs, separate and simultaneous operand loads, registered output latency and the clocked reset. It calculates expected products independently using integer multiplication. Record the first pair for which the starter fails.
VHDL
nvc --std=2008 -a starter/tree_product.vhd simulation/test_product.vhd
nvc --std=2008 -e test_product
nvc --std=2008 -r test_product
Take one clock edge at a time
Synthesize and upload. With both enables on and the data switches at 00, press and release KEY1 twice. This initializes both operands and then clocks their zero product into the output. In simulation also try holding the active-low KEY0 reset while a KEY1 rising edge occurs.
Work down the table in order. The first two bits are SW9 and SW8. The byte after the dot is the hexadecimal value on SW7–0. Press and release KEY1 once in each row except “No pulse”. After each action, record LED7–0 and HEX3–0 in hexadecimal. Before each pulse, predict which two stored operands the output register will multiply.
| SW9–8 · SW7–0 | KEY1 | LED7–0 | HEX3–0 |
|---|---|---|---|
| 10 · 12 | Load A | ||
| 01 · 34 | Load B | ||
| 00 · 34 | Hold A and B | ||
| 10 · FF | No pulse | ||
| 10 · FF | Load A | ||
| 01 · 80 | Load B | ||
| 01 · 80 | Repeat | ||
| 11 · FF | Load A and B | ||
| 00 · 00 | Hold A and B | ||
| 11 · 00 | Load A and B | ||
| 00 · 00 | Hold A and B |
Compare the balanced and chain versions for 12 × 34 and FF × 80. The observations should agree once both programs are repaired. Count the longest path through adders for both architectures. Explain what you would need to measure before claiming a higher clock frequency. Submit your readings, your circuit change and a sketch of the adder structure.
If you use desktop Quartus, open the Compilation Report for each repaired design. In Timing Analyzer, find the Slow 1100mV 85C Model Fmax Summary and record the Fmax for KEY[1]. Repeat for the 0C model. In Fitter Summary, record the ALMs and registers. Compare both circuits at the same temperature. Which one uses fewer resources, and which one has the higher estimated clock frequency?
Original LabsLand activity following FPGAcademy Digital Logic Lab 6, Part V. verilog PDF · vhdl PDF · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
A balanced tree adds eight partial products in three levels. Its input and output registers have the same behavior as the serial adder chain. You will test whether every row reaches the output and distinguish the number of adder levels from the number of clock edges.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
tree_product, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Draw the four first-level pairs, two second-level sums and final addition. Label which multiplier bits contribute to each half of the final result. Locate the starter expression that uses one of those halves twice. Write your correction without using a multiplication operator in the circuit. SW9 enables register A, SW8 enables register B, and SW7–0 supply the byte. LED7–0 read back A when SW9 is high, otherwise B when SW8 is high. With neither enabled they are dark.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench checks 65,536 operand pairs, separate and simultaneous operand loads, registered output latency and the clocked reset. It calculates expected products independently using integer multiplication. Record the first pair for which the starter fails.
SystemVerilog
iverilog -g2012 -s test_product -o bench starter/tree_product.sv simulation/test_product.v
vvp bench
Take one clock edge at a time
Synthesize and upload. With both enables on and the data switches at 00, press and release KEY1 twice. This initializes both operands and then clocks their zero product into the output. In simulation also try holding the active-low KEY0 reset while a KEY1 rising edge occurs.
Work down the table in order. The first two bits are SW9 and SW8. The byte after the dot is the hexadecimal value on SW7–0. Press and release KEY1 once in each row except “No pulse”. After each action, record LED7–0 and HEX3–0 in hexadecimal. Before each pulse, predict which two stored operands the output register will multiply.
| SW9–8 · SW7–0 | KEY1 | LED7–0 | HEX3–0 |
|---|---|---|---|
| 10 · 12 | Load A | ||
| 01 · 34 | Load B | ||
| 00 · 34 | Hold A and B | ||
| 10 · FF | No pulse | ||
| 10 · FF | Load A | ||
| 01 · 80 | Load B | ||
| 01 · 80 | Repeat | ||
| 11 · FF | Load A and B | ||
| 00 · 00 | Hold A and B | ||
| 11 · 00 | Load A and B | ||
| 00 · 00 | Hold A and B |
Compare the balanced and chain versions for 12 × 34 and FF × 80. The observations should agree once both programs are repaired. Count the longest path through adders for both architectures. Explain what you would need to measure before claiming a higher clock frequency. Submit your readings, your circuit change and a sketch of the adder structure.
If you use desktop Quartus, open the Compilation Report for each repaired design. In Timing Analyzer, find the Slow 1100mV 85C Model Fmax Summary and record the Fmax for KEY[1]. Repeat for the 0C model. In Fitter Summary, record the ALMs and registers. Compare both circuits at the same temperature. Which one uses fewer resources, and which one has the higher estimated clock frequency?
Original LabsLand activity following FPGAcademy Digital Logic Lab 6, Part V. verilog PDF · vhdl PDF · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
A balanced tree adds eight partial products in three levels. Its input and output registers have the same behavior as the serial adder chain. You will test whether every row reaches the output and distinguish the number of adder levels from the number of clock edges.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/tree_product.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
tree_product. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/tree_product.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Draw the four first-level pairs, two second-level sums and final addition. Label which multiplier bits contribute to each half of the final result. Locate the starter expression that uses one of those halves twice. Write your correction without using a multiplication operator in the circuit. SW9 enables register A, SW8 enables register B, and SW7–0 supply the byte. LED7–0 read back A when SW9 is high, otherwise B when SW8 is high. With neither enabled they are dark.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench checks 65,536 operand pairs, separate and simultaneous operand loads, registered output latency and the clocked reset. It calculates expected products independently using integer multiplication. Record the first pair for which the starter fails.
SystemVerilog
iverilog -g2012 -s test_product -o bench starter/tree_product.sv simulation/test_product.v
vvp bench
Take one clock edge at a time
Synthesize and upload. With both enables on and the data switches at 00, press and release KEY1 twice. This initializes both operands and then clocks their zero product into the output. In simulation also try holding the active-low KEY0 reset while a KEY1 rising edge occurs.
Work down the table in order. The first two bits are SW9 and SW8. The byte after the dot is the hexadecimal value on SW7–0. Press and release KEY1 once in each row except “No pulse”. After each action, record LED7–0 and HEX3–0 in hexadecimal. Before each pulse, predict which two stored operands the output register will multiply.
| SW9–8 · SW7–0 | KEY1 | LED7–0 | HEX3–0 |
|---|---|---|---|
| 10 · 12 | Load A | ||
| 01 · 34 | Load B | ||
| 00 · 34 | Hold A and B | ||
| 10 · FF | No pulse | ||
| 10 · FF | Load A | ||
| 01 · 80 | Load B | ||
| 01 · 80 | Repeat | ||
| 11 · FF | Load A and B | ||
| 00 · 00 | Hold A and B | ||
| 11 · 00 | Load A and B | ||
| 00 · 00 | Hold A and B |
Compare the balanced and chain versions for 12 × 34 and FF × 80. The observations should agree once both programs are repaired. Count the longest path through adders for both architectures. Explain what you would need to measure before claiming a higher clock frequency. Submit your readings, your circuit change and a sketch of the adder structure.
If you use desktop Quartus, open the Compilation Report for each repaired design. In Timing Analyzer, find the Slow 1100mV 85C Model Fmax Summary and record the Fmax for KEY[1]. Repeat for the 0C model. In Fitter Summary, record the ALMs and registers. Compare both circuits at the same temperature. Which one uses fewer resources, and which one has the higher estimated clock frequency?
Original LabsLand activity following FPGAcademy Digital Logic Lab 6, Part V. verilog PDF · vhdl PDF · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Design a circuit that recognizes four consecutive equal samples, including overlapping runs. Begin in A. Name the states for successive zeros B, C, D and E, and those for successive ones F, G, H and I. Sketch the arrows out of E and I for both possible next inputs. Which states should switch on the match lamp?
Derive the register inputs
Use a flip-flop for each state. Give A bit 0, B bit 1, through I at bit 8. Write an equation for entering B, and another for remaining in E. Compare yours with the starter. Its reset and first four zeros work, but the next sample can lose an existing match. Repair the next-state logic. Explain why keeping the terminal state matters when windows overlap.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench counts identical samples independently and predicts the state code for both encodings after each clock edge. Find the first mismatch and use the failing word to repair the starter. The first check starts in B with a one on SW1. Predict what both LED patterns should show while KEY0 is held down and which state should appear when it is released.
Verilog
iverilog -g2005 -s test_one_hot -o bench starter/one_hot_runs.v simulation/test_one_hot.v
vvp bench
Build
When the bench reports PASS 2048 clock edges, use the same repaired HDL for the board.
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
one_hot_runs, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Compare the two encodings on hardware
SW0 is an active-low synchronous reset. SW1 supplies the sample. Press and release KEY0 once per sample. LED8–0 show the state, and LED9 shows a match. The design includes a second copy with the A flip-flop inverted. SW2 selects which copy you see. Changing SW2 lets you inspect the same clock edge in each encoding.
Lower SW0, then press and release KEY0. Read both encodings. Raise SW0, select zero on SW1 and clock five times. Then select one and clock five times. Switch back to zero for one more edge. For each row, write all ten LEDs as one binary word with LED9 on the left. Underline the match bit (LED9) when it lights. Read the word with SW2 low, then high, keeping KEY0 released between readings. The arrows mark the first clock edge after the input changes.
| Observation | State | SW2 low | SW2 high |
|---|---|---|---|
| Reset | |||
| Third zero | |||
| Fourth zero | |||
| Fifth zero | |||
| 0 → 1 | |||
| Fourth one | |||
| Fifth one | |||
| 1 → 0 |
Lower SW0 while a non-reset state is visible. Compare the display before and after releasing KEY0. Submit your two transition equations, the first failing simulation sample and the pair of state codes at reset. Explain why the alternate encoding changes bit 0 even in states other than A.
Original LabsLand activity following FPGAcademy Digital Logic Lab 7, Part I. Verilog handout · VHDL handout · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Design a circuit that recognizes four consecutive equal samples, including overlapping runs. Begin in A. Name the states for successive zeros B, C, D and E, and those for successive ones F, G, H and I. Sketch the arrows out of E and I for both possible next inputs. Which states should switch on the match lamp?
Derive the register inputs
Use a flip-flop for each state. Give A bit 0, B bit 1, through I at bit 8. Write an equation for entering B, and another for remaining in E. Compare yours with the starter. Its reset and first four zeros work, but the next sample can lose an existing match. Repair the next-state logic. Explain why keeping the terminal state matters when windows overlap.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench counts identical samples independently and predicts the state code for both encodings after each clock edge. Find the first mismatch and use the failing word to repair the starter. The first check starts in B with a one on SW1. Predict what both LED patterns should show while KEY0 is held down and which state should appear when it is released.
Verilog
iverilog -g2005 -s test_one_hot -o bench starter/one_hot_runs.v simulation/test_one_hot.v
vvp bench
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
When the bench reports PASS 2048 clock edges, use the same repaired HDL for the board.
- From the extracted worksheet folder, open
starter/one_hot_runs.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
one_hot_runs. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/one_hot_runs.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Compare the two encodings on hardware
SW0 is an active-low synchronous reset. SW1 supplies the sample. Press and release KEY0 once per sample. LED8–0 show the state, and LED9 shows a match. The design includes a second copy with the A flip-flop inverted. SW2 selects which copy you see. Changing SW2 lets you inspect the same clock edge in each encoding.
Lower SW0, then press and release KEY0. Read both encodings. Raise SW0, select zero on SW1 and clock five times. Then select one and clock five times. Switch back to zero for one more edge. For each row, write all ten LEDs as one binary word with LED9 on the left. Underline the match bit (LED9) when it lights. Read the word with SW2 low, then high, keeping KEY0 released between readings. The arrows mark the first clock edge after the input changes.
| Observation | State | SW2 low | SW2 high |
|---|---|---|---|
| Reset | |||
| Third zero | |||
| Fourth zero | |||
| Fifth zero | |||
| 0 → 1 | |||
| Fourth one | |||
| Fifth one | |||
| 1 → 0 |
Lower SW0 while a non-reset state is visible. Compare the display before and after releasing KEY0. Submit your two transition equations, the first failing simulation sample and the pair of state codes at reset. Explain why the alternate encoding changes bit 0 even in states other than A.
Original LabsLand activity following FPGAcademy Digital Logic Lab 7, Part I. Verilog handout · VHDL handout · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Design a circuit that recognizes four consecutive equal samples, including overlapping runs. Begin in A. Name the states for successive zeros B, C, D and E, and those for successive ones F, G, H and I. Sketch the arrows out of E and I for both possible next inputs. Which states should switch on the match lamp?
Derive the register inputs
Use a flip-flop for each state. Give A bit 0, B bit 1, through I at bit 8. Write an equation for entering B, and another for remaining in E. Compare yours with the starter. Its reset and first four zeros work, but the next sample can lose an existing match. Repair the next-state logic. Explain why keeping the terminal state matters when windows overlap.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench counts identical samples independently and predicts the state code for both encodings after each clock edge. Find the first mismatch and use the failing word to repair the starter. The first check starts in B with a one on SW1. Predict what both LED patterns should show while KEY0 is held down and which state should appear when it is released.
VHDL
nvc --std=2008 -a starter/one_hot_runs.vhd simulation/test_one_hot.vhd
nvc --std=2008 -e test_one_hot
nvc --std=2008 -r test_one_hot
Build
When the bench reports PASS 2048 clock edges, use the same repaired HDL for the board.
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
one_hot_runs, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Compare the two encodings on hardware
SW0 is an active-low synchronous reset. SW1 supplies the sample. Press and release KEY0 once per sample. LED8–0 show the state, and LED9 shows a match. The design includes a second copy with the A flip-flop inverted. SW2 selects which copy you see. Changing SW2 lets you inspect the same clock edge in each encoding.
Lower SW0, then press and release KEY0. Read both encodings. Raise SW0, select zero on SW1 and clock five times. Then select one and clock five times. Switch back to zero for one more edge. For each row, write all ten LEDs as one binary word with LED9 on the left. Underline the match bit (LED9) when it lights. Read the word with SW2 low, then high, keeping KEY0 released between readings. The arrows mark the first clock edge after the input changes.
| Observation | State | SW2 low | SW2 high |
|---|---|---|---|
| Reset | |||
| Third zero | |||
| Fourth zero | |||
| Fifth zero | |||
| 0 → 1 | |||
| Fourth one | |||
| Fifth one | |||
| 1 → 0 |
Lower SW0 while a non-reset state is visible. Compare the display before and after releasing KEY0. Submit your two transition equations, the first failing simulation sample and the pair of state codes at reset. Explain why the alternate encoding changes bit 0 even in states other than A.
Original LabsLand activity following FPGAcademy Digital Logic Lab 7, Part I. Verilog handout · VHDL handout · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Design a circuit that recognizes four consecutive equal samples, including overlapping runs. Begin in A. Name the states for successive zeros B, C, D and E, and those for successive ones F, G, H and I. Sketch the arrows out of E and I for both possible next inputs. Which states should switch on the match lamp?
Derive the register inputs
Use a flip-flop for each state. Give A bit 0, B bit 1, through I at bit 8. Write an equation for entering B, and another for remaining in E. Compare yours with the starter. Its reset and first four zeros work, but the next sample can lose an existing match. Repair the next-state logic. Explain why keeping the terminal state matters when windows overlap.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench counts identical samples independently and predicts the state code for both encodings after each clock edge. Find the first mismatch and use the failing word to repair the starter. The first check starts in B with a one on SW1. Predict what both LED patterns should show while KEY0 is held down and which state should appear when it is released.
VHDL
nvc --std=2008 -a starter/one_hot_runs.vhd simulation/test_one_hot.vhd
nvc --std=2008 -e test_one_hot
nvc --std=2008 -r test_one_hot
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
When the bench reports PASS 2048 clock edges, use the same repaired HDL for the board.
- From the extracted worksheet folder, open
starter/one_hot_runs.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
one_hot_runs. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/one_hot_runs.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Compare the two encodings on hardware
SW0 is an active-low synchronous reset. SW1 supplies the sample. Press and release KEY0 once per sample. LED8–0 show the state, and LED9 shows a match. The design includes a second copy with the A flip-flop inverted. SW2 selects which copy you see. Changing SW2 lets you inspect the same clock edge in each encoding.
Lower SW0, then press and release KEY0. Read both encodings. Raise SW0, select zero on SW1 and clock five times. Then select one and clock five times. Switch back to zero for one more edge. For each row, write all ten LEDs as one binary word with LED9 on the left. Underline the match bit (LED9) when it lights. Read the word with SW2 low, then high, keeping KEY0 released between readings. The arrows mark the first clock edge after the input changes.
| Observation | State | SW2 low | SW2 high |
|---|---|---|---|
| Reset | |||
| Third zero | |||
| Fourth zero | |||
| Fifth zero | |||
| 0 → 1 | |||
| Fourth one | |||
| Fifth one | |||
| 1 → 0 |
Lower SW0 while a non-reset state is visible. Compare the display before and after releasing KEY0. Submit your two transition equations, the first failing simulation sample and the pair of state codes at reset. Explain why the alternate encoding changes bit 0 even in states other than A.
Original LabsLand activity following FPGAcademy Digital Logic Lab 7, Part I. Verilog handout · VHDL handout · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Design a circuit that recognizes four consecutive equal samples, including overlapping runs. Begin in A. Name the states for successive zeros B, C, D and E, and those for successive ones F, G, H and I. Sketch the arrows out of E and I for both possible next inputs. Which states should switch on the match lamp?
Derive the register inputs
Use a flip-flop for each state. Give A bit 0, B bit 1, through I at bit 8. Write an equation for entering B, and another for remaining in E. Compare yours with the starter. Its reset and first four zeros work, but the next sample can lose an existing match. Repair the next-state logic. Explain why keeping the terminal state matters when windows overlap.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench counts identical samples independently and predicts the state code for both encodings after each clock edge. Find the first mismatch and use the failing word to repair the starter. The first check starts in B with a one on SW1. Predict what both LED patterns should show while KEY0 is held down and which state should appear when it is released.
SystemVerilog
iverilog -g2012 -s test_one_hot -o bench starter/one_hot_runs.sv simulation/test_one_hot.v
vvp bench
Build
When the bench reports PASS 2048 clock edges, use the same repaired HDL for the board.
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
one_hot_runs, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Compare the two encodings on hardware
SW0 is an active-low synchronous reset. SW1 supplies the sample. Press and release KEY0 once per sample. LED8–0 show the state, and LED9 shows a match. The design includes a second copy with the A flip-flop inverted. SW2 selects which copy you see. Changing SW2 lets you inspect the same clock edge in each encoding.
Lower SW0, then press and release KEY0. Read both encodings. Raise SW0, select zero on SW1 and clock five times. Then select one and clock five times. Switch back to zero for one more edge. For each row, write all ten LEDs as one binary word with LED9 on the left. Underline the match bit (LED9) when it lights. Read the word with SW2 low, then high, keeping KEY0 released between readings. The arrows mark the first clock edge after the input changes.
| Observation | State | SW2 low | SW2 high |
|---|---|---|---|
| Reset | |||
| Third zero | |||
| Fourth zero | |||
| Fifth zero | |||
| 0 → 1 | |||
| Fourth one | |||
| Fifth one | |||
| 1 → 0 |
Lower SW0 while a non-reset state is visible. Compare the display before and after releasing KEY0. Submit your two transition equations, the first failing simulation sample and the pair of state codes at reset. Explain why the alternate encoding changes bit 0 even in states other than A.
Original LabsLand activity following FPGAcademy Digital Logic Lab 7, Part I. Verilog handout · VHDL handout · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Design a circuit that recognizes four consecutive equal samples, including overlapping runs. Begin in A. Name the states for successive zeros B, C, D and E, and those for successive ones F, G, H and I. Sketch the arrows out of E and I for both possible next inputs. Which states should switch on the match lamp?
Derive the register inputs
Use a flip-flop for each state. Give A bit 0, B bit 1, through I at bit 8. Write an equation for entering B, and another for remaining in E. Compare yours with the starter. Its reset and first four zeros work, but the next sample can lose an existing match. Repair the next-state logic. Explain why keeping the terminal state matters when windows overlap.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench counts identical samples independently and predicts the state code for both encodings after each clock edge. Find the first mismatch and use the failing word to repair the starter. The first check starts in B with a one on SW1. Predict what both LED patterns should show while KEY0 is held down and which state should appear when it is released.
SystemVerilog
iverilog -g2012 -s test_one_hot -o bench starter/one_hot_runs.sv simulation/test_one_hot.v
vvp bench
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
When the bench reports PASS 2048 clock edges, use the same repaired HDL for the board.
- From the extracted worksheet folder, open
starter/one_hot_runs.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
one_hot_runs. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/one_hot_runs.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Compare the two encodings on hardware
SW0 is an active-low synchronous reset. SW1 supplies the sample. Press and release KEY0 once per sample. LED8–0 show the state, and LED9 shows a match. The design includes a second copy with the A flip-flop inverted. SW2 selects which copy you see. Changing SW2 lets you inspect the same clock edge in each encoding.
Lower SW0, then press and release KEY0. Read both encodings. Raise SW0, select zero on SW1 and clock five times. Then select one and clock five times. Switch back to zero for one more edge. For each row, write all ten LEDs as one binary word with LED9 on the left. Underline the match bit (LED9) when it lights. Read the word with SW2 low, then high, keeping KEY0 released between readings. The arrows mark the first clock edge after the input changes.
| Observation | State | SW2 low | SW2 high |
|---|---|---|---|
| Reset | |||
| Third zero | |||
| Fourth zero | |||
| Fifth zero | |||
| 0 → 1 | |||
| Fourth one | |||
| Fifth one | |||
| 1 → 0 |
Lower SW0 while a non-reset state is visible. Compare the display before and after releasing KEY0. Submit your two transition equations, the first failing simulation sample and the pair of state codes at reset. Explain why the alternate encoding changes bit 0 even in states other than A.
Original LabsLand activity following FPGAcademy Digital Logic Lab 7, Part I. Verilog handout · VHDL handout · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
A line monitor raises an alarm on the fourth consecutive equal bit. The alarm stays on for the fifth bit and clears on the first opposite bit. Draw a nine-state diagram with an idle state and two paths of four states each. Mark the states that raise the alarm. Predict how many flip-flops you need for a compact binary encoding and for one-hot encoding.
Simulate
The testbench counts identical samples and checks all nine decoded state lamps and the match lamp across 256 eight-bit words. Read the first mismatch. Which input makes the detector leave a state where it should stay?
Verilog
iverilog -g2005 -s test_encoded -o bench encoded_runs.v test_encoded.v
vvp bench
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Open encoded_runs.qpf in Quartus Prime Lite with Cyclone V support. Repair the starter and compile it with the supplied User-Encoded setting. Open Tools → Netlist Viewers → State Machine Viewer. Find the two transitions leaving the fourth-one state. In the Compilation Report, under Analysis & Synthesis → State Machines, record the register headings and the codes for idle, the first zero and the fourth one. Save the report excerpt and the SOF in a folder named binary.
Copy the project to a second folder. Under Assignments → Settings → Compiler Settings → Advanced Settings (Synthesis), change State Machine Processing to One-Hot. Alternatively, change USER-ENCODED to ONE-HOT on the STATE_MACHINE_PROCESSING line of encoded_runs.qsf. For VHDL, also remove both attribute syn_encoding lines from the second copy. Quartus gives the explicit type encoding precedence over the project setting. Compile again. Record the same three codes in the same bit order. Save this SOF separately.
Test both bitstreams
Upload each SOF to the Standard binary-upload lab with a distinct filename. Select it in the firmware list and enter the board. Lower SW0 and press and release KEY0 once to reset. Raise SW0. For each sample, set SW1 and release KEY0 once. LEDR0–8 identify the current state and LEDR9 signals a match. The nine state lamps are decoded labels. Use the report to read the underlying register bits.
| Sample after reset | State | User-Encoded lamps | One-Hot lamps |
|---|---|---|---|
| Third zero | |||
| Fourth and fifth zeros | |||
| First one after the zeros | |||
| Fourth and fifth ones | |||
| First zero after the ones |
Hand in
Submit the diagram, the two sets of register headings and codes, and the camera observations. Account for any difference between your predicted one-hot idle code and the compiler's code. Explain how the same lamp can turn on in both builds when the corresponding physical register bits differ.
Original LabsLand activity following FPGAcademy Digital Logic Lab 7, Part II. Verilog handout · VHDL handout · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
A line monitor raises an alarm on the fourth consecutive equal bit. The alarm stays on for the fifth bit and clears on the first opposite bit. Draw a nine-state diagram with an idle state and two paths of four states each. Mark the states that raise the alarm. Predict how many flip-flops you need for a compact binary encoding and for one-hot encoding.
Simulate
The testbench counts identical samples and checks all nine decoded state lamps and the match lamp across 256 eight-bit words. Read the first mismatch. Which input makes the detector leave a state where it should stay?
VHDL
nvc --std=2008 -a encoded_runs.vhd test_encoded.vhd
nvc --std=2008 -e test_encoded
nvc --std=2008 -r test_encoded
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Open encoded_runs.qpf in Quartus Prime Lite with Cyclone V support. Repair the starter and compile it with the supplied User-Encoded setting. Open Tools → Netlist Viewers → State Machine Viewer. Find the two transitions leaving the fourth-one state. In the Compilation Report, under Analysis & Synthesis → State Machines, record the register headings and the codes for idle, the first zero and the fourth one. Save the report excerpt and the SOF in a folder named binary.
Copy the project to a second folder. Under Assignments → Settings → Compiler Settings → Advanced Settings (Synthesis), change State Machine Processing to One-Hot. Alternatively, change USER-ENCODED to ONE-HOT on the STATE_MACHINE_PROCESSING line of encoded_runs.qsf. For VHDL, also remove both attribute syn_encoding lines from the second copy. Quartus gives the explicit type encoding precedence over the project setting. Compile again. Record the same three codes in the same bit order. Save this SOF separately.
Test both bitstreams
Upload each SOF to the Standard binary-upload lab with a distinct filename. Select it in the firmware list and enter the board. Lower SW0 and press and release KEY0 once to reset. Raise SW0. For each sample, set SW1 and release KEY0 once. LEDR0–8 identify the current state and LEDR9 signals a match. The nine state lamps are decoded labels. Use the report to read the underlying register bits.
| Sample after reset | State | User-Encoded lamps | One-Hot lamps |
|---|---|---|---|
| Third zero | |||
| Fourth and fifth zeros | |||
| First one after the zeros | |||
| Fourth and fifth ones | |||
| First zero after the ones |
Hand in
Submit the diagram, the two sets of register headings and codes, and the camera observations. Account for any difference between your predicted one-hot idle code and the compiler's code. Explain how the same lamp can turn on in both builds when the corresponding physical register bits differ.
Original LabsLand activity following FPGAcademy Digital Logic Lab 7, Part II. Verilog handout · VHDL handout · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
A line monitor raises an alarm on the fourth consecutive equal bit. The alarm stays on for the fifth bit and clears on the first opposite bit. Draw a nine-state diagram with an idle state and two paths of four states each. Mark the states that raise the alarm. Predict how many flip-flops you need for a compact binary encoding and for one-hot encoding.
Simulate
The testbench counts identical samples and checks all nine decoded state lamps and the match lamp across 256 eight-bit words. Read the first mismatch. Which input makes the detector leave a state where it should stay?
SystemVerilog
iverilog -g2012 -s test_encoded -o bench encoded_runs.sv test_encoded.v
vvp bench
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Open encoded_runs.qpf in Quartus Prime Lite with Cyclone V support. Repair the starter and compile it with the supplied User-Encoded setting. Open Tools → Netlist Viewers → State Machine Viewer. Find the two transitions leaving the fourth-one state. In the Compilation Report, under Analysis & Synthesis → State Machines, record the register headings and the codes for idle, the first zero and the fourth one. Save the report excerpt and the SOF in a folder named binary.
Copy the project to a second folder. Under Assignments → Settings → Compiler Settings → Advanced Settings (Synthesis), change State Machine Processing to One-Hot. Alternatively, change USER-ENCODED to ONE-HOT on the STATE_MACHINE_PROCESSING line of encoded_runs.qsf. For VHDL, also remove both attribute syn_encoding lines from the second copy. Quartus gives the explicit type encoding precedence over the project setting. Compile again. Record the same three codes in the same bit order. Save this SOF separately.
Test both bitstreams
Upload each SOF to the Standard binary-upload lab with a distinct filename. Select it in the firmware list and enter the board. Lower SW0 and press and release KEY0 once to reset. Raise SW0. For each sample, set SW1 and release KEY0 once. LEDR0–8 identify the current state and LEDR9 signals a match. The nine state lamps are decoded labels. Use the report to read the underlying register bits.
| Sample after reset | State | User-Encoded lamps | One-Hot lamps |
|---|---|---|---|
| Third zero | |||
| Fourth and fifth zeros | |||
| First one after the zeros | |||
| Fourth and fifth ones | |||
| First zero after the ones |
Hand in
Submit the diagram, the two sets of register headings and codes, and the camera observations. Account for any difference between your predicted one-hot idle code and the compiler's code. Explain how the same lamp can turn on in both builds when the corresponding physical register bits differ.
Original LabsLand activity following FPGAcademy Digital Logic Lab 7, Part II. Verilog handout · VHDL handout · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
You are building a detector that lights LED9 on the fourth successive zero or one. A fifth identical input should keep the light on. Two four-bit shift registers make the last four samples visible. Each press and release of KEY0 records one input.
SW0 is an active-low synchronous reset. SW1 supplies the data bit. LED3–0 show recent ones, LED7–4 show recent zeros, and LED8 stays dark to separate the result lamp. Within each group the newest sample is on the right. Predict which register bit first lights after a reset followed by one high sample.
Simulate
Extract the worksheet ZIP. Run the testbench below with the supplied starter. Record the first failing input and bit position. Inspect the expression for found: which four stored bits must agree before the ones history qualifies? Edit the starter and rerun the same commands. Continue when the simulator prints PASS 256 eight-sample inputs and all 2048 clock edges.
The testbench applies every eight-symbol sequence. It counts consecutive identical symbols independently and checks both histories, reset and the result lamp.
Verilog
iverilog -g2005 -s test_history -o bench starter/history_detector.v simulation/test_history.v
vvp bench
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
history_detector, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Read both histories
On the programmed board, lower SW0 and press and release KEY0 once to reset. Raise SW0 and SW1 without pressing KEY0. Read the LEDs, then record five high samples and five low samples. Finish with 1, 0, 1, 0. Read LED9 on the third, fourth and fifth samples of each run. Which release first produces a match?
| Point in the sequence | Zeros (LED7–4) | Ones (LED3–0) | Match (LED9) |
|---|---|---|---|
| Input high before the first release | |||
| Third, fourth and fifth one | |||
| First, fourth and fifth zero | |||
| After the alternating tail |
Lower SW0 and read the LEDs before and after the next KEY0 release. Raise SW0, leave SW1 low and record the first zero of the new sequence. Explain why the two histories become complementary only after four valid samples. Propose a design with a single history and a way to suppress premature matches after reset.
Original LabsLand activity following FPGAcademy Digital Logic Lab 7, Part III. verilog PDF · vhdl PDF · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
You are building a detector that lights LED9 on the fourth successive zero or one. A fifth identical input should keep the light on. Two four-bit shift registers make the last four samples visible. Each press and release of KEY0 records one input.
SW0 is an active-low synchronous reset. SW1 supplies the data bit. LED3–0 show recent ones, LED7–4 show recent zeros, and LED8 stays dark to separate the result lamp. Within each group the newest sample is on the right. Predict which register bit first lights after a reset followed by one high sample.
Simulate
Extract the worksheet ZIP. Run the testbench below with the supplied starter. Record the first failing input and bit position. Inspect the expression for found: which four stored bits must agree before the ones history qualifies? Edit the starter and rerun the same commands. Continue when the simulator prints PASS 256 eight-sample inputs and all 2048 clock edges.
The testbench applies every eight-symbol sequence. It counts consecutive identical symbols independently and checks both histories, reset and the result lamp.
Verilog
iverilog -g2005 -s test_history -o bench starter/history_detector.v simulation/test_history.v
vvp bench
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/history_detector.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
history_detector. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/history_detector.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Read both histories
On the programmed board, lower SW0 and press and release KEY0 once to reset. Raise SW0 and SW1 without pressing KEY0. Read the LEDs, then record five high samples and five low samples. Finish with 1, 0, 1, 0. Read LED9 on the third, fourth and fifth samples of each run. Which release first produces a match?
| Point in the sequence | Zeros (LED7–4) | Ones (LED3–0) | Match (LED9) |
|---|---|---|---|
| Input high before the first release | |||
| Third, fourth and fifth one | |||
| First, fourth and fifth zero | |||
| After the alternating tail |
Lower SW0 and read the LEDs before and after the next KEY0 release. Raise SW0, leave SW1 low and record the first zero of the new sequence. Explain why the two histories become complementary only after four valid samples. Propose a design with a single history and a way to suppress premature matches after reset.
Original LabsLand activity following FPGAcademy Digital Logic Lab 7, Part III. verilog PDF · vhdl PDF · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
You are building a detector that lights LED9 on the fourth successive zero or one. A fifth identical input should keep the light on. Two four-bit shift registers make the last four samples visible. Each press and release of KEY0 records one input.
SW0 is an active-low synchronous reset. SW1 supplies the data bit. LED3–0 show recent ones, LED7–4 show recent zeros, and LED8 stays dark to separate the result lamp. Within each group the newest sample is on the right. Predict which register bit first lights after a reset followed by one high sample.
Simulate
Extract the worksheet ZIP. Run the testbench below with the supplied starter. Record the first failing input and bit position. Inspect the expression for found: which four stored bits must agree before the ones history qualifies? Edit the starter and rerun the same commands. Continue when the simulator prints PASS 256 eight-sample inputs and all 2048 clock edges.
The testbench applies every eight-symbol sequence. It counts consecutive identical symbols independently and checks both histories, reset and the result lamp.
VHDL
nvc --std=2008 -a starter/history_detector.vhd simulation/test_history.vhd
nvc --std=2008 -e test_history
nvc --std=2008 -r test_history
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
history_detector, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Read both histories
On the programmed board, lower SW0 and press and release KEY0 once to reset. Raise SW0 and SW1 without pressing KEY0. Read the LEDs, then record five high samples and five low samples. Finish with 1, 0, 1, 0. Read LED9 on the third, fourth and fifth samples of each run. Which release first produces a match?
| Point in the sequence | Zeros (LED7–4) | Ones (LED3–0) | Match (LED9) |
|---|---|---|---|
| Input high before the first release | |||
| Third, fourth and fifth one | |||
| First, fourth and fifth zero | |||
| After the alternating tail |
Lower SW0 and read the LEDs before and after the next KEY0 release. Raise SW0, leave SW1 low and record the first zero of the new sequence. Explain why the two histories become complementary only after four valid samples. Propose a design with a single history and a way to suppress premature matches after reset.
Original LabsLand activity following FPGAcademy Digital Logic Lab 7, Part III. verilog PDF · vhdl PDF · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
You are building a detector that lights LED9 on the fourth successive zero or one. A fifth identical input should keep the light on. Two four-bit shift registers make the last four samples visible. Each press and release of KEY0 records one input.
SW0 is an active-low synchronous reset. SW1 supplies the data bit. LED3–0 show recent ones, LED7–4 show recent zeros, and LED8 stays dark to separate the result lamp. Within each group the newest sample is on the right. Predict which register bit first lights after a reset followed by one high sample.
Simulate
Extract the worksheet ZIP. Run the testbench below with the supplied starter. Record the first failing input and bit position. Inspect the expression for found: which four stored bits must agree before the ones history qualifies? Edit the starter and rerun the same commands. Continue when the simulator prints PASS 256 eight-sample inputs and all 2048 clock edges.
The testbench applies every eight-symbol sequence. It counts consecutive identical symbols independently and checks both histories, reset and the result lamp.
VHDL
nvc --std=2008 -a starter/history_detector.vhd simulation/test_history.vhd
nvc --std=2008 -e test_history
nvc --std=2008 -r test_history
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/history_detector.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
history_detector. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/history_detector.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Read both histories
On the programmed board, lower SW0 and press and release KEY0 once to reset. Raise SW0 and SW1 without pressing KEY0. Read the LEDs, then record five high samples and five low samples. Finish with 1, 0, 1, 0. Read LED9 on the third, fourth and fifth samples of each run. Which release first produces a match?
| Point in the sequence | Zeros (LED7–4) | Ones (LED3–0) | Match (LED9) |
|---|---|---|---|
| Input high before the first release | |||
| Third, fourth and fifth one | |||
| First, fourth and fifth zero | |||
| After the alternating tail |
Lower SW0 and read the LEDs before and after the next KEY0 release. Raise SW0, leave SW1 low and record the first zero of the new sequence. Explain why the two histories become complementary only after four valid samples. Propose a design with a single history and a way to suppress premature matches after reset.
Original LabsLand activity following FPGAcademy Digital Logic Lab 7, Part III. verilog PDF · vhdl PDF · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
You are building a detector that lights LED9 on the fourth successive zero or one. A fifth identical input should keep the light on. Two four-bit shift registers make the last four samples visible. Each press and release of KEY0 records one input.
SW0 is an active-low synchronous reset. SW1 supplies the data bit. LED3–0 show recent ones, LED7–4 show recent zeros, and LED8 stays dark to separate the result lamp. Within each group the newest sample is on the right. Predict which register bit first lights after a reset followed by one high sample.
Simulate
Extract the worksheet ZIP. Run the testbench below with the supplied starter. Record the first failing input and bit position. Inspect the expression for found: which four stored bits must agree before the ones history qualifies? Edit the starter and rerun the same commands. Continue when the simulator prints PASS 256 eight-sample inputs and all 2048 clock edges.
The testbench applies every eight-symbol sequence. It counts consecutive identical symbols independently and checks both histories, reset and the result lamp.
SystemVerilog
iverilog -g2012 -s test_history -o bench starter/history_detector.sv simulation/test_history.v
vvp bench
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
history_detector, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Read both histories
On the programmed board, lower SW0 and press and release KEY0 once to reset. Raise SW0 and SW1 without pressing KEY0. Read the LEDs, then record five high samples and five low samples. Finish with 1, 0, 1, 0. Read LED9 on the third, fourth and fifth samples of each run. Which release first produces a match?
| Point in the sequence | Zeros (LED7–4) | Ones (LED3–0) | Match (LED9) |
|---|---|---|---|
| Input high before the first release | |||
| Third, fourth and fifth one | |||
| First, fourth and fifth zero | |||
| After the alternating tail |
Lower SW0 and read the LEDs before and after the next KEY0 release. Raise SW0, leave SW1 low and record the first zero of the new sequence. Explain why the two histories become complementary only after four valid samples. Propose a design with a single history and a way to suppress premature matches after reset.
Original LabsLand activity following FPGAcademy Digital Logic Lab 7, Part III. verilog PDF · vhdl PDF · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
You are building a detector that lights LED9 on the fourth successive zero or one. A fifth identical input should keep the light on. Two four-bit shift registers make the last four samples visible. Each press and release of KEY0 records one input.
SW0 is an active-low synchronous reset. SW1 supplies the data bit. LED3–0 show recent ones, LED7–4 show recent zeros, and LED8 stays dark to separate the result lamp. Within each group the newest sample is on the right. Predict which register bit first lights after a reset followed by one high sample.
Simulate
Extract the worksheet ZIP. Run the testbench below with the supplied starter. Record the first failing input and bit position. Inspect the expression for found: which four stored bits must agree before the ones history qualifies? Edit the starter and rerun the same commands. Continue when the simulator prints PASS 256 eight-sample inputs and all 2048 clock edges.
The testbench applies every eight-symbol sequence. It counts consecutive identical symbols independently and checks both histories, reset and the result lamp.
SystemVerilog
iverilog -g2012 -s test_history -o bench starter/history_detector.sv simulation/test_history.v
vvp bench
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/history_detector.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
history_detector. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/history_detector.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Read both histories
On the programmed board, lower SW0 and press and release KEY0 once to reset. Raise SW0 and SW1 without pressing KEY0. Read the LEDs, then record five high samples and five low samples. Finish with 1, 0, 1, 0. Read LED9 on the third, fourth and fifth samples of each run. Which release first produces a match?
| Point in the sequence | Zeros (LED7–4) | Ones (LED3–0) | Match (LED9) |
|---|---|---|---|
| Input high before the first release | |||
| Third, fourth and fifth one | |||
| First, fourth and fifth zero | |||
| After the alternating tail |
Lower SW0 and read the LEDs before and after the next KEY0 release. Raise SW0, leave SW1 low and record the first zero of the new sequence. Explain why the two histories become complementary only after four valid samples. Propose a design with a single history and a way to suppress premature matches after reset.
Original LabsLand activity following FPGAcademy Digital Logic Lab 7, Part III. verilog PDF · vhdl PDF · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
An LED must send A through H at a pace a person can read. A dot lasts half a second, a dash lasts one and a half seconds, and successive marks within a letter have half a second of darkness between them. Design the controller as a state machine. Before opening the starter, sketch idle, dot, the three units of a dash, and the gap between symbols. Label the transitions that depend on the next symbol or the number of symbols remaining.
Select A through H with SW2–0 (A = 000). KEY1 starts one letter, KEY0 resets it immediately and LEDR0 transmits it. The controller samples the selected letter at the start. CLOCK_50 counts 25,000,000 cycles per half second. Compare the transition leaving the first dash unit with the one in your sketch. A divider change would affect the dots and gaps as well as the dashes.
Simulate
The testbench holds KEY1 down while sending E. Predict how many dots you should see before the key is released.
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench uses five clock edges per half-second unit and checks the light at every edge for all eight letters. It also changes the selector during a letter and asserts reset between clock edges. Run it on the starter, record the first pulse that is too short, and repeat after your correction.
Verilog
iverilog -g2005 -s test_morse -o bench starter/morse_fsm.v simulation/test_morse.v
vvp bench
Build
When the corrected design reports PASS A-H, use the same source file for the board. Keep the half-second unit at 25,000,000 clock cycles.
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
morse_fsm, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Time the physical signal
Send E, then A, then B. Estimate the time LEDR0 stays on during each mark. Decode the remaining letters without looking at the switch setting. If a camera refresh skips a transition, send the letter again. Use the simulation for exact clock counts.
| Test | Expected pattern | Camera observation |
|---|---|---|
| A, B, C, D | .− / −... / −.−. / −.. | |
| E, F, G, H | . / ..−. / −−. / .... | |
| Select C while B is transmitting | ||
| Press KEY0 during the first dash of B | ||
| Send E after reset |
Explain which state holds the LED low between marks, which state ends the last mark and why the letter stays consistent after the switches move. Submit your diagram and one measured dot/dash pair.
Original LabsLand activity following FPGAcademy Digital Logic Lab 7, Part IV. Verilog handout · VHDL handout · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
An LED must send A through H at a pace a person can read. A dot lasts half a second, a dash lasts one and a half seconds, and successive marks within a letter have half a second of darkness between them. Design the controller as a state machine. Before opening the starter, sketch idle, dot, the three units of a dash, and the gap between symbols. Label the transitions that depend on the next symbol or the number of symbols remaining.
Select A through H with SW2–0 (A = 000). KEY1 starts one letter, KEY0 resets it immediately and LEDR0 transmits it. The controller samples the selected letter at the start. CLOCK_50 counts 25,000,000 cycles per half second. Compare the transition leaving the first dash unit with the one in your sketch. A divider change would affect the dots and gaps as well as the dashes.
Simulate
The testbench holds KEY1 down while sending E. Predict how many dots you should see before the key is released.
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench uses five clock edges per half-second unit and checks the light at every edge for all eight letters. It also changes the selector during a letter and asserts reset between clock edges. Run it on the starter, record the first pulse that is too short, and repeat after your correction.
Verilog
iverilog -g2005 -s test_morse -o bench starter/morse_fsm.v simulation/test_morse.v
vvp bench
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
When the corrected design reports PASS A-H, use the same source file for the board. Keep the half-second unit at 25,000,000 clock cycles.
- From the extracted worksheet folder, open
starter/morse_fsm.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
morse_fsm. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/morse_fsm.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Time the physical signal
Send E, then A, then B. Estimate the time LEDR0 stays on during each mark. Decode the remaining letters without looking at the switch setting. If a camera refresh skips a transition, send the letter again. Use the simulation for exact clock counts.
| Test | Expected pattern | Camera observation |
|---|---|---|
| A, B, C, D | .− / −... / −.−. / −.. | |
| E, F, G, H | . / ..−. / −−. / .... | |
| Select C while B is transmitting | ||
| Press KEY0 during the first dash of B | ||
| Send E after reset |
Explain which state holds the LED low between marks, which state ends the last mark and why the letter stays consistent after the switches move. Submit your diagram and one measured dot/dash pair.
Original LabsLand activity following FPGAcademy Digital Logic Lab 7, Part IV. Verilog handout · VHDL handout · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
An LED must send A through H at a pace a person can read. A dot lasts half a second, a dash lasts one and a half seconds, and successive marks within a letter have half a second of darkness between them. Design the controller as a state machine. Before opening the starter, sketch idle, dot, the three units of a dash, and the gap between symbols. Label the transitions that depend on the next symbol or the number of symbols remaining.
Select A through H with SW2–0 (A = 000). KEY1 starts one letter, KEY0 resets it immediately and LEDR0 transmits it. The controller samples the selected letter at the start. CLOCK_50 counts 25,000,000 cycles per half second. Compare the transition leaving the first dash unit with the one in your sketch. A divider change would affect the dots and gaps as well as the dashes.
Simulate
The testbench holds KEY1 down while sending E. Predict how many dots you should see before the key is released.
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench uses five clock edges per half-second unit and checks the light at every edge for all eight letters. It also changes the selector during a letter and asserts reset between clock edges. Run it on the starter, record the first pulse that is too short, and repeat after your correction.
VHDL
nvc --std=2008 -a starter/morse_fsm.vhd simulation/test_morse.vhd
nvc --std=2008 -e test_morse
nvc --std=2008 -r test_morse
Build
When the corrected design reports PASS A-H, use the same source file for the board. Keep the half-second unit at 25,000,000 clock cycles.
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
morse_fsm, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Time the physical signal
Send E, then A, then B. Estimate the time LEDR0 stays on during each mark. Decode the remaining letters without looking at the switch setting. If a camera refresh skips a transition, send the letter again. Use the simulation for exact clock counts.
| Test | Expected pattern | Camera observation |
|---|---|---|
| A, B, C, D | .− / −... / −.−. / −.. | |
| E, F, G, H | . / ..−. / −−. / .... | |
| Select C while B is transmitting | ||
| Press KEY0 during the first dash of B | ||
| Send E after reset |
Explain which state holds the LED low between marks, which state ends the last mark and why the letter stays consistent after the switches move. Submit your diagram and one measured dot/dash pair.
Original LabsLand activity following FPGAcademy Digital Logic Lab 7, Part IV. Verilog handout · VHDL handout · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
An LED must send A through H at a pace a person can read. A dot lasts half a second, a dash lasts one and a half seconds, and successive marks within a letter have half a second of darkness between them. Design the controller as a state machine. Before opening the starter, sketch idle, dot, the three units of a dash, and the gap between symbols. Label the transitions that depend on the next symbol or the number of symbols remaining.
Select A through H with SW2–0 (A = 000). KEY1 starts one letter, KEY0 resets it immediately and LEDR0 transmits it. The controller samples the selected letter at the start. CLOCK_50 counts 25,000,000 cycles per half second. Compare the transition leaving the first dash unit with the one in your sketch. A divider change would affect the dots and gaps as well as the dashes.
Simulate
The testbench holds KEY1 down while sending E. Predict how many dots you should see before the key is released.
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench uses five clock edges per half-second unit and checks the light at every edge for all eight letters. It also changes the selector during a letter and asserts reset between clock edges. Run it on the starter, record the first pulse that is too short, and repeat after your correction.
VHDL
nvc --std=2008 -a starter/morse_fsm.vhd simulation/test_morse.vhd
nvc --std=2008 -e test_morse
nvc --std=2008 -r test_morse
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
When the corrected design reports PASS A-H, use the same source file for the board. Keep the half-second unit at 25,000,000 clock cycles.
- From the extracted worksheet folder, open
starter/morse_fsm.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
morse_fsm. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/morse_fsm.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Time the physical signal
Send E, then A, then B. Estimate the time LEDR0 stays on during each mark. Decode the remaining letters without looking at the switch setting. If a camera refresh skips a transition, send the letter again. Use the simulation for exact clock counts.
| Test | Expected pattern | Camera observation |
|---|---|---|
| A, B, C, D | .− / −... / −.−. / −.. | |
| E, F, G, H | . / ..−. / −−. / .... | |
| Select C while B is transmitting | ||
| Press KEY0 during the first dash of B | ||
| Send E after reset |
Explain which state holds the LED low between marks, which state ends the last mark and why the letter stays consistent after the switches move. Submit your diagram and one measured dot/dash pair.
Original LabsLand activity following FPGAcademy Digital Logic Lab 7, Part IV. Verilog handout · VHDL handout · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
An LED must send A through H at a pace a person can read. A dot lasts half a second, a dash lasts one and a half seconds, and successive marks within a letter have half a second of darkness between them. Design the controller as a state machine. Before opening the starter, sketch idle, dot, the three units of a dash, and the gap between symbols. Label the transitions that depend on the next symbol or the number of symbols remaining.
Select A through H with SW2–0 (A = 000). KEY1 starts one letter, KEY0 resets it immediately and LEDR0 transmits it. The controller samples the selected letter at the start. CLOCK_50 counts 25,000,000 cycles per half second. Compare the transition leaving the first dash unit with the one in your sketch. A divider change would affect the dots and gaps as well as the dashes.
Simulate
The testbench holds KEY1 down while sending E. Predict how many dots you should see before the key is released.
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench uses five clock edges per half-second unit and checks the light at every edge for all eight letters. It also changes the selector during a letter and asserts reset between clock edges. Run it on the starter, record the first pulse that is too short, and repeat after your correction.
SystemVerilog
iverilog -g2012 -s test_morse -o bench starter/morse_fsm.sv simulation/test_morse.v
vvp bench
Build
When the corrected design reports PASS A-H, use the same source file for the board. Keep the half-second unit at 25,000,000 clock cycles.
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
morse_fsm, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Time the physical signal
Send E, then A, then B. Estimate the time LEDR0 stays on during each mark. Decode the remaining letters without looking at the switch setting. If a camera refresh skips a transition, send the letter again. Use the simulation for exact clock counts.
| Test | Expected pattern | Camera observation |
|---|---|---|
| A, B, C, D | .− / −... / −.−. / −.. | |
| E, F, G, H | . / ..−. / −−. / .... | |
| Select C while B is transmitting | ||
| Press KEY0 during the first dash of B | ||
| Send E after reset |
Explain which state holds the LED low between marks, which state ends the last mark and why the letter stays consistent after the switches move. Submit your diagram and one measured dot/dash pair.
Original LabsLand activity following FPGAcademy Digital Logic Lab 7, Part IV. Verilog handout · VHDL handout · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
An LED must send A through H at a pace a person can read. A dot lasts half a second, a dash lasts one and a half seconds, and successive marks within a letter have half a second of darkness between them. Design the controller as a state machine. Before opening the starter, sketch idle, dot, the three units of a dash, and the gap between symbols. Label the transitions that depend on the next symbol or the number of symbols remaining.
Select A through H with SW2–0 (A = 000). KEY1 starts one letter, KEY0 resets it immediately and LEDR0 transmits it. The controller samples the selected letter at the start. CLOCK_50 counts 25,000,000 cycles per half second. Compare the transition leaving the first dash unit with the one in your sketch. A divider change would affect the dots and gaps as well as the dashes.
Simulate
The testbench holds KEY1 down while sending E. Predict how many dots you should see before the key is released.
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench uses five clock edges per half-second unit and checks the light at every edge for all eight letters. It also changes the selector during a letter and asserts reset between clock edges. Run it on the starter, record the first pulse that is too short, and repeat after your correction.
SystemVerilog
iverilog -g2012 -s test_morse -o bench starter/morse_fsm.sv simulation/test_morse.v
vvp bench
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
When the corrected design reports PASS A-H, use the same source file for the board. Keep the half-second unit at 25,000,000 clock cycles.
- From the extracted worksheet folder, open
starter/morse_fsm.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
morse_fsm. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/morse_fsm.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Time the physical signal
Send E, then A, then B. Estimate the time LEDR0 stays on during each mark. Decode the remaining letters without looking at the switch setting. If a camera refresh skips a transition, send the letter again. Use the simulation for exact clock counts.
| Test | Expected pattern | Camera observation |
|---|---|---|
| A, B, C, D | .− / −... / −.−. / −.. | |
| E, F, G, H | . / ..−. / −−. / .... | |
| Select C while B is transmitting | ||
| Press KEY0 during the first dash of B | ||
| Send E after reset |
Explain which state holds the LED low between marks, which state ends the last mark and why the letter stays consistent after the switches move. Submit your diagram and one measured dot/dash pair.
Original LabsLand activity following FPGAcademy Digital Logic Lab 7, Part IV. Verilog handout · VHDL handout · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Use the Quartus IP Catalog to configure a small synchronous RAM. Determine how many logical bits the design needs and how many physical memory blocks the fitter allocates.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Open project/memory_ip_probe.qpf from the extracted worksheet ZIP. In the IP Catalog, select RAM: 1-PORT for Cyclone V. Save the variation as course_ram in the same project folder. Choose Verilog for the generated component. Quartus can connect this component to each supported top-level HDL.
Set the output width to 4 and the depth to 32 words. Use a single clock and registered inputs. On the register page, clear q output port. Keep the default single-port read-during-write setting and finish the wizard. Check that course_ram.qip is listed once among the project files. Inspect the RAM write-enable connection in the starter. SW9 high should enable writing. Test the original behavior, correct the polarity and repeat.
Compile and open Compilation Report → Fitter → Resource Section → RAM Summary. Record the memory width and depth, total block memory bits, physical RAM block count and the device name. Which changes if you halve the depth while keeping this memory in a dedicated block? Mark your prediction before trying a separate copy of the project.
Simulate
Use Python 3 and Icarus Verilog. Generate the Verilog IP component in Quartus first. Run this command from the root of the extracted worksheet. Set QUARTUS_ROOTDIR to the Quartus folder that contains eda, or supply it with --quartus-root.
If you have both Quartus releases installed, open project/course_ram.qip and check its IP_TOOL_VERSION against the release at the top of your worksheet. If they differ, regenerate the component in the selected release. Use the quartus folder from that installation for the simulation library.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
Verilog
python3 simulation/simulate_memory_ip.py project/memory_ip_probe.v project/course_ram.v simulation/test_memory_ip_probe.v
The bench writes one address-dependent nibble into each of the 32 words, reads them in reverse, prepares a canceled write and changes one word.
Test on the DE1-SoC
Upload output_files/memory_ip_probe.sof. SW8–4 select a word, SW3–0 set the input data and SW9 enables writes. Hold the switches steady, press KEY0 and release it to clock the operation. Read the result on LED3–0 as a binary nibble.
With SW9 high, write A at address 00, B at 10, C at 0F and 3 at 1F. Lower SW9 and read the four words in a different order. Prepare a write of 5 at 00 but lower SW9 before releasing KEY0. Read 00. Now complete the write and verify that address 10 still holds its own word.
| Address in hex | Written | First read | After changing 00 |
|---|---|---|---|
| 00 | A | ||
| 10 | B | ||
| 0F | C | ||
| 1F | 3 |
FPGAcademy · Digital Logic · Lab 8 · I. Verilog · VHDL · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Use the Quartus IP Catalog to configure a small synchronous RAM. Determine how many logical bits the design needs and how many physical memory blocks the fitter allocates.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Open project/memory_ip_probe.qpf from the extracted worksheet ZIP. In the IP Catalog, select RAM: 1-PORT for Cyclone V. Save the variation as course_ram in the same project folder. Choose Verilog for the generated component. Quartus can connect this component to each supported top-level HDL.
Set the output width to 4 and the depth to 32 words. Use a single clock and registered inputs. On the register page, clear q output port. Keep the default single-port read-during-write setting and finish the wizard. Check that course_ram.qip is listed once among the project files. Inspect the RAM write-enable connection in the starter. SW9 high should enable writing. Test the original behavior, correct the polarity and repeat.
Compile and open Compilation Report → Fitter → Resource Section → RAM Summary. Record the memory width and depth, total block memory bits, physical RAM block count and the device name. Which changes if you halve the depth while keeping this memory in a dedicated block? Mark your prediction before trying a separate copy of the project.
Simulate
Use Python 3 and Icarus Verilog. Generate the Verilog IP component in Quartus first. Run this command from the root of the extracted worksheet. Set QUARTUS_ROOTDIR to the Quartus folder that contains eda, or supply it with --quartus-root.
If you have both Quartus releases installed, open project/course_ram.qip and check its IP_TOOL_VERSION against the release at the top of your worksheet. If they differ, regenerate the component in the selected release. Use the quartus folder from that installation for the simulation library.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
VHDL also requires GHDL with synthesis support.
python3 simulation/simulate_memory_ip.py project/memory_ip_probe.vhd project/course_ram.v simulation/test_memory_ip_probe.v
The bench writes one address-dependent nibble into each of the 32 words, reads them in reverse, prepares a canceled write and changes one word.
Test on the DE1-SoC
Upload output_files/memory_ip_probe.sof. SW8–4 select a word, SW3–0 set the input data and SW9 enables writes. Hold the switches steady, press KEY0 and release it to clock the operation. Read the result on LED3–0 as a binary nibble.
With SW9 high, write A at address 00, B at 10, C at 0F and 3 at 1F. Lower SW9 and read the four words in a different order. Prepare a write of 5 at 00 but lower SW9 before releasing KEY0. Read 00. Now complete the write and verify that address 10 still holds its own word.
| Address in hex | Written | First read | After changing 00 |
|---|---|---|---|
| 00 | A | ||
| 10 | B | ||
| 0F | C | ||
| 1F | 3 |
FPGAcademy · Digital Logic · Lab 8 · I. Verilog · VHDL · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Use the Quartus IP Catalog to configure a small synchronous RAM. Determine how many logical bits the design needs and how many physical memory blocks the fitter allocates.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Open project/memory_ip_probe.qpf from the extracted worksheet ZIP. In the IP Catalog, select RAM: 1-PORT for Cyclone V. Save the variation as course_ram in the same project folder. Choose Verilog for the generated component. Quartus can connect this component to each supported top-level HDL.
Set the output width to 4 and the depth to 32 words. Use a single clock and registered inputs. On the register page, clear q output port. Keep the default single-port read-during-write setting and finish the wizard. Check that course_ram.qip is listed once among the project files. Inspect the RAM write-enable connection in the starter. SW9 high should enable writing. Test the original behavior, correct the polarity and repeat.
Compile and open Compilation Report → Fitter → Resource Section → RAM Summary. Record the memory width and depth, total block memory bits, physical RAM block count and the device name. Which changes if you halve the depth while keeping this memory in a dedicated block? Mark your prediction before trying a separate copy of the project.
Simulate
Use Python 3 and Icarus Verilog. Generate the Verilog IP component in Quartus first. Run this command from the root of the extracted worksheet. Set QUARTUS_ROOTDIR to the Quartus folder that contains eda, or supply it with --quartus-root.
If you have both Quartus releases installed, open project/course_ram.qip and check its IP_TOOL_VERSION against the release at the top of your worksheet. If they differ, regenerate the component in the selected release. Use the quartus folder from that installation for the simulation library.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
SystemVerilog
python3 simulation/simulate_memory_ip.py project/memory_ip_probe.sv project/course_ram.v simulation/test_memory_ip_probe.v
The bench writes one address-dependent nibble into each of the 32 words, reads them in reverse, prepares a canceled write and changes one word.
Test on the DE1-SoC
Upload output_files/memory_ip_probe.sof. SW8–4 select a word, SW3–0 set the input data and SW9 enables writes. Hold the switches steady, press KEY0 and release it to clock the operation. Read the result on LED3–0 as a binary nibble.
With SW9 high, write A at address 00, B at 10, C at 0F and 3 at 1F. Lower SW9 and read the four words in a different order. Prepare a write of 5 at 00 but lower SW9 before releasing KEY0. Read 00. Now complete the write and verify that address 10 still holds its own word.
| Address in hex | Written | First read | After changing 00 |
|---|---|---|---|
| 00 | A | ||
| 10 | B | ||
| 0F | C | ||
| 1F | 3 |
FPGAcademy · Digital Logic · Lab 8 · I. Verilog · VHDL · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Connect a single-port RAM to four hexadecimal digits. Use two pairs of addresses to test whether separate words remain independent after successive writes.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Open project/memory_ip_display.qpf from the extracted worksheet ZIP. In the IP Catalog, select RAM: 1-PORT for Cyclone V. Save the variation as course_ram in the same project folder. Choose Verilog for the generated component. Quartus can connect this component to each supported top-level HDL.
Set the output width to 4 and the depth to 32 words. Use a single clock and registered inputs. On the register page, clear q output port. Keep the default single-port read-during-write setting and finish the wizard. Check that course_ram.qip is listed once among the project files. The address display shows all five switches. The starter loses one bit on the way to the RAM. Demonstrate which writes overwrite each other, repair that path and retest.
Compile and open Compilation Report → Fitter → Resource Section → RAM Summary. Record the memory width and depth, total block memory bits, physical RAM block count and the device name. Which changes if you halve the depth while keeping this memory in a dedicated block? Mark your prediction before trying a separate copy of the project.
Simulate
Use Python 3 and Icarus Verilog. Generate the Verilog IP component in Quartus first. Run this command from the root of the extracted worksheet. Set QUARTUS_ROOTDIR to the Quartus folder that contains eda, or supply it with --quartus-root.
If you have both Quartus releases installed, open project/course_ram.qip and check its IP_TOOL_VERSION against the release at the top of your worksheet. If they differ, regenerate the component in the selected release. Use the quartus folder from that installation for the simulation library.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
Verilog
python3 simulation/simulate_memory_ip.py project/memory_ip_display.v project/course_ram.v simulation/test_memory_ip_display.v
The bench writes one address-dependent nibble into each of the 32 words, reads them in reverse, prepares a canceled write and changes one word.
Test on the DE1-SoC
Upload output_files/memory_ip_display.sof. SW8–4 select a word, SW3–0 set the input data and SW9 enables writes. Hold the switches steady, press KEY0 and release it to clock the operation. HEX5–4 show the address, HEX2 the input nibble and HEX0 the memory output. HEX3 and HEX1 stay blank.
With SW9 high, write A at address 00, B at 10, C at 0F and 3 at 1F. Lower SW9 and read the four words in a different order. Prepare a write of 5 at 00 but lower SW9 before releasing KEY0. Read 00. Now complete the write and verify that address 10 still holds its own word.
| Address in hex | Written | First read | After changing 00 |
|---|---|---|---|
| 00 | A | ||
| 10 | B | ||
| 0F | C | ||
| 1F | 3 |
FPGAcademy · Digital Logic · Lab 8 · II. Verilog · VHDL · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Connect a single-port RAM to four hexadecimal digits. Use two pairs of addresses to test whether separate words remain independent after successive writes.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Open project/memory_ip_display.qpf from the extracted worksheet ZIP. In the IP Catalog, select RAM: 1-PORT for Cyclone V. Save the variation as course_ram in the same project folder. Choose Verilog for the generated component. Quartus can connect this component to each supported top-level HDL.
Set the output width to 4 and the depth to 32 words. Use a single clock and registered inputs. On the register page, clear q output port. Keep the default single-port read-during-write setting and finish the wizard. Check that course_ram.qip is listed once among the project files. The address display shows all five switches. The starter loses one bit on the way to the RAM. Demonstrate which writes overwrite each other, repair that path and retest.
Compile and open Compilation Report → Fitter → Resource Section → RAM Summary. Record the memory width and depth, total block memory bits, physical RAM block count and the device name. Which changes if you halve the depth while keeping this memory in a dedicated block? Mark your prediction before trying a separate copy of the project.
Simulate
Use Python 3 and Icarus Verilog. Generate the Verilog IP component in Quartus first. Run this command from the root of the extracted worksheet. Set QUARTUS_ROOTDIR to the Quartus folder that contains eda, or supply it with --quartus-root.
If you have both Quartus releases installed, open project/course_ram.qip and check its IP_TOOL_VERSION against the release at the top of your worksheet. If they differ, regenerate the component in the selected release. Use the quartus folder from that installation for the simulation library.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
VHDL also requires GHDL with synthesis support.
python3 simulation/simulate_memory_ip.py project/memory_ip_display.vhd project/course_ram.v simulation/test_memory_ip_display.v
The bench writes one address-dependent nibble into each of the 32 words, reads them in reverse, prepares a canceled write and changes one word.
Test on the DE1-SoC
Upload output_files/memory_ip_display.sof. SW8–4 select a word, SW3–0 set the input data and SW9 enables writes. Hold the switches steady, press KEY0 and release it to clock the operation. HEX5–4 show the address, HEX2 the input nibble and HEX0 the memory output. HEX3 and HEX1 stay blank.
With SW9 high, write A at address 00, B at 10, C at 0F and 3 at 1F. Lower SW9 and read the four words in a different order. Prepare a write of 5 at 00 but lower SW9 before releasing KEY0. Read 00. Now complete the write and verify that address 10 still holds its own word.
| Address in hex | Written | First read | After changing 00 |
|---|---|---|---|
| 00 | A | ||
| 10 | B | ||
| 0F | C | ||
| 1F | 3 |
FPGAcademy · Digital Logic · Lab 8 · II. Verilog · VHDL · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Connect a single-port RAM to four hexadecimal digits. Use two pairs of addresses to test whether separate words remain independent after successive writes.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Open project/memory_ip_display.qpf from the extracted worksheet ZIP. In the IP Catalog, select RAM: 1-PORT for Cyclone V. Save the variation as course_ram in the same project folder. Choose Verilog for the generated component. Quartus can connect this component to each supported top-level HDL.
Set the output width to 4 and the depth to 32 words. Use a single clock and registered inputs. On the register page, clear q output port. Keep the default single-port read-during-write setting and finish the wizard. Check that course_ram.qip is listed once among the project files. The address display shows all five switches. The starter loses one bit on the way to the RAM. Demonstrate which writes overwrite each other, repair that path and retest.
Compile and open Compilation Report → Fitter → Resource Section → RAM Summary. Record the memory width and depth, total block memory bits, physical RAM block count and the device name. Which changes if you halve the depth while keeping this memory in a dedicated block? Mark your prediction before trying a separate copy of the project.
Simulate
Use Python 3 and Icarus Verilog. Generate the Verilog IP component in Quartus first. Run this command from the root of the extracted worksheet. Set QUARTUS_ROOTDIR to the Quartus folder that contains eda, or supply it with --quartus-root.
If you have both Quartus releases installed, open project/course_ram.qip and check its IP_TOOL_VERSION against the release at the top of your worksheet. If they differ, regenerate the component in the selected release. Use the quartus folder from that installation for the simulation library.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
SystemVerilog
python3 simulation/simulate_memory_ip.py project/memory_ip_display.sv project/course_ram.v simulation/test_memory_ip_display.v
The bench writes one address-dependent nibble into each of the 32 words, reads them in reverse, prepares a canceled write and changes one word.
Test on the DE1-SoC
Upload output_files/memory_ip_display.sof. SW8–4 select a word, SW3–0 set the input data and SW9 enables writes. Hold the switches steady, press KEY0 and release it to clock the operation. HEX5–4 show the address, HEX2 the input nibble and HEX0 the memory output. HEX3 and HEX1 stay blank.
With SW9 high, write A at address 00, B at 10, C at 0F and 3 at 1F. Lower SW9 and read the four words in a different order. Prepare a write of 5 at 00 but lower SW9 before releasing KEY0. Read 00. Now complete the write and verify that address 10 still holds its own word.
| Address in hex | Written | First read | After changing 00 |
|---|---|---|---|
| 00 | A | ||
| 10 | B | ||
| 0F | C | ||
| 1F | 3 |
FPGAcademy · Digital Logic · Lab 8 · II. Verilog · VHDL · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Build a memory from an HDL array of 32 four-bit words. You will write distinct values to addresses that differ by just their most significant bit. The last read value stays on the right-hand display while you prepare the next operation.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
inferred_ram, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
SW8–4 select the address, SW3–0 supply a nibble, and SW9 selects write (high) or read (low). KEY0 performs the operation when released. HEX5–4 show the address in hexadecimal, HEX2 shows the input data and HEX0 shows the last completed read. HEX3 and HEX1 are blank. Work out how many flip-flops a simple register implementation would need for the stored bits alone.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The testbench writes and reads every possible nibble at each of the 32 addresses. Before each read clock it checks that changing switches leaves the last result in place.
Verilog
iverilog -g2005 -s test_ram -o bench starter/inferred_ram.v simulation/test_ram.v
vvp bench
With the original starter, record the first address that fails. After you repair the read index, run the same commands again. Look for PASS 512 writes and 512 reads, address and data displays, registered hold.
Probe two addresses that look alike
Build the unchanged starter and program the DE1-SoC. Write A to address 00. Turn writing off, change the input nibble to F, and release KEY0 once. Then write B to address 10. Switch back to read mode with address 10 selected. Read HEX0 before and after the next key release. Changing the data switches in read mode should affect HEX2 immediately.
| Hex address | Value written | Readback before repair | Readback after repair |
|---|---|---|---|
| 00 | A | ||
| 10 | B | ||
| 0F | C | ||
| 1F | 3 |
Write the remaining two words from the table. Read all four addresses in a different order and fill in the before-repair column. Which address bit distinguishes each pair? Find where the read index loses that bit. After the repair, rerun the simulation, rebuild and program the board through the same workflow. Write all four words again before you fill in the after-repair column. Set up a write of 5 at 00 but turn off SW9 again before any KEY0 release. Test whether the previous word remains. Now perform that write and show which other addresses retained their contents. An unwritten location has no specified value in this exercise.
Original LabsLand activity following FPGAcademy Digital Logic Lab 8, Part III. Verilog handout · VHDL handout · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Build a memory from an HDL array of 32 four-bit words. You will write distinct values to addresses that differ by just their most significant bit. The last read value stays on the right-hand display while you prepare the next operation.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/inferred_ram.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
inferred_ram. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/inferred_ram.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
SW8–4 select the address, SW3–0 supply a nibble, and SW9 selects write (high) or read (low). KEY0 performs the operation when released. HEX5–4 show the address in hexadecimal, HEX2 shows the input data and HEX0 shows the last completed read. HEX3 and HEX1 are blank. Work out how many flip-flops a simple register implementation would need for the stored bits alone.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The testbench writes and reads every possible nibble at each of the 32 addresses. Before each read clock it checks that changing switches leaves the last result in place.
Verilog
iverilog -g2005 -s test_ram -o bench starter/inferred_ram.v simulation/test_ram.v
vvp bench
With the original starter, record the first address that fails. After you repair the read index, run the same commands again. Look for PASS 512 writes and 512 reads, address and data displays, registered hold.
Probe two addresses that look alike
Build the unchanged starter and program the DE1-SoC. Write A to address 00. Turn writing off, change the input nibble to F, and release KEY0 once. Then write B to address 10. Switch back to read mode with address 10 selected. Read HEX0 before and after the next key release. Changing the data switches in read mode should affect HEX2 immediately.
| Hex address | Value written | Readback before repair | Readback after repair |
|---|---|---|---|
| 00 | A | ||
| 10 | B | ||
| 0F | C | ||
| 1F | 3 |
Write the remaining two words from the table. Read all four addresses in a different order and fill in the before-repair column. Which address bit distinguishes each pair? Find where the read index loses that bit. After the repair, rerun the simulation, rebuild and program the board through the same workflow. Write all four words again before you fill in the after-repair column. Set up a write of 5 at 00 but turn off SW9 again before any KEY0 release. Test whether the previous word remains. Now perform that write and show which other addresses retained their contents. An unwritten location has no specified value in this exercise.
Original LabsLand activity following FPGAcademy Digital Logic Lab 8, Part III. Verilog handout · VHDL handout · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Build a memory from an HDL array of 32 four-bit words. You will write distinct values to addresses that differ by just their most significant bit. The last read value stays on the right-hand display while you prepare the next operation.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
inferred_ram, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
SW8–4 select the address, SW3–0 supply a nibble, and SW9 selects write (high) or read (low). KEY0 performs the operation when released. HEX5–4 show the address in hexadecimal, HEX2 shows the input data and HEX0 shows the last completed read. HEX3 and HEX1 are blank. Work out how many flip-flops a simple register implementation would need for the stored bits alone.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The testbench writes and reads every possible nibble at each of the 32 addresses. Before each read clock it checks that changing switches leaves the last result in place.
VHDL
nvc --std=2008 -a starter/inferred_ram.vhd simulation/test_ram.vhd
nvc --std=2008 -e test_ram
nvc --std=2008 -r test_ram
With the original starter, record the first address that fails. After you repair the read index, run the same commands again. Look for PASS 512 writes and 512 reads, address and data displays, registered hold.
Probe two addresses that look alike
Build the unchanged starter and program the DE1-SoC. Write A to address 00. Turn writing off, change the input nibble to F, and release KEY0 once. Then write B to address 10. Switch back to read mode with address 10 selected. Read HEX0 before and after the next key release. Changing the data switches in read mode should affect HEX2 immediately.
| Hex address | Value written | Readback before repair | Readback after repair |
|---|---|---|---|
| 00 | A | ||
| 10 | B | ||
| 0F | C | ||
| 1F | 3 |
Write the remaining two words from the table. Read all four addresses in a different order and fill in the before-repair column. Which address bit distinguishes each pair? Find where the read index loses that bit. After the repair, rerun the simulation, rebuild and program the board through the same workflow. Write all four words again before you fill in the after-repair column. Set up a write of 5 at 00 but turn off SW9 again before any KEY0 release. Test whether the previous word remains. Now perform that write and show which other addresses retained their contents. An unwritten location has no specified value in this exercise.
Original LabsLand activity following FPGAcademy Digital Logic Lab 8, Part III. Verilog handout · VHDL handout · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Build a memory from an HDL array of 32 four-bit words. You will write distinct values to addresses that differ by just their most significant bit. The last read value stays on the right-hand display while you prepare the next operation.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/inferred_ram.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
inferred_ram. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/inferred_ram.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
SW8–4 select the address, SW3–0 supply a nibble, and SW9 selects write (high) or read (low). KEY0 performs the operation when released. HEX5–4 show the address in hexadecimal, HEX2 shows the input data and HEX0 shows the last completed read. HEX3 and HEX1 are blank. Work out how many flip-flops a simple register implementation would need for the stored bits alone.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The testbench writes and reads every possible nibble at each of the 32 addresses. Before each read clock it checks that changing switches leaves the last result in place.
VHDL
nvc --std=2008 -a starter/inferred_ram.vhd simulation/test_ram.vhd
nvc --std=2008 -e test_ram
nvc --std=2008 -r test_ram
With the original starter, record the first address that fails. After you repair the read index, run the same commands again. Look for PASS 512 writes and 512 reads, address and data displays, registered hold.
Probe two addresses that look alike
Build the unchanged starter and program the DE1-SoC. Write A to address 00. Turn writing off, change the input nibble to F, and release KEY0 once. Then write B to address 10. Switch back to read mode with address 10 selected. Read HEX0 before and after the next key release. Changing the data switches in read mode should affect HEX2 immediately.
| Hex address | Value written | Readback before repair | Readback after repair |
|---|---|---|---|
| 00 | A | ||
| 10 | B | ||
| 0F | C | ||
| 1F | 3 |
Write the remaining two words from the table. Read all four addresses in a different order and fill in the before-repair column. Which address bit distinguishes each pair? Find where the read index loses that bit. After the repair, rerun the simulation, rebuild and program the board through the same workflow. Write all four words again before you fill in the after-repair column. Set up a write of 5 at 00 but turn off SW9 again before any KEY0 release. Test whether the previous word remains. Now perform that write and show which other addresses retained their contents. An unwritten location has no specified value in this exercise.
Original LabsLand activity following FPGAcademy Digital Logic Lab 8, Part III. Verilog handout · VHDL handout · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Build a memory from an HDL array of 32 four-bit words. You will write distinct values to addresses that differ by just their most significant bit. The last read value stays on the right-hand display while you prepare the next operation.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
inferred_ram, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
SW8–4 select the address, SW3–0 supply a nibble, and SW9 selects write (high) or read (low). KEY0 performs the operation when released. HEX5–4 show the address in hexadecimal, HEX2 shows the input data and HEX0 shows the last completed read. HEX3 and HEX1 are blank. Work out how many flip-flops a simple register implementation would need for the stored bits alone.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The testbench writes and reads every possible nibble at each of the 32 addresses. Before each read clock it checks that changing switches leaves the last result in place.
SystemVerilog
iverilog -g2012 -s test_ram -o bench starter/inferred_ram.sv simulation/test_ram.v
vvp bench
With the original starter, record the first address that fails. After you repair the read index, run the same commands again. Look for PASS 512 writes and 512 reads, address and data displays, registered hold.
Probe two addresses that look alike
Build the unchanged starter and program the DE1-SoC. Write A to address 00. Turn writing off, change the input nibble to F, and release KEY0 once. Then write B to address 10. Switch back to read mode with address 10 selected. Read HEX0 before and after the next key release. Changing the data switches in read mode should affect HEX2 immediately.
| Hex address | Value written | Readback before repair | Readback after repair |
|---|---|---|---|
| 00 | A | ||
| 10 | B | ||
| 0F | C | ||
| 1F | 3 |
Write the remaining two words from the table. Read all four addresses in a different order and fill in the before-repair column. Which address bit distinguishes each pair? Find where the read index loses that bit. After the repair, rerun the simulation, rebuild and program the board through the same workflow. Write all four words again before you fill in the after-repair column. Set up a write of 5 at 00 but turn off SW9 again before any KEY0 release. Test whether the previous word remains. Now perform that write and show which other addresses retained their contents. An unwritten location has no specified value in this exercise.
Original LabsLand activity following FPGAcademy Digital Logic Lab 8, Part III. Verilog handout · VHDL handout · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Build a memory from an HDL array of 32 four-bit words. You will write distinct values to addresses that differ by just their most significant bit. The last read value stays on the right-hand display while you prepare the next operation.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/inferred_ram.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
inferred_ram. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/inferred_ram.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
SW8–4 select the address, SW3–0 supply a nibble, and SW9 selects write (high) or read (low). KEY0 performs the operation when released. HEX5–4 show the address in hexadecimal, HEX2 shows the input data and HEX0 shows the last completed read. HEX3 and HEX1 are blank. Work out how many flip-flops a simple register implementation would need for the stored bits alone.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The testbench writes and reads every possible nibble at each of the 32 addresses. Before each read clock it checks that changing switches leaves the last result in place.
SystemVerilog
iverilog -g2012 -s test_ram -o bench starter/inferred_ram.sv simulation/test_ram.v
vvp bench
With the original starter, record the first address that fails. After you repair the read index, run the same commands again. Look for PASS 512 writes and 512 reads, address and data displays, registered hold.
Probe two addresses that look alike
Build the unchanged starter and program the DE1-SoC. Write A to address 00. Turn writing off, change the input nibble to F, and release KEY0 once. Then write B to address 10. Switch back to read mode with address 10 selected. Read HEX0 before and after the next key release. Changing the data switches in read mode should affect HEX2 immediately.
| Hex address | Value written | Readback before repair | Readback after repair |
|---|---|---|---|
| 00 | A | ||
| 10 | B | ||
| 0F | C | ||
| 1F | 3 |
Write the remaining two words from the table. Read all four addresses in a different order and fill in the before-repair column. Which address bit distinguishes each pair? Find where the read index loses that bit. After the repair, rerun the simulation, rebuild and program the board through the same workflow. Write all four words again before you fill in the after-repair column. Set up a write of 5 at 00 but turn off SW9 again before any KEY0 release. Test whether the previous word remains. Now perform that write and show which other addresses retained their contents. An unwritten location has no specified value in this exercise.
Original LabsLand activity following FPGAcademy Digital Logic Lab 8, Part III. Verilog handout · VHDL handout · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Display a 32-word memory in a loop while keeping an independent write address. A two-stage synchronizer brings the switches into the 50 MHz clock domain. Predict what a reset should do to the read address and to a word you have just changed.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Open project/memory_ip_scan.qpf. In IP Catalog select RAM: 2-PORT, save a Verilog component named course_dual in the project directory and choose one read port and one write port. Use 32 four-bit words, a single clock and registered inputs. Clear the read-output register. For mixed-port read during write select I do not care (the outputs will be undefined). Enable memory initialization and enter pattern.mif from the project directory. Finish the wizard and check that course_dual.qip is included once.
Inspect the supplied MIF. Predict locations 00, 0F, 10 and 1F. The scan starts at zero and advances once per second. Inspect the read and write port connections in the starter. One uses the wrong address source. Repair it, then compile. Find the allocated memory block in the Fitter report and record its size and mode.
Simulate
Use Python 3 and Icarus Verilog. Generate the Verilog IP component in Quartus first. Run this command from the root of the extracted worksheet. Set QUARTUS_ROOTDIR to the Quartus folder that contains eda, or supply it with --quartus-root.
If you have both Quartus releases installed, open project/course_dual.qip and check its IP_TOOL_VERSION against the release at the top of your worksheet. If they differ, regenerate the component in the selected release. Use the quartus folder from that installation for the simulation library.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
Verilog
python3 simulation/simulate_memory_ip.py project/memory_ip_scan.v project/course_dual.v simulation/test_memory_ip_scan.v
The bench accelerates the read-address divider to four clock cycles per word. It reads all 32 initial words, writes two new values, resets the scanner and checks the full memory again.
Test on the DE1-SoC
Upload output_files/memory_ip_scan.sof. Keep SW9 low and press and release KEY0. HEX3–2 show the scanned address, HEX0 the word at that address. Watch the transition from 0F to 10 and the wrap from 1F to 00.
Set SW8–4 to 11 hexadecimal and SW3–0 to D. HEX5–4 and HEX1 show the proposed write. Raise SW9 briefly, then lower it before changing the switches. Write E at 02 in the same way. Read each word on the next scan with writing disabled. Hold KEY0 and release it again. Did resetting the scanner restore the original words? Read a neighboring address to justify your answer. A read during a write to the same address has an unspecified value. Use a later read when you record the result.
If glare makes two digits look alike, use the row of red LEDs below them. LEDR8–4 give the five-bit read address. LEDR3–0 give the four-bit word. Read both groups in the same camera frame and convert each to hexadecimal.
| Read address | Initial value | After writes | After scanner reset |
|---|---|---|---|
| 01 | |||
| 02 | |||
| 10 | |||
| 11 | |||
| 1F |
FPGAcademy · Digital Logic · Lab 8 · IV. Verilog · VHDL · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Display a 32-word memory in a loop while keeping an independent write address. A two-stage synchronizer brings the switches into the 50 MHz clock domain. Predict what a reset should do to the read address and to a word you have just changed.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Open project/memory_ip_scan.qpf. In IP Catalog select RAM: 2-PORT, save a Verilog component named course_dual in the project directory and choose one read port and one write port. Use 32 four-bit words, a single clock and registered inputs. Clear the read-output register. For mixed-port read during write select I do not care (the outputs will be undefined). Enable memory initialization and enter pattern.mif from the project directory. Finish the wizard and check that course_dual.qip is included once.
Inspect the supplied MIF. Predict locations 00, 0F, 10 and 1F. The scan starts at zero and advances once per second. Inspect the read and write port connections in the starter. One uses the wrong address source. Repair it, then compile. Find the allocated memory block in the Fitter report and record its size and mode.
Simulate
Use Python 3 and Icarus Verilog. Generate the Verilog IP component in Quartus first. Run this command from the root of the extracted worksheet. Set QUARTUS_ROOTDIR to the Quartus folder that contains eda, or supply it with --quartus-root.
If you have both Quartus releases installed, open project/course_dual.qip and check its IP_TOOL_VERSION against the release at the top of your worksheet. If they differ, regenerate the component in the selected release. Use the quartus folder from that installation for the simulation library.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
VHDL also requires GHDL with synthesis support.
python3 simulation/simulate_memory_ip.py project/memory_ip_scan.vhd project/course_dual.v simulation/test_memory_ip_scan.v
The bench accelerates the read-address divider to four clock cycles per word. It reads all 32 initial words, writes two new values, resets the scanner and checks the full memory again.
Test on the DE1-SoC
Upload output_files/memory_ip_scan.sof. Keep SW9 low and press and release KEY0. HEX3–2 show the scanned address, HEX0 the word at that address. Watch the transition from 0F to 10 and the wrap from 1F to 00.
Set SW8–4 to 11 hexadecimal and SW3–0 to D. HEX5–4 and HEX1 show the proposed write. Raise SW9 briefly, then lower it before changing the switches. Write E at 02 in the same way. Read each word on the next scan with writing disabled. Hold KEY0 and release it again. Did resetting the scanner restore the original words? Read a neighboring address to justify your answer. A read during a write to the same address has an unspecified value. Use a later read when you record the result.
If glare makes two digits look alike, use the row of red LEDs below them. LEDR8–4 give the five-bit read address. LEDR3–0 give the four-bit word. Read both groups in the same camera frame and convert each to hexadecimal.
| Read address | Initial value | After writes | After scanner reset |
|---|---|---|---|
| 01 | |||
| 02 | |||
| 10 | |||
| 11 | |||
| 1F |
FPGAcademy · Digital Logic · Lab 8 · IV. Verilog · VHDL · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Display a 32-word memory in a loop while keeping an independent write address. A two-stage synchronizer brings the switches into the 50 MHz clock domain. Predict what a reset should do to the read address and to a word you have just changed.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Open project/memory_ip_scan.qpf. In IP Catalog select RAM: 2-PORT, save a Verilog component named course_dual in the project directory and choose one read port and one write port. Use 32 four-bit words, a single clock and registered inputs. Clear the read-output register. For mixed-port read during write select I do not care (the outputs will be undefined). Enable memory initialization and enter pattern.mif from the project directory. Finish the wizard and check that course_dual.qip is included once.
Inspect the supplied MIF. Predict locations 00, 0F, 10 and 1F. The scan starts at zero and advances once per second. Inspect the read and write port connections in the starter. One uses the wrong address source. Repair it, then compile. Find the allocated memory block in the Fitter report and record its size and mode.
Simulate
Use Python 3 and Icarus Verilog. Generate the Verilog IP component in Quartus first. Run this command from the root of the extracted worksheet. Set QUARTUS_ROOTDIR to the Quartus folder that contains eda, or supply it with --quartus-root.
If you have both Quartus releases installed, open project/course_dual.qip and check its IP_TOOL_VERSION against the release at the top of your worksheet. If they differ, regenerate the component in the selected release. Use the quartus folder from that installation for the simulation library.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
SystemVerilog
python3 simulation/simulate_memory_ip.py project/memory_ip_scan.sv project/course_dual.v simulation/test_memory_ip_scan.v
The bench accelerates the read-address divider to four clock cycles per word. It reads all 32 initial words, writes two new values, resets the scanner and checks the full memory again.
Test on the DE1-SoC
Upload output_files/memory_ip_scan.sof. Keep SW9 low and press and release KEY0. HEX3–2 show the scanned address, HEX0 the word at that address. Watch the transition from 0F to 10 and the wrap from 1F to 00.
Set SW8–4 to 11 hexadecimal and SW3–0 to D. HEX5–4 and HEX1 show the proposed write. Raise SW9 briefly, then lower it before changing the switches. Write E at 02 in the same way. Read each word on the next scan with writing disabled. Hold KEY0 and release it again. Did resetting the scanner restore the original words? Read a neighboring address to justify your answer. A read during a write to the same address has an unspecified value. Use a later read when you record the result.
If glare makes two digits look alike, use the row of red LEDs below them. LEDR8–4 give the five-bit read address. LEDR3–0 give the four-bit word. Read both groups in the same camera frame and convert each to hexadecimal.
| Read address | Initial value | After writes | After scanner reset |
|---|---|---|---|
| 01 | |||
| 02 | |||
| 10 | |||
| 11 | |||
| 1F |
FPGAcademy · Digital Logic · Lab 8 · IV. Verilog · VHDL · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Follow one instruction from the input bus to a destination register. This processor has eight 16-bit registers, a shared bus, a saved first operand and an arithmetic result register. Sketch the path taken by the value in r1 during sub r1,r0. At which clock edge can another instruction safely read the new r1?
Decode the words
In bits 15–13 the opcodes for move, move-top, add and subtract are 0, 1, 2 and 3. Bit 12 selects an immediate operand. Bits 11–9 select the destination. A register operand uses bits 2–0 for its source. A signed immediate occupies bits 8–0. Move-top places the low eight immediate bits in the high byte and clears the low byte. Decode the five words in the table before running them.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
step_cpu, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
The file contains both the processor and a board interface. The arithmetic unit is 16 bits wide. In the starter, using a negative nine-bit literal can give a surprising result. Run the simulation below with the starter. For the first failing instruction, compare the high byte of the destination with the high byte you predicted. Repair the operand conversion, rerun the test, then build your corrected design for the board.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The test executes 512 instructions, checks the handshake at each phase and reads all eight registers after each write. Run the starter first and keep one mismatch for your report.
Verilog
iverilog -g2005 -s test_cpu -o bench starter/step_cpu.v simulation/test_cpu.v
vvp bench
Single-step on the board
Press KEY3 to reset. For each instruction set SW7–0 to its high byte and press and release KEY1. Set the low byte and press and release KEY2. With the instruction latched, SW2–0 can select a register for inspection. Select the destination. Leave SW8 low to read its low byte on LED7–0. Raise SW8 to read the high byte.
Raise SW9 and press and release KEY0 once to fetch. Lower SW9. Each time you press and release KEY0, the processor advances on release. Use one more press and release for a move, or three for arithmetic. Watch LED8, which indicates an active instruction, and LED9, which tells you that the next edge will write the destination. Try an extra clock while SW9 is low and the processor is idle.
| Word | Instruction | Prediction (hex) | Camera (high/low) | Write edge |
|---|---|---|---|---|
| 11FD | mv r0,#−3 | |||
| 5005 | add r0,#5 | |||
| 3234 | mvt r1,#0x34 | |||
| 6200 | sub r1,r0 | |||
| 0E01 | mv r7,r1 |
For 6200, select r1 and keep SW8 low. Raise SW9 for the first release only. Record the lamps after each release. After the last row, raise SW8 to read the high byte without clocking again.
| KEY0 release | LED9 | LED8 | LED7–0 (hex) |
|---|---|---|---|
| 1 · Fetch | |||
| 2 · Save operand | |||
| 3 · Calculate | |||
| 4 · Write r1 |
On which release does LED9 announce the write? On which release does the new low byte appear? Explain why a later switch change cannot replace an instruction that has already been fetched. Give a camera reading that distinguishes zero extension from sign extension.
Original LabsLand processor, board interface and exercise following FPGAcademy Digital Logic Lab 9, Part I. Verilog handout · VHDL handout · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Follow one instruction from the input bus to a destination register. This processor has eight 16-bit registers, a shared bus, a saved first operand and an arithmetic result register. Sketch the path taken by the value in r1 during sub r1,r0. At which clock edge can another instruction safely read the new r1?
Decode the words
In bits 15–13 the opcodes for move, move-top, add and subtract are 0, 1, 2 and 3. Bit 12 selects an immediate operand. Bits 11–9 select the destination. A register operand uses bits 2–0 for its source. A signed immediate occupies bits 8–0. Move-top places the low eight immediate bits in the high byte and clears the low byte. Decode the five words in the table before running them.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/step_cpu.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
step_cpu. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/step_cpu.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
The file contains both the processor and a board interface. The arithmetic unit is 16 bits wide. In the starter, using a negative nine-bit literal can give a surprising result. Run the simulation below with the starter. For the first failing instruction, compare the high byte of the destination with the high byte you predicted. Repair the operand conversion, rerun the test, then build your corrected design for the board.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The test executes 512 instructions, checks the handshake at each phase and reads all eight registers after each write. Run the starter first and keep one mismatch for your report.
Verilog
iverilog -g2005 -s test_cpu -o bench starter/step_cpu.v simulation/test_cpu.v
vvp bench
Single-step on the board
Press KEY3 to reset. For each instruction set SW7–0 to its high byte and press and release KEY1. Set the low byte and press and release KEY2. With the instruction latched, SW2–0 can select a register for inspection. Select the destination. Leave SW8 low to read its low byte on LED7–0. Raise SW8 to read the high byte.
Raise SW9 and press and release KEY0 once to fetch. Lower SW9. Each time you press and release KEY0, the processor advances on release. Use one more press and release for a move, or three for arithmetic. Watch LED8, which indicates an active instruction, and LED9, which tells you that the next edge will write the destination. Try an extra clock while SW9 is low and the processor is idle.
| Word | Instruction | Prediction (hex) | Camera (high/low) | Write edge |
|---|---|---|---|---|
| 11FD | mv r0,#−3 | |||
| 5005 | add r0,#5 | |||
| 3234 | mvt r1,#0x34 | |||
| 6200 | sub r1,r0 | |||
| 0E01 | mv r7,r1 |
For 6200, select r1 and keep SW8 low. Raise SW9 for the first release only. Record the lamps after each release. After the last row, raise SW8 to read the high byte without clocking again.
| KEY0 release | LED9 | LED8 | LED7–0 (hex) |
|---|---|---|---|
| 1 · Fetch | |||
| 2 · Save operand | |||
| 3 · Calculate | |||
| 4 · Write r1 |
On which release does LED9 announce the write? On which release does the new low byte appear? Explain why a later switch change cannot replace an instruction that has already been fetched. Give a camera reading that distinguishes zero extension from sign extension.
Original LabsLand processor, board interface and exercise following FPGAcademy Digital Logic Lab 9, Part I. Verilog handout · VHDL handout · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Follow one instruction from the input bus to a destination register. This processor has eight 16-bit registers, a shared bus, a saved first operand and an arithmetic result register. Sketch the path taken by the value in r1 during sub r1,r0. At which clock edge can another instruction safely read the new r1?
Decode the words
In bits 15–13 the opcodes for move, move-top, add and subtract are 0, 1, 2 and 3. Bit 12 selects an immediate operand. Bits 11–9 select the destination. A register operand uses bits 2–0 for its source. A signed immediate occupies bits 8–0. Move-top places the low eight immediate bits in the high byte and clears the low byte. Decode the five words in the table before running them.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
step_cpu, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
The file contains both the processor and a board interface. The arithmetic unit is 16 bits wide. In the starter, using a negative nine-bit literal can give a surprising result. Run the simulation below with the starter. For the first failing instruction, compare the high byte of the destination with the high byte you predicted. Repair the operand conversion, rerun the test, then build your corrected design for the board.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The test executes 512 instructions, checks the handshake at each phase and reads all eight registers after each write. Run the starter first and keep one mismatch for your report.
VHDL
nvc --std=2008 -a starter/step_cpu.vhd simulation/test_cpu.vhd
nvc --std=2008 -e test_cpu
nvc --std=2008 -r test_cpu
Single-step on the board
Press KEY3 to reset. For each instruction set SW7–0 to its high byte and press and release KEY1. Set the low byte and press and release KEY2. With the instruction latched, SW2–0 can select a register for inspection. Select the destination. Leave SW8 low to read its low byte on LED7–0. Raise SW8 to read the high byte.
Raise SW9 and press and release KEY0 once to fetch. Lower SW9. Each time you press and release KEY0, the processor advances on release. Use one more press and release for a move, or three for arithmetic. Watch LED8, which indicates an active instruction, and LED9, which tells you that the next edge will write the destination. Try an extra clock while SW9 is low and the processor is idle.
| Word | Instruction | Prediction (hex) | Camera (high/low) | Write edge |
|---|---|---|---|---|
| 11FD | mv r0,#−3 | |||
| 5005 | add r0,#5 | |||
| 3234 | mvt r1,#0x34 | |||
| 6200 | sub r1,r0 | |||
| 0E01 | mv r7,r1 |
For 6200, select r1 and keep SW8 low. Raise SW9 for the first release only. Record the lamps after each release. After the last row, raise SW8 to read the high byte without clocking again.
| KEY0 release | LED9 | LED8 | LED7–0 (hex) |
|---|---|---|---|
| 1 · Fetch | |||
| 2 · Save operand | |||
| 3 · Calculate | |||
| 4 · Write r1 |
On which release does LED9 announce the write? On which release does the new low byte appear? Explain why a later switch change cannot replace an instruction that has already been fetched. Give a camera reading that distinguishes zero extension from sign extension.
Original LabsLand processor, board interface and exercise following FPGAcademy Digital Logic Lab 9, Part I. Verilog handout · VHDL handout · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Follow one instruction from the input bus to a destination register. This processor has eight 16-bit registers, a shared bus, a saved first operand and an arithmetic result register. Sketch the path taken by the value in r1 during sub r1,r0. At which clock edge can another instruction safely read the new r1?
Decode the words
In bits 15–13 the opcodes for move, move-top, add and subtract are 0, 1, 2 and 3. Bit 12 selects an immediate operand. Bits 11–9 select the destination. A register operand uses bits 2–0 for its source. A signed immediate occupies bits 8–0. Move-top places the low eight immediate bits in the high byte and clears the low byte. Decode the five words in the table before running them.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/step_cpu.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
step_cpu. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/step_cpu.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
The file contains both the processor and a board interface. The arithmetic unit is 16 bits wide. In the starter, using a negative nine-bit literal can give a surprising result. Run the simulation below with the starter. For the first failing instruction, compare the high byte of the destination with the high byte you predicted. Repair the operand conversion, rerun the test, then build your corrected design for the board.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The test executes 512 instructions, checks the handshake at each phase and reads all eight registers after each write. Run the starter first and keep one mismatch for your report.
VHDL
nvc --std=2008 -a starter/step_cpu.vhd simulation/test_cpu.vhd
nvc --std=2008 -e test_cpu
nvc --std=2008 -r test_cpu
Single-step on the board
Press KEY3 to reset. For each instruction set SW7–0 to its high byte and press and release KEY1. Set the low byte and press and release KEY2. With the instruction latched, SW2–0 can select a register for inspection. Select the destination. Leave SW8 low to read its low byte on LED7–0. Raise SW8 to read the high byte.
Raise SW9 and press and release KEY0 once to fetch. Lower SW9. Each time you press and release KEY0, the processor advances on release. Use one more press and release for a move, or three for arithmetic. Watch LED8, which indicates an active instruction, and LED9, which tells you that the next edge will write the destination. Try an extra clock while SW9 is low and the processor is idle.
| Word | Instruction | Prediction (hex) | Camera (high/low) | Write edge |
|---|---|---|---|---|
| 11FD | mv r0,#−3 | |||
| 5005 | add r0,#5 | |||
| 3234 | mvt r1,#0x34 | |||
| 6200 | sub r1,r0 | |||
| 0E01 | mv r7,r1 |
For 6200, select r1 and keep SW8 low. Raise SW9 for the first release only. Record the lamps after each release. After the last row, raise SW8 to read the high byte without clocking again.
| KEY0 release | LED9 | LED8 | LED7–0 (hex) |
|---|---|---|---|
| 1 · Fetch | |||
| 2 · Save operand | |||
| 3 · Calculate | |||
| 4 · Write r1 |
On which release does LED9 announce the write? On which release does the new low byte appear? Explain why a later switch change cannot replace an instruction that has already been fetched. Give a camera reading that distinguishes zero extension from sign extension.
Original LabsLand processor, board interface and exercise following FPGAcademy Digital Logic Lab 9, Part I. Verilog handout · VHDL handout · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Follow one instruction from the input bus to a destination register. This processor has eight 16-bit registers, a shared bus, a saved first operand and an arithmetic result register. Sketch the path taken by the value in r1 during sub r1,r0. At which clock edge can another instruction safely read the new r1?
Decode the words
In bits 15–13 the opcodes for move, move-top, add and subtract are 0, 1, 2 and 3. Bit 12 selects an immediate operand. Bits 11–9 select the destination. A register operand uses bits 2–0 for its source. A signed immediate occupies bits 8–0. Move-top places the low eight immediate bits in the high byte and clears the low byte. Decode the five words in the table before running them.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
step_cpu, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
The file contains both the processor and a board interface. The arithmetic unit is 16 bits wide. In the starter, using a negative nine-bit literal can give a surprising result. Run the simulation below with the starter. For the first failing instruction, compare the high byte of the destination with the high byte you predicted. Repair the operand conversion, rerun the test, then build your corrected design for the board.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The test executes 512 instructions, checks the handshake at each phase and reads all eight registers after each write. Run the starter first and keep one mismatch for your report.
SystemVerilog
iverilog -g2012 -s test_cpu -o bench starter/step_cpu.sv simulation/test_cpu.v
vvp bench
Single-step on the board
Press KEY3 to reset. For each instruction set SW7–0 to its high byte and press and release KEY1. Set the low byte and press and release KEY2. With the instruction latched, SW2–0 can select a register for inspection. Select the destination. Leave SW8 low to read its low byte on LED7–0. Raise SW8 to read the high byte.
Raise SW9 and press and release KEY0 once to fetch. Lower SW9. Each time you press and release KEY0, the processor advances on release. Use one more press and release for a move, or three for arithmetic. Watch LED8, which indicates an active instruction, and LED9, which tells you that the next edge will write the destination. Try an extra clock while SW9 is low and the processor is idle.
| Word | Instruction | Prediction (hex) | Camera (high/low) | Write edge |
|---|---|---|---|---|
| 11FD | mv r0,#−3 | |||
| 5005 | add r0,#5 | |||
| 3234 | mvt r1,#0x34 | |||
| 6200 | sub r1,r0 | |||
| 0E01 | mv r7,r1 |
For 6200, select r1 and keep SW8 low. Raise SW9 for the first release only. Record the lamps after each release. After the last row, raise SW8 to read the high byte without clocking again.
| KEY0 release | LED9 | LED8 | LED7–0 (hex) |
|---|---|---|---|
| 1 · Fetch | |||
| 2 · Save operand | |||
| 3 · Calculate | |||
| 4 · Write r1 |
On which release does LED9 announce the write? On which release does the new low byte appear? Explain why a later switch change cannot replace an instruction that has already been fetched. Give a camera reading that distinguishes zero extension from sign extension.
Original LabsLand processor, board interface and exercise following FPGAcademy Digital Logic Lab 9, Part I. Verilog handout · VHDL handout · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Follow one instruction from the input bus to a destination register. This processor has eight 16-bit registers, a shared bus, a saved first operand and an arithmetic result register. Sketch the path taken by the value in r1 during sub r1,r0. At which clock edge can another instruction safely read the new r1?
Decode the words
In bits 15–13 the opcodes for move, move-top, add and subtract are 0, 1, 2 and 3. Bit 12 selects an immediate operand. Bits 11–9 select the destination. A register operand uses bits 2–0 for its source. A signed immediate occupies bits 8–0. Move-top places the low eight immediate bits in the high byte and clears the low byte. Decode the five words in the table before running them.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/step_cpu.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
step_cpu. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/step_cpu.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
The file contains both the processor and a board interface. The arithmetic unit is 16 bits wide. In the starter, using a negative nine-bit literal can give a surprising result. Run the simulation below with the starter. For the first failing instruction, compare the high byte of the destination with the high byte you predicted. Repair the operand conversion, rerun the test, then build your corrected design for the board.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The test executes 512 instructions, checks the handshake at each phase and reads all eight registers after each write. Run the starter first and keep one mismatch for your report.
SystemVerilog
iverilog -g2012 -s test_cpu -o bench starter/step_cpu.sv simulation/test_cpu.v
vvp bench
Single-step on the board
Press KEY3 to reset. For each instruction set SW7–0 to its high byte and press and release KEY1. Set the low byte and press and release KEY2. With the instruction latched, SW2–0 can select a register for inspection. Select the destination. Leave SW8 low to read its low byte on LED7–0. Raise SW8 to read the high byte.
Raise SW9 and press and release KEY0 once to fetch. Lower SW9. Each time you press and release KEY0, the processor advances on release. Use one more press and release for a move, or three for arithmetic. Watch LED8, which indicates an active instruction, and LED9, which tells you that the next edge will write the destination. Try an extra clock while SW9 is low and the processor is idle.
| Word | Instruction | Prediction (hex) | Camera (high/low) | Write edge |
|---|---|---|---|---|
| 11FD | mv r0,#−3 | |||
| 5005 | add r0,#5 | |||
| 3234 | mvt r1,#0x34 | |||
| 6200 | sub r1,r0 | |||
| 0E01 | mv r7,r1 |
For 6200, select r1 and keep SW8 low. Raise SW9 for the first release only. Record the lamps after each release. After the last row, raise SW8 to read the high byte without clocking again.
| KEY0 release | LED9 | LED8 | LED7–0 (hex) |
|---|---|---|---|
| 1 · Fetch | |||
| 2 · Save operand | |||
| 3 · Calculate | |||
| 4 · Write r1 |
On which release does LED9 announce the write? On which release does the new low byte appear? Explain why a later switch change cannot replace an instruction that has already been fetched. Give a camera reading that distinguishes zero extension from sign extension.
Original LabsLand processor, board interface and exercise following FPGAcademy Digital Logic Lab 9, Part I. Verilog handout · VHDL handout · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
You have two clocks. One presents the next word from a 32 × 16 ROM. The other steps the processor. Predict what happens if you pulse the processor clock twice without advancing the memory. Then predict what happens if you advance the memory while Run is low.
Prepare a program
Read program.mif. Addresses and words are hexadecimal. Write the first six addresses and identify which register each instruction changes. At addresses 06–1F, 0000 copies r0 to itself. Select one immediate operand to change and predict the final r7.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
rom_cpu, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
The starter can execute the first instruction but then skips a ROM address. Use the independent memory clock to find the faulty step. Repair it and synthesize. This version uses a portable, synchronously read ROM. The original handout also explains how to generate a ROM in the Quartus IP Catalog.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
Start with the original program. The bench checks all 32 addresses, wraps back to zero, and reads all eight registers after each instruction. After word 05 it prints the two bytes of r7 as a single hexadecimal value. Compare it with your prediction and the two bytes you read on the board.
Verilog
iverilog -g2005 -s test_rom -o bench starter/rom_cpu.v simulation/test_rom.v
vvp bench
Run the six words
Lower SW0 to clear both circuits, then raise it. Leave SW9 low. Pulse KEY0 once to load address 00. With SW4 up, read its low byte on LED7–0, then raise SW8 to read its high byte. Lower SW4, select the destination register on SW7–5, and lower SW8. Raise SW9 and pulse KEY1 once to fetch. Lower SW9. Pulse KEY1 once more for move or move-top and three more times for add or subtract. LED9 indicates that the next processor edge writes the result. LED8 mirrors Run. Pulse KEY0 once for the next word and repeat.
| Address | Instruction word | Destination | Value before | Value after |
|---|---|---|---|---|
| 00 | r2 | |||
| 01 | r5 | |||
| 02 | r2 | |||
| 03 | r2 | |||
| 04 | r4 | |||
| 05 | r7 |
Read and record both bytes of r7 for the original program.
Change one instruction
Save your address-counter repair in the HDL file inside starter/. Change the immediate you selected in program.mif. From the folder containing activity.md, run the ROM loader on your repaired design.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
Verilog
python3 simulation/prepare_rom.py simulation/program.mif starter/rom_cpu.v --output my_rom_cpu.v
In the testbench you used above, change the entry in words at the address you edited to your predicted instruction word. Rerun the simulation commands with your generated HDL file in place of the starter file. Compare the new r7 value with your prediction.
Copy the generated HDL into the same top-level design you used for the first run and compile it again. Upload the new build to the DE1-SoC, reset the memory and processor with SW0 and repeat the six words. Hand in the changed MIF line, both r7 values read from the board, and one example showing how the two clocks act independently.
Original LabsLand materials following FPGAcademy Digital Logic Lab 9, Part II. Verilog handout · VHDL handout · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
You have two clocks. One presents the next word from a 32 × 16 ROM. The other steps the processor. Predict what happens if you pulse the processor clock twice without advancing the memory. Then predict what happens if you advance the memory while Run is low.
Prepare a program
Read program.mif. Addresses and words are hexadecimal. Write the first six addresses and identify which register each instruction changes. At addresses 06–1F, 0000 copies r0 to itself. Select one immediate operand to change and predict the final r7.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/rom_cpu.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
rom_cpu. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/rom_cpu.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
The starter can execute the first instruction but then skips a ROM address. Use the independent memory clock to find the faulty step. Repair it and synthesize. This version uses a portable, synchronously read ROM. The original handout also explains how to generate a ROM in the Quartus IP Catalog.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
Start with the original program. The bench checks all 32 addresses, wraps back to zero, and reads all eight registers after each instruction. After word 05 it prints the two bytes of r7 as a single hexadecimal value. Compare it with your prediction and the two bytes you read on the board.
Verilog
iverilog -g2005 -s test_rom -o bench starter/rom_cpu.v simulation/test_rom.v
vvp bench
Run the six words
Lower SW0 to clear both circuits, then raise it. Leave SW9 low. Pulse KEY0 once to load address 00. With SW4 up, read its low byte on LED7–0, then raise SW8 to read its high byte. Lower SW4, select the destination register on SW7–5, and lower SW8. Raise SW9 and pulse KEY1 once to fetch. Lower SW9. Pulse KEY1 once more for move or move-top and three more times for add or subtract. LED9 indicates that the next processor edge writes the result. LED8 mirrors Run. Pulse KEY0 once for the next word and repeat.
| Address | Instruction word | Destination | Value before | Value after |
|---|---|---|---|---|
| 00 | r2 | |||
| 01 | r5 | |||
| 02 | r2 | |||
| 03 | r2 | |||
| 04 | r4 | |||
| 05 | r7 |
Read and record both bytes of r7 for the original program.
Change one instruction
Save your address-counter repair in the HDL file inside starter/. Change the immediate you selected in program.mif. From the folder containing activity.md, run the ROM loader on your repaired design.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
Verilog
python3 simulation/prepare_rom.py simulation/program.mif starter/rom_cpu.v --output my_rom_cpu.v
In the testbench you used above, change the entry in words at the address you edited to your predicted instruction word. Rerun the simulation commands with your generated HDL file in place of the starter file. Compare the new r7 value with your prediction.
Copy the generated HDL into the same top-level design you used for the first run and compile it again. Upload the new build to the DE1-SoC, reset the memory and processor with SW0 and repeat the six words. Hand in the changed MIF line, both r7 values read from the board, and one example showing how the two clocks act independently.
Original LabsLand materials following FPGAcademy Digital Logic Lab 9, Part II. Verilog handout · VHDL handout · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
You have two clocks. One presents the next word from a 32 × 16 ROM. The other steps the processor. Predict what happens if you pulse the processor clock twice without advancing the memory. Then predict what happens if you advance the memory while Run is low.
Prepare a program
Read program.mif. Addresses and words are hexadecimal. Write the first six addresses and identify which register each instruction changes. At addresses 06–1F, 0000 copies r0 to itself. Select one immediate operand to change and predict the final r7.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
rom_cpu, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
The starter can execute the first instruction but then skips a ROM address. Use the independent memory clock to find the faulty step. Repair it and synthesize. This version uses a portable, synchronously read ROM. The original handout also explains how to generate a ROM in the Quartus IP Catalog.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
Start with the original program. The bench checks all 32 addresses, wraps back to zero, and reads all eight registers after each instruction. After word 05 it prints the two bytes of r7 as a single hexadecimal value. Compare it with your prediction and the two bytes you read on the board.
VHDL
nvc --std=2008 -a starter/rom_cpu.vhd simulation/test_rom.vhd
nvc --std=2008 -e test_rom
nvc --std=2008 -r test_rom
Run the six words
Lower SW0 to clear both circuits, then raise it. Leave SW9 low. Pulse KEY0 once to load address 00. With SW4 up, read its low byte on LED7–0, then raise SW8 to read its high byte. Lower SW4, select the destination register on SW7–5, and lower SW8. Raise SW9 and pulse KEY1 once to fetch. Lower SW9. Pulse KEY1 once more for move or move-top and three more times for add or subtract. LED9 indicates that the next processor edge writes the result. LED8 mirrors Run. Pulse KEY0 once for the next word and repeat.
| Address | Instruction word | Destination | Value before | Value after |
|---|---|---|---|---|
| 00 | r2 | |||
| 01 | r5 | |||
| 02 | r2 | |||
| 03 | r2 | |||
| 04 | r4 | |||
| 05 | r7 |
Read and record both bytes of r7 for the original program.
Change one instruction
Save your address-counter repair in the HDL file inside starter/. Change the immediate you selected in program.mif. From the folder containing activity.md, run the ROM loader on your repaired design.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
VHDL
python3 simulation/prepare_rom.py simulation/program.mif starter/rom_cpu.vhd --output my_rom_cpu.vhd
In the testbench you used above, change the entry in words at the address you edited to your predicted instruction word. Rerun the simulation commands with your generated HDL file in place of the starter file. Compare the new r7 value with your prediction.
Copy the generated HDL into the same top-level design you used for the first run and compile it again. Upload the new build to the DE1-SoC, reset the memory and processor with SW0 and repeat the six words. Hand in the changed MIF line, both r7 values read from the board, and one example showing how the two clocks act independently.
Original LabsLand materials following FPGAcademy Digital Logic Lab 9, Part II. Verilog handout · VHDL handout · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
You have two clocks. One presents the next word from a 32 × 16 ROM. The other steps the processor. Predict what happens if you pulse the processor clock twice without advancing the memory. Then predict what happens if you advance the memory while Run is low.
Prepare a program
Read program.mif. Addresses and words are hexadecimal. Write the first six addresses and identify which register each instruction changes. At addresses 06–1F, 0000 copies r0 to itself. Select one immediate operand to change and predict the final r7.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/rom_cpu.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
rom_cpu. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/rom_cpu.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
The starter can execute the first instruction but then skips a ROM address. Use the independent memory clock to find the faulty step. Repair it and synthesize. This version uses a portable, synchronously read ROM. The original handout also explains how to generate a ROM in the Quartus IP Catalog.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
Start with the original program. The bench checks all 32 addresses, wraps back to zero, and reads all eight registers after each instruction. After word 05 it prints the two bytes of r7 as a single hexadecimal value. Compare it with your prediction and the two bytes you read on the board.
VHDL
nvc --std=2008 -a starter/rom_cpu.vhd simulation/test_rom.vhd
nvc --std=2008 -e test_rom
nvc --std=2008 -r test_rom
Run the six words
Lower SW0 to clear both circuits, then raise it. Leave SW9 low. Pulse KEY0 once to load address 00. With SW4 up, read its low byte on LED7–0, then raise SW8 to read its high byte. Lower SW4, select the destination register on SW7–5, and lower SW8. Raise SW9 and pulse KEY1 once to fetch. Lower SW9. Pulse KEY1 once more for move or move-top and three more times for add or subtract. LED9 indicates that the next processor edge writes the result. LED8 mirrors Run. Pulse KEY0 once for the next word and repeat.
| Address | Instruction word | Destination | Value before | Value after |
|---|---|---|---|---|
| 00 | r2 | |||
| 01 | r5 | |||
| 02 | r2 | |||
| 03 | r2 | |||
| 04 | r4 | |||
| 05 | r7 |
Read and record both bytes of r7 for the original program.
Change one instruction
Save your address-counter repair in the HDL file inside starter/. Change the immediate you selected in program.mif. From the folder containing activity.md, run the ROM loader on your repaired design.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
VHDL
python3 simulation/prepare_rom.py simulation/program.mif starter/rom_cpu.vhd --output my_rom_cpu.vhd
In the testbench you used above, change the entry in words at the address you edited to your predicted instruction word. Rerun the simulation commands with your generated HDL file in place of the starter file. Compare the new r7 value with your prediction.
Copy the generated HDL into the same top-level design you used for the first run and compile it again. Upload the new build to the DE1-SoC, reset the memory and processor with SW0 and repeat the six words. Hand in the changed MIF line, both r7 values read from the board, and one example showing how the two clocks act independently.
Original LabsLand materials following FPGAcademy Digital Logic Lab 9, Part II. Verilog handout · VHDL handout · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
You have two clocks. One presents the next word from a 32 × 16 ROM. The other steps the processor. Predict what happens if you pulse the processor clock twice without advancing the memory. Then predict what happens if you advance the memory while Run is low.
Prepare a program
Read program.mif. Addresses and words are hexadecimal. Write the first six addresses and identify which register each instruction changes. At addresses 06–1F, 0000 copies r0 to itself. Select one immediate operand to change and predict the final r7.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
rom_cpu, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
The starter can execute the first instruction but then skips a ROM address. Use the independent memory clock to find the faulty step. Repair it and synthesize. This version uses a portable, synchronously read ROM. The original handout also explains how to generate a ROM in the Quartus IP Catalog.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
Start with the original program. The bench checks all 32 addresses, wraps back to zero, and reads all eight registers after each instruction. After word 05 it prints the two bytes of r7 as a single hexadecimal value. Compare it with your prediction and the two bytes you read on the board.
SystemVerilog
iverilog -g2012 -s test_rom -o bench starter/rom_cpu.sv simulation/test_rom.v
vvp bench
Run the six words
Lower SW0 to clear both circuits, then raise it. Leave SW9 low. Pulse KEY0 once to load address 00. With SW4 up, read its low byte on LED7–0, then raise SW8 to read its high byte. Lower SW4, select the destination register on SW7–5, and lower SW8. Raise SW9 and pulse KEY1 once to fetch. Lower SW9. Pulse KEY1 once more for move or move-top and three more times for add or subtract. LED9 indicates that the next processor edge writes the result. LED8 mirrors Run. Pulse KEY0 once for the next word and repeat.
| Address | Instruction word | Destination | Value before | Value after |
|---|---|---|---|---|
| 00 | r2 | |||
| 01 | r5 | |||
| 02 | r2 | |||
| 03 | r2 | |||
| 04 | r4 | |||
| 05 | r7 |
Read and record both bytes of r7 for the original program.
Change one instruction
Save your address-counter repair in the HDL file inside starter/. Change the immediate you selected in program.mif. From the folder containing activity.md, run the ROM loader on your repaired design.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
SystemVerilog
python3 simulation/prepare_rom.py simulation/program.mif starter/rom_cpu.sv --output my_rom_cpu.sv
In the testbench you used above, change the entry in words at the address you edited to your predicted instruction word. Rerun the simulation commands with your generated HDL file in place of the starter file. Compare the new r7 value with your prediction.
Copy the generated HDL into the same top-level design you used for the first run and compile it again. Upload the new build to the DE1-SoC, reset the memory and processor with SW0 and repeat the six words. Hand in the changed MIF line, both r7 values read from the board, and one example showing how the two clocks act independently.
Original LabsLand materials following FPGAcademy Digital Logic Lab 9, Part II. Verilog handout · VHDL handout · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
You have two clocks. One presents the next word from a 32 × 16 ROM. The other steps the processor. Predict what happens if you pulse the processor clock twice without advancing the memory. Then predict what happens if you advance the memory while Run is low.
Prepare a program
Read program.mif. Addresses and words are hexadecimal. Write the first six addresses and identify which register each instruction changes. At addresses 06–1F, 0000 copies r0 to itself. Select one immediate operand to change and predict the final r7.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/rom_cpu.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
rom_cpu. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/rom_cpu.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
The starter can execute the first instruction but then skips a ROM address. Use the independent memory clock to find the faulty step. Repair it and synthesize. This version uses a portable, synchronously read ROM. The original handout also explains how to generate a ROM in the Quartus IP Catalog.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
Start with the original program. The bench checks all 32 addresses, wraps back to zero, and reads all eight registers after each instruction. After word 05 it prints the two bytes of r7 as a single hexadecimal value. Compare it with your prediction and the two bytes you read on the board.
SystemVerilog
iverilog -g2012 -s test_rom -o bench starter/rom_cpu.sv simulation/test_rom.v
vvp bench
Run the six words
Lower SW0 to clear both circuits, then raise it. Leave SW9 low. Pulse KEY0 once to load address 00. With SW4 up, read its low byte on LED7–0, then raise SW8 to read its high byte. Lower SW4, select the destination register on SW7–5, and lower SW8. Raise SW9 and pulse KEY1 once to fetch. Lower SW9. Pulse KEY1 once more for move or move-top and three more times for add or subtract. LED9 indicates that the next processor edge writes the result. LED8 mirrors Run. Pulse KEY0 once for the next word and repeat.
| Address | Instruction word | Destination | Value before | Value after |
|---|---|---|---|---|
| 00 | r2 | |||
| 01 | r5 | |||
| 02 | r2 | |||
| 03 | r2 | |||
| 04 | r4 | |||
| 05 | r7 |
Read and record both bytes of r7 for the original program.
Change one instruction
Save your address-counter repair in the HDL file inside starter/. Change the immediate you selected in program.mif. From the folder containing activity.md, run the ROM loader on your repaired design.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
SystemVerilog
python3 simulation/prepare_rom.py simulation/program.mif starter/rom_cpu.sv --output my_rom_cpu.sv
In the testbench you used above, change the entry in words at the address you edited to your predicted instruction word. Rerun the simulation commands with your generated HDL file in place of the starter file. Compare the new r7 value with your prediction.
Copy the generated HDL into the same top-level design you used for the first run and compile it again. Upload the new build to the DE1-SoC, reset the memory and processor with SW0 and repeat the six words. Hand in the changed MIF line, both r7 values read from the board, and one example showing how the two clocks act independently.
Original LabsLand materials following FPGAcademy Digital Logic Lab 9, Part II. Verilog handout · VHDL handout · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Your processor will read switches, save the input in RAM, read it back, mask it and drive the LEDs. In Lab 9 every result stayed in a processor register. Here the address, data and write signal travel outside the CPU. Draw two bus timelines, one for the store to RAM and one for the load from the same word. Mark when the address becomes stable, when RAM writes the data, and when the destination register captures the returned word.
Follow the program
Open switch_mask.s. Register r7 is the program counter. RAM starts at 0x0000, the LED port is at 0x1000 and the switches are at 0x3000. RAM addresses select 16-bit words. Why is r0 cleared after the first store? Predict the result when SW8–0 contain 0x135.
Simulate and repair the load
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench runs the assembly program on your HDL processor for every one of the 512 switch words. It also checks halt, resume and reset. Find the first failing word. Inspect the address sent to RAM and the value on the bus when the load commits.
Verilog
iverilog -g2005 -s trace_io -o trace starter/io_cpu.v simulation/trace_io.v
vvp trace
iverilog -g2005 -s test_io -o bench starter/io_cpu.v simulation/test_io.v
vvp bench
The trace runs first and sets SW9 high and SW8–0 to hex 035. It prints a trace of three instructions: the switch load (IR = 8004), the RAM store (A005) and the RAM load (8205). Each row shows the signals after the numbered rising edge, once they have settled. The next rising edge uses those values. Gaps in the edge numbers skip other instructions.
Use W, ADDR and DOUT to mark the edge that writes RAM word 0030. For the load, mark when DIN changes and when r1 captures the value on BUS. Compare the switch load before and after the repair: does r0 capture the switch word? An idle BUS can appear as XXXX or 0000.
Run the starter first and record the first mismatch. In the last microstep of a load, the destination register receives an old arithmetic result. Trace the bus selector and compare it with the source used after an add. Repair the load in the starter file and rerun the same commands. Continue when you see PASS 512 switch words, run hold, resume and reset.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
io_cpu, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Test the ports on the board
Run the rows in order. SW9 starts and stops the processor. SW8–0 supply a hexadecimal input word. Predict the LED word, set the switches, then read the lamps and record the word in hex. When a row changes SW9 from 1 to 0, lower only SW9 and wait before changing the data. Pulse KEY0 only in the two rows marked reset.
| SW9 | SW8–0 (hex) | Prediction | Board |
|---|---|---|---|
| 0 (reset) | 000 | ||
| 1 | 005 | ||
| 1 | 015 | ||
| 1 | 035 | ||
| 1 | 1E0 | ||
| 1 | 1FF | ||
| 1 | 1DF | ||
| 1 | 01A | ||
| 0 | 01A | ||
| 0 | 007 | ||
| 1 | 007 | ||
| 0 | 000 | ||
| 0 (reset) | 000 | ||
| 1 | 009 |
Which action cleared the output register while the processor was stopped?
Describe one observation that distinguishes a masked input from a direct wire between the switches and lamps. Explain why changing the switches during a halt leaves the output register unchanged.
Assemble a change
Change and r1,#31 to and r1,#63 in simulation/switch_mask.s. Predict what will happen to LED5 when you change the input from 015 to 035 (hex). Use the included FPGAcademy assembler and the LabsLand RAM loader to regenerate the HDL. Keep the output in a new file.
If the assembler reports an error, correct the indicated line and assemble again before loading the memory image. A failed build leaves any previous .mif in place.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
Verilog
python3 simulation/sbasm.py simulation/switch_mask.s switch_mask.mif
python3 simulation/load_program.py switch_mask.mif starter/io_cpu.v --output my_io_cpu.v
Use your repaired HDL as the input to the loader. In a second copy of the worksheet, replace the contents of the original HDL file with the generated file, keeping its name. Change EXPECTED_MASK from 31 to 63 in the testbench and rerun the simulation. Build the new design and program the board using the same workflow.
Start with SW9 low and pulse KEY0. Use the table to test your new program. Record just LED5 (0 or 1). When you halt, leave 035 on the switches until the lamps have settled.
| SW9 | SW8–0 (hex) | Predicted LED5 | Board LED5 |
|---|---|---|---|
| 0 | 000 | ||
| 1 | 015 | ||
| 1 | 035 | ||
| 0 | 035 | ||
| 0 | 015 | ||
| 0 (reset) | 015 |
Hand in both bus timelines, your edited instruction and the two completed tables.
Adapted from the MIT-licensed FPGAcademy processor scaffold. The board interface, memory and exercise are by LabsLand. Verilog handout · VHDL handout · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Your processor will read switches, save the input in RAM, read it back, mask it and drive the LEDs. In Lab 9 every result stayed in a processor register. Here the address, data and write signal travel outside the CPU. Draw two bus timelines, one for the store to RAM and one for the load from the same word. Mark when the address becomes stable, when RAM writes the data, and when the destination register captures the returned word.
Follow the program
Open switch_mask.s. Register r7 is the program counter. RAM starts at 0x0000, the LED port is at 0x1000 and the switches are at 0x3000. RAM addresses select 16-bit words. Why is r0 cleared after the first store? Predict the result when SW8–0 contain 0x135.
Simulate and repair the load
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench runs the assembly program on your HDL processor for every one of the 512 switch words. It also checks halt, resume and reset. Find the first failing word. Inspect the address sent to RAM and the value on the bus when the load commits.
Verilog
iverilog -g2005 -s trace_io -o trace starter/io_cpu.v simulation/trace_io.v
vvp trace
iverilog -g2005 -s test_io -o bench starter/io_cpu.v simulation/test_io.v
vvp bench
The trace runs first and sets SW9 high and SW8–0 to hex 035. It prints a trace of three instructions: the switch load (IR = 8004), the RAM store (A005) and the RAM load (8205). Each row shows the signals after the numbered rising edge, once they have settled. The next rising edge uses those values. Gaps in the edge numbers skip other instructions.
Use W, ADDR and DOUT to mark the edge that writes RAM word 0030. For the load, mark when DIN changes and when r1 captures the value on BUS. Compare the switch load before and after the repair: does r0 capture the switch word? An idle BUS can appear as XXXX or 0000.
Run the starter first and record the first mismatch. In the last microstep of a load, the destination register receives an old arithmetic result. Trace the bus selector and compare it with the source used after an add. Repair the load in the starter file and rerun the same commands. Continue when you see PASS 512 switch words, run hold, resume and reset.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/io_cpu.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
io_cpu. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/io_cpu.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Test the ports on the board
Run the rows in order. SW9 starts and stops the processor. SW8–0 supply a hexadecimal input word. Predict the LED word, set the switches, then read the lamps and record the word in hex. When a row changes SW9 from 1 to 0, lower only SW9 and wait before changing the data. Pulse KEY0 only in the two rows marked reset.
| SW9 | SW8–0 (hex) | Prediction | Board |
|---|---|---|---|
| 0 (reset) | 000 | ||
| 1 | 005 | ||
| 1 | 015 | ||
| 1 | 035 | ||
| 1 | 1E0 | ||
| 1 | 1FF | ||
| 1 | 1DF | ||
| 1 | 01A | ||
| 0 | 01A | ||
| 0 | 007 | ||
| 1 | 007 | ||
| 0 | 000 | ||
| 0 (reset) | 000 | ||
| 1 | 009 |
Which action cleared the output register while the processor was stopped?
Describe one observation that distinguishes a masked input from a direct wire between the switches and lamps. Explain why changing the switches during a halt leaves the output register unchanged.
Assemble a change
Change and r1,#31 to and r1,#63 in simulation/switch_mask.s. Predict what will happen to LED5 when you change the input from 015 to 035 (hex). Use the included FPGAcademy assembler and the LabsLand RAM loader to regenerate the HDL. Keep the output in a new file.
If the assembler reports an error, correct the indicated line and assemble again before loading the memory image. A failed build leaves any previous .mif in place.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
Verilog
python3 simulation/sbasm.py simulation/switch_mask.s switch_mask.mif
python3 simulation/load_program.py switch_mask.mif starter/io_cpu.v --output my_io_cpu.v
Use your repaired HDL as the input to the loader. In a second copy of the worksheet, replace the contents of the original HDL file with the generated file, keeping its name. Change EXPECTED_MASK from 31 to 63 in the testbench and rerun the simulation. Build the new design and program the board using the same workflow.
Start with SW9 low and pulse KEY0. Use the table to test your new program. Record just LED5 (0 or 1). When you halt, leave 035 on the switches until the lamps have settled.
| SW9 | SW8–0 (hex) | Predicted LED5 | Board LED5 |
|---|---|---|---|
| 0 | 000 | ||
| 1 | 015 | ||
| 1 | 035 | ||
| 0 | 035 | ||
| 0 | 015 | ||
| 0 (reset) | 015 |
Hand in both bus timelines, your edited instruction and the two completed tables.
Adapted from the MIT-licensed FPGAcademy processor scaffold. The board interface, memory and exercise are by LabsLand. Verilog handout · VHDL handout · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Your processor will read switches, save the input in RAM, read it back, mask it and drive the LEDs. In Lab 9 every result stayed in a processor register. Here the address, data and write signal travel outside the CPU. Draw two bus timelines, one for the store to RAM and one for the load from the same word. Mark when the address becomes stable, when RAM writes the data, and when the destination register captures the returned word.
Follow the program
Open switch_mask.s. Register r7 is the program counter. RAM starts at 0x0000, the LED port is at 0x1000 and the switches are at 0x3000. RAM addresses select 16-bit words. Why is r0 cleared after the first store? Predict the result when SW8–0 contain 0x135.
Simulate and repair the load
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench runs the assembly program on your HDL processor for every one of the 512 switch words. It also checks halt, resume and reset. Find the first failing word. Inspect the address sent to RAM and the value on the bus when the load commits.
VHDL
nvc --std=2008 -a starter/io_cpu.vhd simulation/test_io.vhd simulation/trace_io.vhd
nvc --std=2008 -e trace_io
nvc --std=2008 -r trace_io
nvc --std=2008 -e test_io
nvc --std=2008 -r test_io
The trace runs first and sets SW9 high and SW8–0 to hex 035. It prints a trace of three instructions: the switch load (IR = 8004), the RAM store (A005) and the RAM load (8205). Each row shows the signals after the numbered rising edge, once they have settled. The next rising edge uses those values. Gaps in the edge numbers skip other instructions.
Use W, ADDR and DOUT to mark the edge that writes RAM word 0030. For the load, mark when DIN changes and when r1 captures the value on BUS. Compare the switch load before and after the repair: does r0 capture the switch word? An idle BUS can appear as XXXX or 0000.
Run the starter first and record the first mismatch. In the last microstep of a load, the destination register receives an old arithmetic result. Trace the bus selector and compare it with the source used after an add. Repair the load in the starter file and rerun the same commands. Continue when you see PASS 512 switch words, run hold, resume and reset.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
io_cpu, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Test the ports on the board
Run the rows in order. SW9 starts and stops the processor. SW8–0 supply a hexadecimal input word. Predict the LED word, set the switches, then read the lamps and record the word in hex. When a row changes SW9 from 1 to 0, lower only SW9 and wait before changing the data. Pulse KEY0 only in the two rows marked reset.
| SW9 | SW8–0 (hex) | Prediction | Board |
|---|---|---|---|
| 0 (reset) | 000 | ||
| 1 | 005 | ||
| 1 | 015 | ||
| 1 | 035 | ||
| 1 | 1E0 | ||
| 1 | 1FF | ||
| 1 | 1DF | ||
| 1 | 01A | ||
| 0 | 01A | ||
| 0 | 007 | ||
| 1 | 007 | ||
| 0 | 000 | ||
| 0 (reset) | 000 | ||
| 1 | 009 |
Which action cleared the output register while the processor was stopped?
Describe one observation that distinguishes a masked input from a direct wire between the switches and lamps. Explain why changing the switches during a halt leaves the output register unchanged.
Assemble a change
Change and r1,#31 to and r1,#63 in simulation/switch_mask.s. Predict what will happen to LED5 when you change the input from 015 to 035 (hex). Use the included FPGAcademy assembler and the LabsLand RAM loader to regenerate the HDL. Keep the output in a new file.
If the assembler reports an error, correct the indicated line and assemble again before loading the memory image. A failed build leaves any previous .mif in place.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
VHDL
python3 simulation/sbasm.py simulation/switch_mask.s switch_mask.mif
python3 simulation/load_program.py switch_mask.mif starter/io_cpu.vhd --output my_io_cpu.vhd
Use your repaired HDL as the input to the loader. In a second copy of the worksheet, replace the contents of the original HDL file with the generated file, keeping its name. Change EXPECTED_MASK from 31 to 63 in the testbench and rerun the simulation. Build the new design and program the board using the same workflow.
Start with SW9 low and pulse KEY0. Use the table to test your new program. Record just LED5 (0 or 1). When you halt, leave 035 on the switches until the lamps have settled.
| SW9 | SW8–0 (hex) | Predicted LED5 | Board LED5 |
|---|---|---|---|
| 0 | 000 | ||
| 1 | 015 | ||
| 1 | 035 | ||
| 0 | 035 | ||
| 0 | 015 | ||
| 0 (reset) | 015 |
Hand in both bus timelines, your edited instruction and the two completed tables.
Adapted from the MIT-licensed FPGAcademy processor scaffold. The board interface, memory and exercise are by LabsLand. Verilog handout · VHDL handout · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Your processor will read switches, save the input in RAM, read it back, mask it and drive the LEDs. In Lab 9 every result stayed in a processor register. Here the address, data and write signal travel outside the CPU. Draw two bus timelines, one for the store to RAM and one for the load from the same word. Mark when the address becomes stable, when RAM writes the data, and when the destination register captures the returned word.
Follow the program
Open switch_mask.s. Register r7 is the program counter. RAM starts at 0x0000, the LED port is at 0x1000 and the switches are at 0x3000. RAM addresses select 16-bit words. Why is r0 cleared after the first store? Predict the result when SW8–0 contain 0x135.
Simulate and repair the load
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench runs the assembly program on your HDL processor for every one of the 512 switch words. It also checks halt, resume and reset. Find the first failing word. Inspect the address sent to RAM and the value on the bus when the load commits.
VHDL
nvc --std=2008 -a starter/io_cpu.vhd simulation/test_io.vhd simulation/trace_io.vhd
nvc --std=2008 -e trace_io
nvc --std=2008 -r trace_io
nvc --std=2008 -e test_io
nvc --std=2008 -r test_io
The trace runs first and sets SW9 high and SW8–0 to hex 035. It prints a trace of three instructions: the switch load (IR = 8004), the RAM store (A005) and the RAM load (8205). Each row shows the signals after the numbered rising edge, once they have settled. The next rising edge uses those values. Gaps in the edge numbers skip other instructions.
Use W, ADDR and DOUT to mark the edge that writes RAM word 0030. For the load, mark when DIN changes and when r1 captures the value on BUS. Compare the switch load before and after the repair: does r0 capture the switch word? An idle BUS can appear as XXXX or 0000.
Run the starter first and record the first mismatch. In the last microstep of a load, the destination register receives an old arithmetic result. Trace the bus selector and compare it with the source used after an add. Repair the load in the starter file and rerun the same commands. Continue when you see PASS 512 switch words, run hold, resume and reset.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/io_cpu.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
io_cpu. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/io_cpu.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Test the ports on the board
Run the rows in order. SW9 starts and stops the processor. SW8–0 supply a hexadecimal input word. Predict the LED word, set the switches, then read the lamps and record the word in hex. When a row changes SW9 from 1 to 0, lower only SW9 and wait before changing the data. Pulse KEY0 only in the two rows marked reset.
| SW9 | SW8–0 (hex) | Prediction | Board |
|---|---|---|---|
| 0 (reset) | 000 | ||
| 1 | 005 | ||
| 1 | 015 | ||
| 1 | 035 | ||
| 1 | 1E0 | ||
| 1 | 1FF | ||
| 1 | 1DF | ||
| 1 | 01A | ||
| 0 | 01A | ||
| 0 | 007 | ||
| 1 | 007 | ||
| 0 | 000 | ||
| 0 (reset) | 000 | ||
| 1 | 009 |
Which action cleared the output register while the processor was stopped?
Describe one observation that distinguishes a masked input from a direct wire between the switches and lamps. Explain why changing the switches during a halt leaves the output register unchanged.
Assemble a change
Change and r1,#31 to and r1,#63 in simulation/switch_mask.s. Predict what will happen to LED5 when you change the input from 015 to 035 (hex). Use the included FPGAcademy assembler and the LabsLand RAM loader to regenerate the HDL. Keep the output in a new file.
If the assembler reports an error, correct the indicated line and assemble again before loading the memory image. A failed build leaves any previous .mif in place.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
VHDL
python3 simulation/sbasm.py simulation/switch_mask.s switch_mask.mif
python3 simulation/load_program.py switch_mask.mif starter/io_cpu.vhd --output my_io_cpu.vhd
Use your repaired HDL as the input to the loader. In a second copy of the worksheet, replace the contents of the original HDL file with the generated file, keeping its name. Change EXPECTED_MASK from 31 to 63 in the testbench and rerun the simulation. Build the new design and program the board using the same workflow.
Start with SW9 low and pulse KEY0. Use the table to test your new program. Record just LED5 (0 or 1). When you halt, leave 035 on the switches until the lamps have settled.
| SW9 | SW8–0 (hex) | Predicted LED5 | Board LED5 |
|---|---|---|---|
| 0 | 000 | ||
| 1 | 015 | ||
| 1 | 035 | ||
| 0 | 035 | ||
| 0 | 015 | ||
| 0 (reset) | 015 |
Hand in both bus timelines, your edited instruction and the two completed tables.
Adapted from the MIT-licensed FPGAcademy processor scaffold. The board interface, memory and exercise are by LabsLand. Verilog handout · VHDL handout · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Your processor will read switches, save the input in RAM, read it back, mask it and drive the LEDs. In Lab 9 every result stayed in a processor register. Here the address, data and write signal travel outside the CPU. Draw two bus timelines, one for the store to RAM and one for the load from the same word. Mark when the address becomes stable, when RAM writes the data, and when the destination register captures the returned word.
Follow the program
Open switch_mask.s. Register r7 is the program counter. RAM starts at 0x0000, the LED port is at 0x1000 and the switches are at 0x3000. RAM addresses select 16-bit words. Why is r0 cleared after the first store? Predict the result when SW8–0 contain 0x135.
Simulate and repair the load
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench runs the assembly program on your HDL processor for every one of the 512 switch words. It also checks halt, resume and reset. Find the first failing word. Inspect the address sent to RAM and the value on the bus when the load commits.
SystemVerilog
iverilog -g2012 -s trace_io -o trace starter/io_cpu.sv simulation/trace_io.v
vvp trace
iverilog -g2012 -s test_io -o bench starter/io_cpu.sv simulation/test_io.v
vvp bench
The trace runs first and sets SW9 high and SW8–0 to hex 035. It prints a trace of three instructions: the switch load (IR = 8004), the RAM store (A005) and the RAM load (8205). Each row shows the signals after the numbered rising edge, once they have settled. The next rising edge uses those values. Gaps in the edge numbers skip other instructions.
Use W, ADDR and DOUT to mark the edge that writes RAM word 0030. For the load, mark when DIN changes and when r1 captures the value on BUS. Compare the switch load before and after the repair: does r0 capture the switch word? An idle BUS can appear as XXXX or 0000.
Run the starter first and record the first mismatch. In the last microstep of a load, the destination register receives an old arithmetic result. Trace the bus selector and compare it with the source used after an add. Repair the load in the starter file and rerun the same commands. Continue when you see PASS 512 switch words, run hold, resume and reset.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
io_cpu, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Test the ports on the board
Run the rows in order. SW9 starts and stops the processor. SW8–0 supply a hexadecimal input word. Predict the LED word, set the switches, then read the lamps and record the word in hex. When a row changes SW9 from 1 to 0, lower only SW9 and wait before changing the data. Pulse KEY0 only in the two rows marked reset.
| SW9 | SW8–0 (hex) | Prediction | Board |
|---|---|---|---|
| 0 (reset) | 000 | ||
| 1 | 005 | ||
| 1 | 015 | ||
| 1 | 035 | ||
| 1 | 1E0 | ||
| 1 | 1FF | ||
| 1 | 1DF | ||
| 1 | 01A | ||
| 0 | 01A | ||
| 0 | 007 | ||
| 1 | 007 | ||
| 0 | 000 | ||
| 0 (reset) | 000 | ||
| 1 | 009 |
Which action cleared the output register while the processor was stopped?
Describe one observation that distinguishes a masked input from a direct wire between the switches and lamps. Explain why changing the switches during a halt leaves the output register unchanged.
Assemble a change
Change and r1,#31 to and r1,#63 in simulation/switch_mask.s. Predict what will happen to LED5 when you change the input from 015 to 035 (hex). Use the included FPGAcademy assembler and the LabsLand RAM loader to regenerate the HDL. Keep the output in a new file.
If the assembler reports an error, correct the indicated line and assemble again before loading the memory image. A failed build leaves any previous .mif in place.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
SystemVerilog
python3 simulation/sbasm.py simulation/switch_mask.s switch_mask.mif
python3 simulation/load_program.py switch_mask.mif starter/io_cpu.sv --output my_io_cpu.sv
Use your repaired HDL as the input to the loader. In a second copy of the worksheet, replace the contents of the original HDL file with the generated file, keeping its name. Change EXPECTED_MASK from 31 to 63 in the testbench and rerun the simulation. Build the new design and program the board using the same workflow.
Start with SW9 low and pulse KEY0. Use the table to test your new program. Record just LED5 (0 or 1). When you halt, leave 035 on the switches until the lamps have settled.
| SW9 | SW8–0 (hex) | Predicted LED5 | Board LED5 |
|---|---|---|---|
| 0 | 000 | ||
| 1 | 015 | ||
| 1 | 035 | ||
| 0 | 035 | ||
| 0 | 015 | ||
| 0 (reset) | 015 |
Hand in both bus timelines, your edited instruction and the two completed tables.
Adapted from the MIT-licensed FPGAcademy processor scaffold. The board interface, memory and exercise are by LabsLand. Verilog handout · VHDL handout · MIT
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Your processor will read switches, save the input in RAM, read it back, mask it and drive the LEDs. In Lab 9 every result stayed in a processor register. Here the address, data and write signal travel outside the CPU. Draw two bus timelines, one for the store to RAM and one for the load from the same word. Mark when the address becomes stable, when RAM writes the data, and when the destination register captures the returned word.
Follow the program
Open switch_mask.s. Register r7 is the program counter. RAM starts at 0x0000, the LED port is at 0x1000 and the switches are at 0x3000. RAM addresses select 16-bit words. Why is r0 cleared after the first store? Predict the result when SW8–0 contain 0x135.
Simulate and repair the load
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench runs the assembly program on your HDL processor for every one of the 512 switch words. It also checks halt, resume and reset. Find the first failing word. Inspect the address sent to RAM and the value on the bus when the load commits.
SystemVerilog
iverilog -g2012 -s trace_io -o trace starter/io_cpu.sv simulation/trace_io.v
vvp trace
iverilog -g2012 -s test_io -o bench starter/io_cpu.sv simulation/test_io.v
vvp bench
The trace runs first and sets SW9 high and SW8–0 to hex 035. It prints a trace of three instructions: the switch load (IR = 8004), the RAM store (A005) and the RAM load (8205). Each row shows the signals after the numbered rising edge, once they have settled. The next rising edge uses those values. Gaps in the edge numbers skip other instructions.
Use W, ADDR and DOUT to mark the edge that writes RAM word 0030. For the load, mark when DIN changes and when r1 captures the value on BUS. Compare the switch load before and after the repair: does r0 capture the switch word? An idle BUS can appear as XXXX or 0000.
Run the starter first and record the first mismatch. In the last microstep of a load, the destination register receives an old arithmetic result. Trace the bus selector and compare it with the source used after an add. Repair the load in the starter file and rerun the same commands. Continue when you see PASS 512 switch words, run hold, resume and reset.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/io_cpu.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
io_cpu. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/io_cpu.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Test the ports on the board
Run the rows in order. SW9 starts and stops the processor. SW8–0 supply a hexadecimal input word. Predict the LED word, set the switches, then read the lamps and record the word in hex. When a row changes SW9 from 1 to 0, lower only SW9 and wait before changing the data. Pulse KEY0 only in the two rows marked reset.
| SW9 | SW8–0 (hex) | Prediction | Board |
|---|---|---|---|
| 0 (reset) | 000 | ||
| 1 | 005 | ||
| 1 | 015 | ||
| 1 | 035 | ||
| 1 | 1E0 | ||
| 1 | 1FF | ||
| 1 | 1DF | ||
| 1 | 01A | ||
| 0 | 01A | ||
| 0 | 007 | ||
| 1 | 007 | ||
| 0 | 000 | ||
| 0 (reset) | 000 | ||
| 1 | 009 |
Which action cleared the output register while the processor was stopped?
Describe one observation that distinguishes a masked input from a direct wire between the switches and lamps. Explain why changing the switches during a halt leaves the output register unchanged.
Assemble a change
Change and r1,#31 to and r1,#63 in simulation/switch_mask.s. Predict what will happen to LED5 when you change the input from 015 to 035 (hex). Use the included FPGAcademy assembler and the LabsLand RAM loader to regenerate the HDL. Keep the output in a new file.
If the assembler reports an error, correct the indicated line and assemble again before loading the memory image. A failed build leaves any previous .mif in place.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
SystemVerilog
python3 simulation/sbasm.py simulation/switch_mask.s switch_mask.mif
python3 simulation/load_program.py switch_mask.mif starter/io_cpu.sv --output my_io_cpu.sv
Use your repaired HDL as the input to the loader. In a second copy of the worksheet, replace the contents of the original HDL file with the generated file, keeping its name. Change EXPECTED_MASK from 31 to 63 in the testbench and rerun the simulation. Build the new design and program the board using the same workflow.
Start with SW9 low and pulse KEY0. Use the table to test your new program. Record just LED5 (0 or 1). When you halt, leave 035 on the switches until the lamps have settled.
| SW9 | SW8–0 (hex) | Predicted LED5 | Board LED5 |
|---|---|---|---|
| 0 | 000 | ||
| 1 | 015 | ||
| 1 | 035 | ||
| 0 | 035 | ||
| 0 | 015 | ||
| 0 (reset) | 015 |
Hand in both bus timelines, your edited instruction and the two completed tables.
Adapted from the MIT-licensed FPGAcademy processor scaffold. The board interface, memory and exercise are by LabsLand. Verilog handout · VHDL handout · MIT
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
The CPU has one write bus. How can six displays each remember a different digit? You'll add a memory-mapped peripheral to the processor from Part III, then use an assembly program to write one display at a time.
Sketch the port
Allocate one 7-bit register to each of the word addresses 0x2000 through 0x2005. In your diagram, show which address bits select the peripheral, which select one digit, and where the write enable enters. A software pattern uses 1 for a lit segment. A physical HEX pin uses 0 for a lit segment. Mark the single place where the polarity changes. What must addresses 0x2006 and 0x2007 do?
Test the address decoder
Download the complete activity for your HDL and extract it. Run the bench once with the unchanged starter. Which selector first leaves a display blank when you expected a digit?
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench tries every ordered pair of the eight selectors. It checks all six pin patterns after reset, writes, unused addresses and switch changes during a halt.
Verilog
iverilog -g2005 -s test_display -o bench starter/display_cpu.v simulation/test_display.v
vvp bench
Find the display write enable in the starter HDL. HEX0 accepts a write, but the other five registers ignore theirs. Repair the decoder so each valid address updates only its own register. Keep addresses 0x2006 and 0x2007 harmless. Run the same commands again and look for PASS all 64 ordered address pairs, retention, halt and reset.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
display_cpu, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Write the digits
Lower SW9 and pulse KEY0 once. Look at all six digits on the live camera. With the processor stopped, set SW2–0 to the next selector. Raise SW9 to let the program write, then lower it before changing the selector. Changing several switches while running can briefly write an intermediate address.
| Selector sequence | Predict HEX5 through HEX0; use a dash for blank | Observed |
|---|---|---|
| Reset, then 4 | ||
| Then 1, then 7 | ||
| Then 0, then 5 | ||
| Then 6, then 2, then 3 | ||
| Reset while stopped | ||
| Select 3 and run again |
Explain how the visit to address 0x2007 distinguishes an unused address from an alias. Include a camera observation that proves a digit retained its earlier value while a different digit was written.
Read the assembly
In display_digits.s, find the two additions using the same selector. Explain why one address points to RAM and the other to a display register. Which instruction actually changes a digit? For an optional experiment, change the fourth pattern word (selector 3) from 0x4F to 0x40. Sketch the segments you expect to light. Run these commands from the worksheet folder, keeping your decoder repair in the starter file.
If the assembler reports an error, correct the indicated line and assemble again before loading the memory image. A failed build leaves any previous .mif in place.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
Verilog
python3 simulation/sbasm.py simulation/display_digits.s digits.mif
python3 simulation/load_program.py digits.mif starter/display_cpu.v --output my_display_cpu.v
Copy the generated HDL back into the same design file you just tested. Repeat the build and upload steps, reset with SW9 low, select 3 and raise SW9. Sketch HEX3 and label the blank digits “off”. Which segment lights on HEX3? Lower SW9, select 1, then raise SW9 and check whether HEX3 retains its new pattern.
Submit your address diagram, observations and a short explanation of the active-low outputs.
Adapted from the FPGAcademy processor exercise. Verilog handout · VHDL handout · MIT license
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
The CPU has one write bus. How can six displays each remember a different digit? You'll add a memory-mapped peripheral to the processor from Part III, then use an assembly program to write one display at a time.
Sketch the port
Allocate one 7-bit register to each of the word addresses 0x2000 through 0x2005. In your diagram, show which address bits select the peripheral, which select one digit, and where the write enable enters. A software pattern uses 1 for a lit segment. A physical HEX pin uses 0 for a lit segment. Mark the single place where the polarity changes. What must addresses 0x2006 and 0x2007 do?
Test the address decoder
Download the complete activity for your HDL and extract it. Run the bench once with the unchanged starter. Which selector first leaves a display blank when you expected a digit?
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench tries every ordered pair of the eight selectors. It checks all six pin patterns after reset, writes, unused addresses and switch changes during a halt.
Verilog
iverilog -g2005 -s test_display -o bench starter/display_cpu.v simulation/test_display.v
vvp bench
Find the display write enable in the starter HDL. HEX0 accepts a write, but the other five registers ignore theirs. Repair the decoder so each valid address updates only its own register. Keep addresses 0x2006 and 0x2007 harmless. Run the same commands again and look for PASS all 64 ordered address pairs, retention, halt and reset.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/display_cpu.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
display_cpu. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/display_cpu.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Write the digits
Lower SW9 and pulse KEY0 once. Look at all six digits on the live camera. With the processor stopped, set SW2–0 to the next selector. Raise SW9 to let the program write, then lower it before changing the selector. Changing several switches while running can briefly write an intermediate address.
| Selector sequence | Predict HEX5 through HEX0; use a dash for blank | Observed |
|---|---|---|
| Reset, then 4 | ||
| Then 1, then 7 | ||
| Then 0, then 5 | ||
| Then 6, then 2, then 3 | ||
| Reset while stopped | ||
| Select 3 and run again |
Explain how the visit to address 0x2007 distinguishes an unused address from an alias. Include a camera observation that proves a digit retained its earlier value while a different digit was written.
Read the assembly
In display_digits.s, find the two additions using the same selector. Explain why one address points to RAM and the other to a display register. Which instruction actually changes a digit? For an optional experiment, change the fourth pattern word (selector 3) from 0x4F to 0x40. Sketch the segments you expect to light. Run these commands from the worksheet folder, keeping your decoder repair in the starter file.
If the assembler reports an error, correct the indicated line and assemble again before loading the memory image. A failed build leaves any previous .mif in place.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
Verilog
python3 simulation/sbasm.py simulation/display_digits.s digits.mif
python3 simulation/load_program.py digits.mif starter/display_cpu.v --output my_display_cpu.v
Copy the generated HDL back into the same design file you just tested. Repeat the build and upload steps, reset with SW9 low, select 3 and raise SW9. Sketch HEX3 and label the blank digits “off”. Which segment lights on HEX3? Lower SW9, select 1, then raise SW9 and check whether HEX3 retains its new pattern.
Submit your address diagram, observations and a short explanation of the active-low outputs.
Adapted from the FPGAcademy processor exercise. Verilog handout · VHDL handout · MIT license
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
The CPU has one write bus. How can six displays each remember a different digit? You'll add a memory-mapped peripheral to the processor from Part III, then use an assembly program to write one display at a time.
Sketch the port
Allocate one 7-bit register to each of the word addresses 0x2000 through 0x2005. In your diagram, show which address bits select the peripheral, which select one digit, and where the write enable enters. A software pattern uses 1 for a lit segment. A physical HEX pin uses 0 for a lit segment. Mark the single place where the polarity changes. What must addresses 0x2006 and 0x2007 do?
Test the address decoder
Download the complete activity for your HDL and extract it. Run the bench once with the unchanged starter. Which selector first leaves a display blank when you expected a digit?
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench tries every ordered pair of the eight selectors. It checks all six pin patterns after reset, writes, unused addresses and switch changes during a halt.
VHDL
nvc --std=2008 -a starter/display_cpu.vhd simulation/test_display.vhd
nvc --std=2008 -e test_display
nvc --std=2008 -r test_display
Find the display write enable in the starter HDL. HEX0 accepts a write, but the other five registers ignore theirs. Repair the decoder so each valid address updates only its own register. Keep addresses 0x2006 and 0x2007 harmless. Run the same commands again and look for PASS all 64 ordered address pairs, retention, halt and reset.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
display_cpu, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Write the digits
Lower SW9 and pulse KEY0 once. Look at all six digits on the live camera. With the processor stopped, set SW2–0 to the next selector. Raise SW9 to let the program write, then lower it before changing the selector. Changing several switches while running can briefly write an intermediate address.
| Selector sequence | Predict HEX5 through HEX0; use a dash for blank | Observed |
|---|---|---|
| Reset, then 4 | ||
| Then 1, then 7 | ||
| Then 0, then 5 | ||
| Then 6, then 2, then 3 | ||
| Reset while stopped | ||
| Select 3 and run again |
Explain how the visit to address 0x2007 distinguishes an unused address from an alias. Include a camera observation that proves a digit retained its earlier value while a different digit was written.
Read the assembly
In display_digits.s, find the two additions using the same selector. Explain why one address points to RAM and the other to a display register. Which instruction actually changes a digit? For an optional experiment, change the fourth pattern word (selector 3) from 0x4F to 0x40. Sketch the segments you expect to light. Run these commands from the worksheet folder, keeping your decoder repair in the starter file.
If the assembler reports an error, correct the indicated line and assemble again before loading the memory image. A failed build leaves any previous .mif in place.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
VHDL
python3 simulation/sbasm.py simulation/display_digits.s digits.mif
python3 simulation/load_program.py digits.mif starter/display_cpu.vhd --output my_display_cpu.vhd
Copy the generated HDL back into the same design file you just tested. Repeat the build and upload steps, reset with SW9 low, select 3 and raise SW9. Sketch HEX3 and label the blank digits “off”. Which segment lights on HEX3? Lower SW9, select 1, then raise SW9 and check whether HEX3 retains its new pattern.
Submit your address diagram, observations and a short explanation of the active-low outputs.
Adapted from the FPGAcademy processor exercise. Verilog handout · VHDL handout · MIT license
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
The CPU has one write bus. How can six displays each remember a different digit? You'll add a memory-mapped peripheral to the processor from Part III, then use an assembly program to write one display at a time.
Sketch the port
Allocate one 7-bit register to each of the word addresses 0x2000 through 0x2005. In your diagram, show which address bits select the peripheral, which select one digit, and where the write enable enters. A software pattern uses 1 for a lit segment. A physical HEX pin uses 0 for a lit segment. Mark the single place where the polarity changes. What must addresses 0x2006 and 0x2007 do?
Test the address decoder
Download the complete activity for your HDL and extract it. Run the bench once with the unchanged starter. Which selector first leaves a display blank when you expected a digit?
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench tries every ordered pair of the eight selectors. It checks all six pin patterns after reset, writes, unused addresses and switch changes during a halt.
VHDL
nvc --std=2008 -a starter/display_cpu.vhd simulation/test_display.vhd
nvc --std=2008 -e test_display
nvc --std=2008 -r test_display
Find the display write enable in the starter HDL. HEX0 accepts a write, but the other five registers ignore theirs. Repair the decoder so each valid address updates only its own register. Keep addresses 0x2006 and 0x2007 harmless. Run the same commands again and look for PASS all 64 ordered address pairs, retention, halt and reset.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/display_cpu.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
display_cpu. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/display_cpu.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Write the digits
Lower SW9 and pulse KEY0 once. Look at all six digits on the live camera. With the processor stopped, set SW2–0 to the next selector. Raise SW9 to let the program write, then lower it before changing the selector. Changing several switches while running can briefly write an intermediate address.
| Selector sequence | Predict HEX5 through HEX0; use a dash for blank | Observed |
|---|---|---|
| Reset, then 4 | ||
| Then 1, then 7 | ||
| Then 0, then 5 | ||
| Then 6, then 2, then 3 | ||
| Reset while stopped | ||
| Select 3 and run again |
Explain how the visit to address 0x2007 distinguishes an unused address from an alias. Include a camera observation that proves a digit retained its earlier value while a different digit was written.
Read the assembly
In display_digits.s, find the two additions using the same selector. Explain why one address points to RAM and the other to a display register. Which instruction actually changes a digit? For an optional experiment, change the fourth pattern word (selector 3) from 0x4F to 0x40. Sketch the segments you expect to light. Run these commands from the worksheet folder, keeping your decoder repair in the starter file.
If the assembler reports an error, correct the indicated line and assemble again before loading the memory image. A failed build leaves any previous .mif in place.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
VHDL
python3 simulation/sbasm.py simulation/display_digits.s digits.mif
python3 simulation/load_program.py digits.mif starter/display_cpu.vhd --output my_display_cpu.vhd
Copy the generated HDL back into the same design file you just tested. Repeat the build and upload steps, reset with SW9 low, select 3 and raise SW9. Sketch HEX3 and label the blank digits “off”. Which segment lights on HEX3? Lower SW9, select 1, then raise SW9 and check whether HEX3 retains its new pattern.
Submit your address diagram, observations and a short explanation of the active-low outputs.
Adapted from the FPGAcademy processor exercise. Verilog handout · VHDL handout · MIT license
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
The CPU has one write bus. How can six displays each remember a different digit? You'll add a memory-mapped peripheral to the processor from Part III, then use an assembly program to write one display at a time.
Sketch the port
Allocate one 7-bit register to each of the word addresses 0x2000 through 0x2005. In your diagram, show which address bits select the peripheral, which select one digit, and where the write enable enters. A software pattern uses 1 for a lit segment. A physical HEX pin uses 0 for a lit segment. Mark the single place where the polarity changes. What must addresses 0x2006 and 0x2007 do?
Test the address decoder
Download the complete activity for your HDL and extract it. Run the bench once with the unchanged starter. Which selector first leaves a display blank when you expected a digit?
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench tries every ordered pair of the eight selectors. It checks all six pin patterns after reset, writes, unused addresses and switch changes during a halt.
SystemVerilog
iverilog -g2012 -s test_display -o bench starter/display_cpu.sv simulation/test_display.v
vvp bench
Find the display write enable in the starter HDL. HEX0 accepts a write, but the other five registers ignore theirs. Repair the decoder so each valid address updates only its own register. Keep addresses 0x2006 and 0x2007 harmless. Run the same commands again and look for PASS all 64 ordered address pairs, retention, halt and reset.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
display_cpu, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Write the digits
Lower SW9 and pulse KEY0 once. Look at all six digits on the live camera. With the processor stopped, set SW2–0 to the next selector. Raise SW9 to let the program write, then lower it before changing the selector. Changing several switches while running can briefly write an intermediate address.
| Selector sequence | Predict HEX5 through HEX0; use a dash for blank | Observed |
|---|---|---|
| Reset, then 4 | ||
| Then 1, then 7 | ||
| Then 0, then 5 | ||
| Then 6, then 2, then 3 | ||
| Reset while stopped | ||
| Select 3 and run again |
Explain how the visit to address 0x2007 distinguishes an unused address from an alias. Include a camera observation that proves a digit retained its earlier value while a different digit was written.
Read the assembly
In display_digits.s, find the two additions using the same selector. Explain why one address points to RAM and the other to a display register. Which instruction actually changes a digit? For an optional experiment, change the fourth pattern word (selector 3) from 0x4F to 0x40. Sketch the segments you expect to light. Run these commands from the worksheet folder, keeping your decoder repair in the starter file.
If the assembler reports an error, correct the indicated line and assemble again before loading the memory image. A failed build leaves any previous .mif in place.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
SystemVerilog
python3 simulation/sbasm.py simulation/display_digits.s digits.mif
python3 simulation/load_program.py digits.mif starter/display_cpu.sv --output my_display_cpu.sv
Copy the generated HDL back into the same design file you just tested. Repeat the build and upload steps, reset with SW9 low, select 3 and raise SW9. Sketch HEX3 and label the blank digits “off”. Which segment lights on HEX3? Lower SW9, select 1, then raise SW9 and check whether HEX3 retains its new pattern.
Submit your address diagram, observations and a short explanation of the active-low outputs.
Adapted from the FPGAcademy processor exercise. Verilog handout · VHDL handout · MIT license
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
The CPU has one write bus. How can six displays each remember a different digit? You'll add a memory-mapped peripheral to the processor from Part III, then use an assembly program to write one display at a time.
Sketch the port
Allocate one 7-bit register to each of the word addresses 0x2000 through 0x2005. In your diagram, show which address bits select the peripheral, which select one digit, and where the write enable enters. A software pattern uses 1 for a lit segment. A physical HEX pin uses 0 for a lit segment. Mark the single place where the polarity changes. What must addresses 0x2006 and 0x2007 do?
Test the address decoder
Download the complete activity for your HDL and extract it. Run the bench once with the unchanged starter. Which selector first leaves a display blank when you expected a digit?
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
The bench tries every ordered pair of the eight selectors. It checks all six pin patterns after reset, writes, unused addresses and switch changes during a halt.
SystemVerilog
iverilog -g2012 -s test_display -o bench starter/display_cpu.sv simulation/test_display.v
vvp bench
Find the display write enable in the starter HDL. HEX0 accepts a write, but the other five registers ignore theirs. Repair the decoder so each valid address updates only its own register. Keep addresses 0x2006 and 0x2007 harmless. Run the same commands again and look for PASS all 64 ordered address pairs, retention, halt and reset.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/display_cpu.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
display_cpu. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/display_cpu.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Write the digits
Lower SW9 and pulse KEY0 once. Look at all six digits on the live camera. With the processor stopped, set SW2–0 to the next selector. Raise SW9 to let the program write, then lower it before changing the selector. Changing several switches while running can briefly write an intermediate address.
| Selector sequence | Predict HEX5 through HEX0; use a dash for blank | Observed |
|---|---|---|
| Reset, then 4 | ||
| Then 1, then 7 | ||
| Then 0, then 5 | ||
| Then 6, then 2, then 3 | ||
| Reset while stopped | ||
| Select 3 and run again |
Explain how the visit to address 0x2007 distinguishes an unused address from an alias. Include a camera observation that proves a digit retained its earlier value while a different digit was written.
Read the assembly
In display_digits.s, find the two additions using the same selector. Explain why one address points to RAM and the other to a display register. Which instruction actually changes a digit? For an optional experiment, change the fourth pattern word (selector 3) from 0x4F to 0x40. Sketch the segments you expect to light. Run these commands from the worksheet folder, keeping your decoder repair in the starter file.
If the assembler reports an error, correct the indicated line and assemble again before loading the memory image. A failed build leaves any previous .mif in place.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
SystemVerilog
python3 simulation/sbasm.py simulation/display_digits.s digits.mif
python3 simulation/load_program.py digits.mif starter/display_cpu.sv --output my_display_cpu.sv
Copy the generated HDL back into the same design file you just tested. Repeat the build and upload steps, reset with SW9 low, select 3 and raise SW9. Sketch HEX3 and label the blank digits “off”. Which segment lights on HEX3? Lower SW9, select 1, then raise SW9 and check whether HEX3 retains its new pattern.
Submit your address diagram, observations and a short explanation of the active-low outputs.
Adapted from the FPGAcademy processor exercise. Verilog handout · VHDL handout · MIT license
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
A program can report which instruction sent it down the wrong path. Build a processor with zero, negative and carry flags. Its diagnostic prints a word on the displays and either a test count or an instruction address on the LEDs.
Read the flags
Sketch what happens at fetch, when the condition is checked and when the target reaches the program counter. For an instruction at word 0x11 that branches forward by 0x2C, find the target using the PC after fetch. How would a nine-bit offset of 0x1FF change that PC?
Predict Z, N and C after adding 1 to 0xFFFF and after subtracting 1 from zero. For subtraction, a carry of 1 means no borrow. Explain which flags a branch may read and which it should preserve.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
branch_cpu, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
First synthesize and upload the starter unchanged. Lower SW9, pulse KEY0 once, then raise SW9. Read HEX5 through HEX0 and the ten red LEDs from the camera. Convert the LED pattern to a hexadecimal word address.
Find the failing instruction
Assemble the supplied diagnostic program. Open the resulting text file and find the row corresponding to the address on your LEDs. Read the preceding ALU instruction. Decide whether this branch should have been taken, then correct the relevant condition in the HDL.
If the assembler reports an error, correct the indicated line and assemble again before loading the memory image. A failed build leaves any previous .mif in place.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
python3 simulation/sbasm.py simulation/branch_diagnostic.s diagnostic.mif
The embedded program already matches the supplied assembly. If you change the assembly, insert the new image using the RAM loader and a copy of your repaired HDL.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
This bench runs the diagnostic inside the processor, checks the six active-low pin patterns and reads all ten LED bits. With the starter it reports the failing address. With the repair it checks the success count and held result. Match the hexadecimal address after 0x to the address column in diagnostic.mif. Check the instruction on that row against the ten LEDs you read on the board.
Verilog
iverilog -g2005 -s test_branch -o bench starter/branch_cpu.v simulation/test_branch.v
vvp bench
Confirm the repair
Rebuild and upload the repaired processor. Repeat the same reset and run sequence. Lower SW9 and record what the displays and LEDs retain.
| Design | Six display characters | LEDs in hex | What the LED value identifies |
|---|---|---|---|
| Before repair | |||
| After repair |
Submit the failing instruction, its address and predicted target, the flag values that explain the failure, and both board readings. Identify one branch that fell through and one that was taken in the repaired program.
FPGAcademy supplied the diagnostic assembly and processor scaffold under the MIT license. Verilog handout · VHDL handout · MIT license
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
A program can report which instruction sent it down the wrong path. Build a processor with zero, negative and carry flags. Its diagnostic prints a word on the displays and either a test count or an instruction address on the LEDs.
Read the flags
Sketch what happens at fetch, when the condition is checked and when the target reaches the program counter. For an instruction at word 0x11 that branches forward by 0x2C, find the target using the PC after fetch. How would a nine-bit offset of 0x1FF change that PC?
Predict Z, N and C after adding 1 to 0xFFFF and after subtracting 1 from zero. For subtraction, a carry of 1 means no borrow. Explain which flags a branch may read and which it should preserve.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/branch_cpu.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
branch_cpu. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/branch_cpu.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
First synthesize and upload the starter unchanged. Lower SW9, pulse KEY0 once, then raise SW9. Read HEX5 through HEX0 and the ten red LEDs from the camera. Convert the LED pattern to a hexadecimal word address.
Find the failing instruction
Assemble the supplied diagnostic program. Open the resulting text file and find the row corresponding to the address on your LEDs. Read the preceding ALU instruction. Decide whether this branch should have been taken, then correct the relevant condition in the HDL.
If the assembler reports an error, correct the indicated line and assemble again before loading the memory image. A failed build leaves any previous .mif in place.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
python3 simulation/sbasm.py simulation/branch_diagnostic.s diagnostic.mif
The embedded program already matches the supplied assembly. If you change the assembly, insert the new image using the RAM loader and a copy of your repaired HDL.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
This bench runs the diagnostic inside the processor, checks the six active-low pin patterns and reads all ten LED bits. With the starter it reports the failing address. With the repair it checks the success count and held result. Match the hexadecimal address after 0x to the address column in diagnostic.mif. Check the instruction on that row against the ten LEDs you read on the board.
Verilog
iverilog -g2005 -s test_branch -o bench starter/branch_cpu.v simulation/test_branch.v
vvp bench
Confirm the repair
Rebuild and upload the repaired processor. Repeat the same reset and run sequence. Lower SW9 and record what the displays and LEDs retain.
| Design | Six display characters | LEDs in hex | What the LED value identifies |
|---|---|---|---|
| Before repair | |||
| After repair |
Submit the failing instruction, its address and predicted target, the flag values that explain the failure, and both board readings. Identify one branch that fell through and one that was taken in the repaired program.
FPGAcademy supplied the diagnostic assembly and processor scaffold under the MIT license. Verilog handout · VHDL handout · MIT license
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
A program can report which instruction sent it down the wrong path. Build a processor with zero, negative and carry flags. Its diagnostic prints a word on the displays and either a test count or an instruction address on the LEDs.
Read the flags
Sketch what happens at fetch, when the condition is checked and when the target reaches the program counter. For an instruction at word 0x11 that branches forward by 0x2C, find the target using the PC after fetch. How would a nine-bit offset of 0x1FF change that PC?
Predict Z, N and C after adding 1 to 0xFFFF and after subtracting 1 from zero. For subtraction, a carry of 1 means no borrow. Explain which flags a branch may read and which it should preserve.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
branch_cpu, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
First synthesize and upload the starter unchanged. Lower SW9, pulse KEY0 once, then raise SW9. Read HEX5 through HEX0 and the ten red LEDs from the camera. Convert the LED pattern to a hexadecimal word address.
Find the failing instruction
Assemble the supplied diagnostic program. Open the resulting text file and find the row corresponding to the address on your LEDs. Read the preceding ALU instruction. Decide whether this branch should have been taken, then correct the relevant condition in the HDL.
If the assembler reports an error, correct the indicated line and assemble again before loading the memory image. A failed build leaves any previous .mif in place.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
python3 simulation/sbasm.py simulation/branch_diagnostic.s diagnostic.mif
The embedded program already matches the supplied assembly. If you change the assembly, insert the new image using the RAM loader and a copy of your repaired HDL.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
This bench runs the diagnostic inside the processor, checks the six active-low pin patterns and reads all ten LED bits. With the starter it reports the failing address. With the repair it checks the success count and held result. Match the hexadecimal address after 0x to the address column in diagnostic.mif. Check the instruction on that row against the ten LEDs you read on the board.
VHDL
nvc --std=2008 -a starter/branch_cpu.vhd simulation/test_branch.vhd
nvc --std=2008 -e test_branch
nvc --std=2008 -r test_branch
Confirm the repair
Rebuild and upload the repaired processor. Repeat the same reset and run sequence. Lower SW9 and record what the displays and LEDs retain.
| Design | Six display characters | LEDs in hex | What the LED value identifies |
|---|---|---|---|
| Before repair | |||
| After repair |
Submit the failing instruction, its address and predicted target, the flag values that explain the failure, and both board readings. Identify one branch that fell through and one that was taken in the repaired program.
FPGAcademy supplied the diagnostic assembly and processor scaffold under the MIT license. Verilog handout · VHDL handout · MIT license
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
A program can report which instruction sent it down the wrong path. Build a processor with zero, negative and carry flags. Its diagnostic prints a word on the displays and either a test count or an instruction address on the LEDs.
Read the flags
Sketch what happens at fetch, when the condition is checked and when the target reaches the program counter. For an instruction at word 0x11 that branches forward by 0x2C, find the target using the PC after fetch. How would a nine-bit offset of 0x1FF change that PC?
Predict Z, N and C after adding 1 to 0xFFFF and after subtracting 1 from zero. For subtraction, a carry of 1 means no borrow. Explain which flags a branch may read and which it should preserve.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/branch_cpu.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
branch_cpu. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/branch_cpu.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
First synthesize and upload the starter unchanged. Lower SW9, pulse KEY0 once, then raise SW9. Read HEX5 through HEX0 and the ten red LEDs from the camera. Convert the LED pattern to a hexadecimal word address.
Find the failing instruction
Assemble the supplied diagnostic program. Open the resulting text file and find the row corresponding to the address on your LEDs. Read the preceding ALU instruction. Decide whether this branch should have been taken, then correct the relevant condition in the HDL.
If the assembler reports an error, correct the indicated line and assemble again before loading the memory image. A failed build leaves any previous .mif in place.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
python3 simulation/sbasm.py simulation/branch_diagnostic.s diagnostic.mif
The embedded program already matches the supplied assembly. If you change the assembly, insert the new image using the RAM loader and a copy of your repaired HDL.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
This bench runs the diagnostic inside the processor, checks the six active-low pin patterns and reads all ten LED bits. With the starter it reports the failing address. With the repair it checks the success count and held result. Match the hexadecimal address after 0x to the address column in diagnostic.mif. Check the instruction on that row against the ten LEDs you read on the board.
VHDL
nvc --std=2008 -a starter/branch_cpu.vhd simulation/test_branch.vhd
nvc --std=2008 -e test_branch
nvc --std=2008 -r test_branch
Confirm the repair
Rebuild and upload the repaired processor. Repeat the same reset and run sequence. Lower SW9 and record what the displays and LEDs retain.
| Design | Six display characters | LEDs in hex | What the LED value identifies |
|---|---|---|---|
| Before repair | |||
| After repair |
Submit the failing instruction, its address and predicted target, the flag values that explain the failure, and both board readings. Identify one branch that fell through and one that was taken in the repaired program.
FPGAcademy supplied the diagnostic assembly and processor scaffold under the MIT license. Verilog handout · VHDL handout · MIT license
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
A program can report which instruction sent it down the wrong path. Build a processor with zero, negative and carry flags. Its diagnostic prints a word on the displays and either a test count or an instruction address on the LEDs.
Read the flags
Sketch what happens at fetch, when the condition is checked and when the target reaches the program counter. For an instruction at word 0x11 that branches forward by 0x2C, find the target using the PC after fetch. How would a nine-bit offset of 0x1FF change that PC?
Predict Z, N and C after adding 1 to 0xFFFF and after subtracting 1 from zero. For subtraction, a carry of 1 means no borrow. Explain which flags a branch may read and which it should preserve.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
branch_cpu, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
First synthesize and upload the starter unchanged. Lower SW9, pulse KEY0 once, then raise SW9. Read HEX5 through HEX0 and the ten red LEDs from the camera. Convert the LED pattern to a hexadecimal word address.
Find the failing instruction
Assemble the supplied diagnostic program. Open the resulting text file and find the row corresponding to the address on your LEDs. Read the preceding ALU instruction. Decide whether this branch should have been taken, then correct the relevant condition in the HDL.
If the assembler reports an error, correct the indicated line and assemble again before loading the memory image. A failed build leaves any previous .mif in place.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
python3 simulation/sbasm.py simulation/branch_diagnostic.s diagnostic.mif
The embedded program already matches the supplied assembly. If you change the assembly, insert the new image using the RAM loader and a copy of your repaired HDL.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
This bench runs the diagnostic inside the processor, checks the six active-low pin patterns and reads all ten LED bits. With the starter it reports the failing address. With the repair it checks the success count and held result. Match the hexadecimal address after 0x to the address column in diagnostic.mif. Check the instruction on that row against the ten LEDs you read on the board.
SystemVerilog
iverilog -g2012 -s test_branch -o bench starter/branch_cpu.sv simulation/test_branch.v
vvp bench
Confirm the repair
Rebuild and upload the repaired processor. Repeat the same reset and run sequence. Lower SW9 and record what the displays and LEDs retain.
| Design | Six display characters | LEDs in hex | What the LED value identifies |
|---|---|---|---|
| Before repair | |||
| After repair |
Submit the failing instruction, its address and predicted target, the flag values that explain the failure, and both board readings. Identify one branch that fell through and one that was taken in the repaired program.
FPGAcademy supplied the diagnostic assembly and processor scaffold under the MIT license. Verilog handout · VHDL handout · MIT license
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
A program can report which instruction sent it down the wrong path. Build a processor with zero, negative and carry flags. Its diagnostic prints a word on the displays and either a test count or an instruction address on the LEDs.
Read the flags
Sketch what happens at fetch, when the condition is checked and when the target reaches the program counter. For an instruction at word 0x11 that branches forward by 0x2C, find the target using the PC after fetch. How would a nine-bit offset of 0x1FF change that PC?
Predict Z, N and C after adding 1 to 0xFFFF and after subtracting 1 from zero. For subtraction, a carry of 1 means no borrow. Explain which flags a branch may read and which it should preserve.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/branch_cpu.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
branch_cpu. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/branch_cpu.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
First synthesize and upload the starter unchanged. Lower SW9, pulse KEY0 once, then raise SW9. Read HEX5 through HEX0 and the ten red LEDs from the camera. Convert the LED pattern to a hexadecimal word address.
Find the failing instruction
Assemble the supplied diagnostic program. Open the resulting text file and find the row corresponding to the address on your LEDs. Read the preceding ALU instruction. Decide whether this branch should have been taken, then correct the relevant condition in the HDL.
If the assembler reports an error, correct the indicated line and assemble again before loading the memory image. A failed build leaves any previous .mif in place.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
python3 simulation/sbasm.py simulation/branch_diagnostic.s diagnostic.mif
The embedded program already matches the supplied assembly. If you change the assembly, insert the new image using the RAM loader and a copy of your repaired HDL.
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md.
This bench runs the diagnostic inside the processor, checks the six active-low pin patterns and reads all ten LED bits. With the starter it reports the failing address. With the repair it checks the success count and held result. Match the hexadecimal address after 0x to the address column in diagnostic.mif. Check the instruction on that row against the ten LEDs you read on the board.
SystemVerilog
iverilog -g2012 -s test_branch -o bench starter/branch_cpu.sv simulation/test_branch.v
vvp bench
Confirm the repair
Rebuild and upload the repaired processor. Repeat the same reset and run sequence. Lower SW9 and record what the displays and LEDs retain.
| Design | Six display characters | LEDs in hex | What the LED value identifies |
|---|---|---|---|
| Before repair | |||
| After repair |
Submit the failing instruction, its address and predicted target, the flag values that explain the failure, and both board readings. Identify one branch that fell through and one that was taken in the repaired program.
FPGAcademy supplied the diagnostic assembly and processor scaffold under the MIT license. Verilog handout · VHDL handout · MIT license
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Make the ten red LEDs count in binary. The starter counts, but adjusting SW2–0 does nothing to its speed. You'll repair the assembly program, build it into the processor in your chosen HDL and measure the result on a physical DE1-SoC. On your computer, use Python 3 to assemble the program and NVC (VHDL) or Icarus Verilog (Verilog and SystemVerilog) to check its timing before you open the lab.
Predict the period
In paced_counter.s, mark the two backwards branches. The inner loop starts with r1 = 0x0200. Count the instructions spent in one inner iteration. Find where the outer loop gets its count and explain how you would avoid a zero starting count. The processor starts one instruction every 16,384 board clocks at 50 MHz. Estimate the period with one outer pass and with eight.
Assemble the starter
Download and extract the activity ZIP. From the folder containing activity.md, assemble the unchanged program and load it into the starter for your selected HDL.
If the assembler reports an error, correct the indicated line and assemble again before loading the memory image. A failed build leaves any previous .mif in place.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
Verilog
python3 simulation/sbasm.py simulation/paced_counter.s paced.mif
python3 simulation/load_program.py paced.mif starter/paced_cpu.v --output my_paced_cpu.v
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md. The simulator reads the HDL file you generated in the assembly step.
The bench starts an instruction every eight simulated clock cycles, so you can test the same assembly loops more quickly. It measures the periods at 000 and 111, then checks the six settings in between. With SW9 down, the count must hold for two full fast-count periods. The final check resets the counter.
Record the two periods reported for the unchanged program. Change the mask in simulation/paced_counter.s so SW2–0 sets the outer-loop count. Leave the 512 inner iterations unchanged. Assemble the edit, regenerate the HDL and run the same bench again. Which period changed?
Verilog
iverilog -g2005 -s test_paced -o bench my_paced_cpu.v simulation/test_paced.v
vvp bench
Build
Use the regenerated HDL that passed the simulation. Keep paced_cpu as the top-level name.
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
paced_cpu, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Time the physical counter
With SW9 down, set SW2–0 to 000 and wait two seconds for the switches to settle, then pulse KEY0 once. Raise SW9. Note the binary count and time at two readings several seconds apart. Lower SW9 and confirm the count holds. Repeat from reset with SW2–0 at 111, allowing at least nine seconds for the slower run.
| SW2–0 | First count and time | Last count and time | Seconds per increment |
|---|---|---|---|
| 000 | |||
| 111 |
Read LED0 as the least significant bit. The camera can skip intermediate counts. Use two clearly readable values after the count starts moving. If the count is the same at both readings, keep timing until it changes. Divide elapsed time by the change in count. Compare the measured ratio with your prediction, allowing for the camera refresh. Which instructions run only once per displayed count?
Based on FPGAcademy Digital Logic Lab 10. Verilog handout · VHDL handout · MIT license
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Make the ten red LEDs count in binary. The starter counts, but adjusting SW2–0 does nothing to its speed. You'll repair the assembly program, build it into the processor in your chosen HDL and measure the result on a physical DE1-SoC. On your computer, use Python 3 to assemble the program and NVC (VHDL) or Icarus Verilog (Verilog and SystemVerilog) to check its timing before you open the lab.
Predict the period
In paced_counter.s, mark the two backwards branches. The inner loop starts with r1 = 0x0200. Count the instructions spent in one inner iteration. Find where the outer loop gets its count and explain how you would avoid a zero starting count. The processor starts one instruction every 16,384 board clocks at 50 MHz. Estimate the period with one outer pass and with eight.
Assemble the starter
Download and extract the activity ZIP. From the folder containing activity.md, assemble the unchanged program and load it into the starter for your selected HDL.
If the assembler reports an error, correct the indicated line and assemble again before loading the memory image. A failed build leaves any previous .mif in place.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
Verilog
python3 simulation/sbasm.py simulation/paced_counter.s paced.mif
python3 simulation/load_program.py paced.mif starter/paced_cpu.v --output my_paced_cpu.v
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md. The simulator reads the HDL file you generated in the assembly step.
The bench starts an instruction every eight simulated clock cycles, so you can test the same assembly loops more quickly. It measures the periods at 000 and 111, then checks the six settings in between. With SW9 down, the count must hold for two full fast-count periods. The final check resets the counter.
Record the two periods reported for the unchanged program. Change the mask in simulation/paced_counter.s so SW2–0 sets the outer-loop count. Leave the 512 inner iterations unchanged. Assemble the edit, regenerate the HDL and run the same bench again. Which period changed?
Verilog
iverilog -g2005 -s test_paced -o bench my_paced_cpu.v simulation/test_paced.v
vvp bench
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Use the regenerated HDL that passed the simulation. Keep paced_cpu as the top-level name.
- From the extracted worksheet folder, open
starter/paced_cpu.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
paced_cpu. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/paced_cpu.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Time the physical counter
With SW9 down, set SW2–0 to 000 and wait two seconds for the switches to settle, then pulse KEY0 once. Raise SW9. Note the binary count and time at two readings several seconds apart. Lower SW9 and confirm the count holds. Repeat from reset with SW2–0 at 111, allowing at least nine seconds for the slower run.
| SW2–0 | First count and time | Last count and time | Seconds per increment |
|---|---|---|---|
| 000 | |||
| 111 |
Read LED0 as the least significant bit. The camera can skip intermediate counts. Use two clearly readable values after the count starts moving. If the count is the same at both readings, keep timing until it changes. Divide elapsed time by the change in count. Compare the measured ratio with your prediction, allowing for the camera refresh. Which instructions run only once per displayed count?
Based on FPGAcademy Digital Logic Lab 10. Verilog handout · VHDL handout · MIT license
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Make the ten red LEDs count in binary. The starter counts, but adjusting SW2–0 does nothing to its speed. You'll repair the assembly program, build it into the processor in your chosen HDL and measure the result on a physical DE1-SoC. On your computer, use Python 3 to assemble the program and NVC (VHDL) or Icarus Verilog (Verilog and SystemVerilog) to check its timing before you open the lab.
Predict the period
In paced_counter.s, mark the two backwards branches. The inner loop starts with r1 = 0x0200. Count the instructions spent in one inner iteration. Find where the outer loop gets its count and explain how you would avoid a zero starting count. The processor starts one instruction every 16,384 board clocks at 50 MHz. Estimate the period with one outer pass and with eight.
Assemble the starter
Download and extract the activity ZIP. From the folder containing activity.md, assemble the unchanged program and load it into the starter for your selected HDL.
If the assembler reports an error, correct the indicated line and assemble again before loading the memory image. A failed build leaves any previous .mif in place.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
VHDL
python3 simulation/sbasm.py simulation/paced_counter.s paced.mif
python3 simulation/load_program.py paced.mif starter/paced_cpu.vhd --output my_paced_cpu.vhd
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md. The simulator reads the HDL file you generated in the assembly step.
The bench starts an instruction every eight simulated clock cycles, so you can test the same assembly loops more quickly. It measures the periods at 000 and 111, then checks the six settings in between. With SW9 down, the count must hold for two full fast-count periods. The final check resets the counter.
Record the two periods reported for the unchanged program. Change the mask in simulation/paced_counter.s so SW2–0 sets the outer-loop count. Leave the 512 inner iterations unchanged. Assemble the edit, regenerate the HDL and run the same bench again. Which period changed?
VHDL
nvc --std=2008 -a my_paced_cpu.vhd simulation/test_paced.vhd
nvc --std=2008 -e test_paced
nvc --std=2008 -r test_paced
Build
Use the regenerated HDL that passed the simulation. Keep paced_cpu as the top-level name.
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
paced_cpu, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Time the physical counter
With SW9 down, set SW2–0 to 000 and wait two seconds for the switches to settle, then pulse KEY0 once. Raise SW9. Note the binary count and time at two readings several seconds apart. Lower SW9 and confirm the count holds. Repeat from reset with SW2–0 at 111, allowing at least nine seconds for the slower run.
| SW2–0 | First count and time | Last count and time | Seconds per increment |
|---|---|---|---|
| 000 | |||
| 111 |
Read LED0 as the least significant bit. The camera can skip intermediate counts. Use two clearly readable values after the count starts moving. If the count is the same at both readings, keep timing until it changes. Divide elapsed time by the change in count. Compare the measured ratio with your prediction, allowing for the camera refresh. Which instructions run only once per displayed count?
Based on FPGAcademy Digital Logic Lab 10. Verilog handout · VHDL handout · MIT license
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Make the ten red LEDs count in binary. The starter counts, but adjusting SW2–0 does nothing to its speed. You'll repair the assembly program, build it into the processor in your chosen HDL and measure the result on a physical DE1-SoC. On your computer, use Python 3 to assemble the program and NVC (VHDL) or Icarus Verilog (Verilog and SystemVerilog) to check its timing before you open the lab.
Predict the period
In paced_counter.s, mark the two backwards branches. The inner loop starts with r1 = 0x0200. Count the instructions spent in one inner iteration. Find where the outer loop gets its count and explain how you would avoid a zero starting count. The processor starts one instruction every 16,384 board clocks at 50 MHz. Estimate the period with one outer pass and with eight.
Assemble the starter
Download and extract the activity ZIP. From the folder containing activity.md, assemble the unchanged program and load it into the starter for your selected HDL.
If the assembler reports an error, correct the indicated line and assemble again before loading the memory image. A failed build leaves any previous .mif in place.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
VHDL
python3 simulation/sbasm.py simulation/paced_counter.s paced.mif
python3 simulation/load_program.py paced.mif starter/paced_cpu.vhd --output my_paced_cpu.vhd
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md. The simulator reads the HDL file you generated in the assembly step.
The bench starts an instruction every eight simulated clock cycles, so you can test the same assembly loops more quickly. It measures the periods at 000 and 111, then checks the six settings in between. With SW9 down, the count must hold for two full fast-count periods. The final check resets the counter.
Record the two periods reported for the unchanged program. Change the mask in simulation/paced_counter.s so SW2–0 sets the outer-loop count. Leave the 512 inner iterations unchanged. Assemble the edit, regenerate the HDL and run the same bench again. Which period changed?
VHDL
nvc --std=2008 -a my_paced_cpu.vhd simulation/test_paced.vhd
nvc --std=2008 -e test_paced
nvc --std=2008 -r test_paced
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Use the regenerated HDL that passed the simulation. Keep paced_cpu as the top-level name.
- From the extracted worksheet folder, open
starter/paced_cpu.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
paced_cpu. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/paced_cpu.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Time the physical counter
With SW9 down, set SW2–0 to 000 and wait two seconds for the switches to settle, then pulse KEY0 once. Raise SW9. Note the binary count and time at two readings several seconds apart. Lower SW9 and confirm the count holds. Repeat from reset with SW2–0 at 111, allowing at least nine seconds for the slower run.
| SW2–0 | First count and time | Last count and time | Seconds per increment |
|---|---|---|---|
| 000 | |||
| 111 |
Read LED0 as the least significant bit. The camera can skip intermediate counts. Use two clearly readable values after the count starts moving. If the count is the same at both readings, keep timing until it changes. Divide elapsed time by the change in count. Compare the measured ratio with your prediction, allowing for the camera refresh. Which instructions run only once per displayed count?
Based on FPGAcademy Digital Logic Lab 10. Verilog handout · VHDL handout · MIT license
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Make the ten red LEDs count in binary. The starter counts, but adjusting SW2–0 does nothing to its speed. You'll repair the assembly program, build it into the processor in your chosen HDL and measure the result on a physical DE1-SoC. On your computer, use Python 3 to assemble the program and NVC (VHDL) or Icarus Verilog (Verilog and SystemVerilog) to check its timing before you open the lab.
Predict the period
In paced_counter.s, mark the two backwards branches. The inner loop starts with r1 = 0x0200. Count the instructions spent in one inner iteration. Find where the outer loop gets its count and explain how you would avoid a zero starting count. The processor starts one instruction every 16,384 board clocks at 50 MHz. Estimate the period with one outer pass and with eight.
Assemble the starter
Download and extract the activity ZIP. From the folder containing activity.md, assemble the unchanged program and load it into the starter for your selected HDL.
If the assembler reports an error, correct the indicated line and assemble again before loading the memory image. A failed build leaves any previous .mif in place.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
SystemVerilog
python3 simulation/sbasm.py simulation/paced_counter.s paced.mif
python3 simulation/load_program.py paced.mif starter/paced_cpu.sv --output my_paced_cpu.sv
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md. The simulator reads the HDL file you generated in the assembly step.
The bench starts an instruction every eight simulated clock cycles, so you can test the same assembly loops more quickly. It measures the periods at 000 and 111, then checks the six settings in between. With SW9 down, the count must hold for two full fast-count periods. The final check resets the counter.
Record the two periods reported for the unchanged program. Change the mask in simulation/paced_counter.s so SW2–0 sets the outer-loop count. Leave the 512 inner iterations unchanged. Assemble the edit, regenerate the HDL and run the same bench again. Which period changed?
SystemVerilog
iverilog -g2012 -s test_paced -o bench my_paced_cpu.sv simulation/test_paced.v
vvp bench
Build
Use the regenerated HDL that passed the simulation. Keep paced_cpu as the top-level name.
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
paced_cpu, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Time the physical counter
With SW9 down, set SW2–0 to 000 and wait two seconds for the switches to settle, then pulse KEY0 once. Raise SW9. Note the binary count and time at two readings several seconds apart. Lower SW9 and confirm the count holds. Repeat from reset with SW2–0 at 111, allowing at least nine seconds for the slower run.
| SW2–0 | First count and time | Last count and time | Seconds per increment |
|---|---|---|---|
| 000 | |||
| 111 |
Read LED0 as the least significant bit. The camera can skip intermediate counts. Use two clearly readable values after the count starts moving. If the count is the same at both readings, keep timing until it changes. Divide elapsed time by the change in count. Compare the measured ratio with your prediction, allowing for the camera refresh. Which instructions run only once per displayed count?
Based on FPGAcademy Digital Logic Lab 10. Verilog handout · VHDL handout · MIT license
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Make the ten red LEDs count in binary. The starter counts, but adjusting SW2–0 does nothing to its speed. You'll repair the assembly program, build it into the processor in your chosen HDL and measure the result on a physical DE1-SoC. On your computer, use Python 3 to assemble the program and NVC (VHDL) or Icarus Verilog (Verilog and SystemVerilog) to check its timing before you open the lab.
Predict the period
In paced_counter.s, mark the two backwards branches. The inner loop starts with r1 = 0x0200. Count the instructions spent in one inner iteration. Find where the outer loop gets its count and explain how you would avoid a zero starting count. The processor starts one instruction every 16,384 board clocks at 50 MHz. Estimate the period with one outer pass and with eight.
Assemble the starter
Download and extract the activity ZIP. From the folder containing activity.md, assemble the unchanged program and load it into the starter for your selected HDL.
If the assembler reports an error, correct the indicated line and assemble again before loading the memory image. A failed build leaves any previous .mif in place.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
SystemVerilog
python3 simulation/sbasm.py simulation/paced_counter.s paced.mif
python3 simulation/load_program.py paced.mif starter/paced_cpu.sv --output my_paced_cpu.sv
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md. The simulator reads the HDL file you generated in the assembly step.
The bench starts an instruction every eight simulated clock cycles, so you can test the same assembly loops more quickly. It measures the periods at 000 and 111, then checks the six settings in between. With SW9 down, the count must hold for two full fast-count periods. The final check resets the counter.
Record the two periods reported for the unchanged program. Change the mask in simulation/paced_counter.s so SW2–0 sets the outer-loop count. Leave the 512 inner iterations unchanged. Assemble the edit, regenerate the HDL and run the same bench again. Which period changed?
SystemVerilog
iverilog -g2012 -s test_paced -o bench my_paced_cpu.sv simulation/test_paced.v
vvp bench
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Use the regenerated HDL that passed the simulation. Keep paced_cpu as the top-level name.
- From the extracted worksheet folder, open
starter/paced_cpu.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
paced_cpu. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/paced_cpu.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Time the physical counter
With SW9 down, set SW2–0 to 000 and wait two seconds for the switches to settle, then pulse KEY0 once. Raise SW9. Note the binary count and time at two readings several seconds apart. Lower SW9 and confirm the count holds. Repeat from reset with SW2–0 at 111, allowing at least nine seconds for the slower run.
| SW2–0 | First count and time | Last count and time | Seconds per increment |
|---|---|---|---|
| 000 | |||
| 111 |
Read LED0 as the least significant bit. The camera can skip intermediate counts. Use two clearly readable values after the count starts moving. If the count is the same at both readings, keep timing until it changes. Divide elapsed time by the change in count. Compare the measured ratio with your prediction, allowing for the camera refresh. Which instructions run only once per displayed count?
Based on FPGAcademy Digital Logic Lab 10. Verilog handout · VHDL handout · MIT license
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Your processor counts in binary. Turn its value into five decimal digits and display them on HEX4–0. HEX5 stays blank. This time the starter appears to work at small values, so choose a test that can expose its mistake. You'll use Python 3 to assemble your program and your selected tool to build for the FPGA.
Predict a boundary
Before starting the processor, SW4–3 selects a test value. The settings 00, 01, 10 and 11 start at 0, 9, 99 and 65534 respectively. SW2–0 sets the delay as in Part VI. What five digits should appear after 65535? Why does a test beginning at 9 provide incomplete evidence for a 16-bit counter?
Assemble the starter
Choose Download activity and files in the setup panel. Extract the ZIP and open the folder containing activity.md. It includes the assembler, the simulation and the starter for your selected HDL.
Read decimal_counter.s. The program keeps the counter in r0. Trace how it copies that value, counts powers of ten and restores the remainder after a subtraction borrows. Run these commands on the unchanged program first.
If the assembler reports an error, correct the indicated line and assemble again before loading the memory image. A failed build leaves any previous .mif in place.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
Verilog
python3 simulation/sbasm.py simulation/decimal_counter.s decimal.mif
python3 simulation/load_program.py decimal.mif starter/decimal_cpu.v --output my_decimal_cpu.v
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md. The simulator reads the HDL file you generated in the build step.
The accelerated bench reads the six external pin patterns and tests starts at 0, 9, 99 and 65534. It checks decimal carries, 16-bit rollover and the relative pacing.
Run the bench once before editing the assembly. It reads the digits as soon as the program finishes writing HEX0. If the first five-digit reading differs from the selected start, write both values in hexadecimal. Which bits survived the conversion? Reassemble, regenerate the HDL and run the same bench after your edit.
Verilog
iverilog -g2005 -s test_decimal -o bench my_decimal_cpu.v simulation/test_decimal.v
vvp bench
Build
Use the HDL file you regenerated after the simulation passed. Keep the top-level name decimal_cpu.
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
decimal_cpu, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Observe the carries
Lower SW9. Set SW4–3 for the starting value and use SW2–0 = 111 to make the digits easy to read. Wait two seconds for the switches to settle. Pulse KEY0 once, then raise SW9. Record two successive stable readings. Repeat from reset for each row.
| Start selection | Before the carry | After the carry |
|---|---|---|
| 01 | ||
| 10 | ||
| 11, first increment | ||
| 11, second increment |
Test two delay settings from the same starting value. Explain which operations change the speed and which change the representation. Submit the changed instruction, the camera readings and a short trace of the division into decimal places for 100.
Based on FPGAcademy Digital Logic Lab 10. Verilog handout · VHDL handout · MIT license
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Your processor counts in binary. Turn its value into five decimal digits and display them on HEX4–0. HEX5 stays blank. This time the starter appears to work at small values, so choose a test that can expose its mistake. You'll use Python 3 to assemble your program and your selected tool to build for the FPGA.
Predict a boundary
Before starting the processor, SW4–3 selects a test value. The settings 00, 01, 10 and 11 start at 0, 9, 99 and 65534 respectively. SW2–0 sets the delay as in Part VI. What five digits should appear after 65535? Why does a test beginning at 9 provide incomplete evidence for a 16-bit counter?
Assemble the starter
Choose Download activity and files in the setup panel. Extract the ZIP and open the folder containing activity.md. It includes the assembler, the simulation and the starter for your selected HDL.
Read decimal_counter.s. The program keeps the counter in r0. Trace how it copies that value, counts powers of ten and restores the remainder after a subtraction borrows. Run these commands on the unchanged program first.
If the assembler reports an error, correct the indicated line and assemble again before loading the memory image. A failed build leaves any previous .mif in place.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
Verilog
python3 simulation/sbasm.py simulation/decimal_counter.s decimal.mif
python3 simulation/load_program.py decimal.mif starter/decimal_cpu.v --output my_decimal_cpu.v
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md. The simulator reads the HDL file you generated in the build step.
The accelerated bench reads the six external pin patterns and tests starts at 0, 9, 99 and 65534. It checks decimal carries, 16-bit rollover and the relative pacing.
Run the bench once before editing the assembly. It reads the digits as soon as the program finishes writing HEX0. If the first five-digit reading differs from the selected start, write both values in hexadecimal. Which bits survived the conversion? Reassemble, regenerate the HDL and run the same bench after your edit.
Verilog
iverilog -g2005 -s test_decimal -o bench my_decimal_cpu.v simulation/test_decimal.v
vvp bench
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Use the HDL file you regenerated after the simulation passed. Keep the top-level name decimal_cpu.
- From the extracted worksheet folder, open
starter/decimal_cpu.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
decimal_cpu. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/decimal_cpu.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Observe the carries
Lower SW9. Set SW4–3 for the starting value and use SW2–0 = 111 to make the digits easy to read. Wait two seconds for the switches to settle. Pulse KEY0 once, then raise SW9. Record two successive stable readings. Repeat from reset for each row.
| Start selection | Before the carry | After the carry |
|---|---|---|
| 01 | ||
| 10 | ||
| 11, first increment | ||
| 11, second increment |
Test two delay settings from the same starting value. Explain which operations change the speed and which change the representation. Submit the changed instruction, the camera readings and a short trace of the division into decimal places for 100.
Based on FPGAcademy Digital Logic Lab 10. Verilog handout · VHDL handout · MIT license
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Your processor counts in binary. Turn its value into five decimal digits and display them on HEX4–0. HEX5 stays blank. This time the starter appears to work at small values, so choose a test that can expose its mistake. You'll use Python 3 to assemble your program and your selected tool to build for the FPGA.
Predict a boundary
Before starting the processor, SW4–3 selects a test value. The settings 00, 01, 10 and 11 start at 0, 9, 99 and 65534 respectively. SW2–0 sets the delay as in Part VI. What five digits should appear after 65535? Why does a test beginning at 9 provide incomplete evidence for a 16-bit counter?
Assemble the starter
Choose Download activity and files in the setup panel. Extract the ZIP and open the folder containing activity.md. It includes the assembler, the simulation and the starter for your selected HDL.
Read decimal_counter.s. The program keeps the counter in r0. Trace how it copies that value, counts powers of ten and restores the remainder after a subtraction borrows. Run these commands on the unchanged program first.
If the assembler reports an error, correct the indicated line and assemble again before loading the memory image. A failed build leaves any previous .mif in place.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
VHDL
python3 simulation/sbasm.py simulation/decimal_counter.s decimal.mif
python3 simulation/load_program.py decimal.mif starter/decimal_cpu.vhd --output my_decimal_cpu.vhd
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md. The simulator reads the HDL file you generated in the build step.
The accelerated bench reads the six external pin patterns and tests starts at 0, 9, 99 and 65534. It checks decimal carries, 16-bit rollover and the relative pacing.
Run the bench once before editing the assembly. It reads the digits as soon as the program finishes writing HEX0. If the first five-digit reading differs from the selected start, write both values in hexadecimal. Which bits survived the conversion? Reassemble, regenerate the HDL and run the same bench after your edit.
VHDL
nvc --std=2008 -a my_decimal_cpu.vhd simulation/test_decimal.vhd
nvc --std=2008 -e test_decimal
nvc --std=2008 -r test_decimal
Build
Use the HDL file you regenerated after the simulation passed. Keep the top-level name decimal_cpu.
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
decimal_cpu, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Observe the carries
Lower SW9. Set SW4–3 for the starting value and use SW2–0 = 111 to make the digits easy to read. Wait two seconds for the switches to settle. Pulse KEY0 once, then raise SW9. Record two successive stable readings. Repeat from reset for each row.
| Start selection | Before the carry | After the carry |
|---|---|---|
| 01 | ||
| 10 | ||
| 11, first increment | ||
| 11, second increment |
Test two delay settings from the same starting value. Explain which operations change the speed and which change the representation. Submit the changed instruction, the camera readings and a short trace of the division into decimal places for 100.
Based on FPGAcademy Digital Logic Lab 10. Verilog handout · VHDL handout · MIT license
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Your processor counts in binary. Turn its value into five decimal digits and display them on HEX4–0. HEX5 stays blank. This time the starter appears to work at small values, so choose a test that can expose its mistake. You'll use Python 3 to assemble your program and your selected tool to build for the FPGA.
Predict a boundary
Before starting the processor, SW4–3 selects a test value. The settings 00, 01, 10 and 11 start at 0, 9, 99 and 65534 respectively. SW2–0 sets the delay as in Part VI. What five digits should appear after 65535? Why does a test beginning at 9 provide incomplete evidence for a 16-bit counter?
Assemble the starter
Choose Download activity and files in the setup panel. Extract the ZIP and open the folder containing activity.md. It includes the assembler, the simulation and the starter for your selected HDL.
Read decimal_counter.s. The program keeps the counter in r0. Trace how it copies that value, counts powers of ten and restores the remainder after a subtraction borrows. Run these commands on the unchanged program first.
If the assembler reports an error, correct the indicated line and assemble again before loading the memory image. A failed build leaves any previous .mif in place.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
VHDL
python3 simulation/sbasm.py simulation/decimal_counter.s decimal.mif
python3 simulation/load_program.py decimal.mif starter/decimal_cpu.vhd --output my_decimal_cpu.vhd
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md. The simulator reads the HDL file you generated in the build step.
The accelerated bench reads the six external pin patterns and tests starts at 0, 9, 99 and 65534. It checks decimal carries, 16-bit rollover and the relative pacing.
Run the bench once before editing the assembly. It reads the digits as soon as the program finishes writing HEX0. If the first five-digit reading differs from the selected start, write both values in hexadecimal. Which bits survived the conversion? Reassemble, regenerate the HDL and run the same bench after your edit.
VHDL
nvc --std=2008 -a my_decimal_cpu.vhd simulation/test_decimal.vhd
nvc --std=2008 -e test_decimal
nvc --std=2008 -r test_decimal
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Use the HDL file you regenerated after the simulation passed. Keep the top-level name decimal_cpu.
- From the extracted worksheet folder, open
starter/decimal_cpu.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
decimal_cpu. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/decimal_cpu.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Observe the carries
Lower SW9. Set SW4–3 for the starting value and use SW2–0 = 111 to make the digits easy to read. Wait two seconds for the switches to settle. Pulse KEY0 once, then raise SW9. Record two successive stable readings. Repeat from reset for each row.
| Start selection | Before the carry | After the carry |
|---|---|---|
| 01 | ||
| 10 | ||
| 11, first increment | ||
| 11, second increment |
Test two delay settings from the same starting value. Explain which operations change the speed and which change the representation. Submit the changed instruction, the camera readings and a short trace of the division into decimal places for 100.
Based on FPGAcademy Digital Logic Lab 10. Verilog handout · VHDL handout · MIT license
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Your processor counts in binary. Turn its value into five decimal digits and display them on HEX4–0. HEX5 stays blank. This time the starter appears to work at small values, so choose a test that can expose its mistake. You'll use Python 3 to assemble your program and your selected tool to build for the FPGA.
Predict a boundary
Before starting the processor, SW4–3 selects a test value. The settings 00, 01, 10 and 11 start at 0, 9, 99 and 65534 respectively. SW2–0 sets the delay as in Part VI. What five digits should appear after 65535? Why does a test beginning at 9 provide incomplete evidence for a 16-bit counter?
Assemble the starter
Choose Download activity and files in the setup panel. Extract the ZIP and open the folder containing activity.md. It includes the assembler, the simulation and the starter for your selected HDL.
Read decimal_counter.s. The program keeps the counter in r0. Trace how it copies that value, counts powers of ten and restores the remainder after a subtraction borrows. Run these commands on the unchanged program first.
If the assembler reports an error, correct the indicated line and assemble again before loading the memory image. A failed build leaves any previous .mif in place.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
SystemVerilog
python3 simulation/sbasm.py simulation/decimal_counter.s decimal.mif
python3 simulation/load_program.py decimal.mif starter/decimal_cpu.sv --output my_decimal_cpu.sv
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md. The simulator reads the HDL file you generated in the build step.
The accelerated bench reads the six external pin patterns and tests starts at 0, 9, 99 and 65534. It checks decimal carries, 16-bit rollover and the relative pacing.
Run the bench once before editing the assembly. It reads the digits as soon as the program finishes writing HEX0. If the first five-digit reading differs from the selected start, write both values in hexadecimal. Which bits survived the conversion? Reassemble, regenerate the HDL and run the same bench after your edit.
SystemVerilog
iverilog -g2012 -s test_decimal -o bench my_decimal_cpu.sv simulation/test_decimal.v
vvp bench
Build
Use the HDL file you regenerated after the simulation passed. Keep the top-level name decimal_cpu.
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
decimal_cpu, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Observe the carries
Lower SW9. Set SW4–3 for the starting value and use SW2–0 = 111 to make the digits easy to read. Wait two seconds for the switches to settle. Pulse KEY0 once, then raise SW9. Record two successive stable readings. Repeat from reset for each row.
| Start selection | Before the carry | After the carry |
|---|---|---|
| 01 | ||
| 10 | ||
| 11, first increment | ||
| 11, second increment |
Test two delay settings from the same starting value. Explain which operations change the speed and which change the representation. Submit the changed instruction, the camera readings and a short trace of the division into decimal places for 100.
Based on FPGAcademy Digital Logic Lab 10. Verilog handout · VHDL handout · MIT license
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Your processor counts in binary. Turn its value into five decimal digits and display them on HEX4–0. HEX5 stays blank. This time the starter appears to work at small values, so choose a test that can expose its mistake. You'll use Python 3 to assemble your program and your selected tool to build for the FPGA.
Predict a boundary
Before starting the processor, SW4–3 selects a test value. The settings 00, 01, 10 and 11 start at 0, 9, 99 and 65534 respectively. SW2–0 sets the delay as in Part VI. What five digits should appear after 65535? Why does a test beginning at 9 provide incomplete evidence for a 16-bit counter?
Assemble the starter
Choose Download activity and files in the setup panel. Extract the ZIP and open the folder containing activity.md. It includes the assembler, the simulation and the starter for your selected HDL.
Read decimal_counter.s. The program keeps the counter in r0. Trace how it copies that value, counts powers of ten and restores the remainder after a subtraction borrows. Run these commands on the unchanged program first.
If the assembler reports an error, correct the indicated line and assemble again before loading the memory image. A failed build leaves any previous .mif in place.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
SystemVerilog
python3 simulation/sbasm.py simulation/decimal_counter.s decimal.mif
python3 simulation/load_program.py decimal.mif starter/decimal_cpu.sv --output my_decimal_cpu.sv
Simulate
Extract the worksheet ZIP and run these commands from the folder containing activity.md. The simulator reads the HDL file you generated in the build step.
The accelerated bench reads the six external pin patterns and tests starts at 0, 9, 99 and 65534. It checks decimal carries, 16-bit rollover and the relative pacing.
Run the bench once before editing the assembly. It reads the digits as soon as the program finishes writing HEX0. If the first five-digit reading differs from the selected start, write both values in hexadecimal. Which bits survived the conversion? Reassemble, regenerate the HDL and run the same bench after your edit.
SystemVerilog
iverilog -g2012 -s test_decimal -o bench my_decimal_cpu.sv simulation/test_decimal.v
vvp bench
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
Use the HDL file you regenerated after the simulation passed. Keep the top-level name decimal_cpu.
- From the extracted worksheet folder, open
starter/decimal_cpu.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
decimal_cpu. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/decimal_cpu.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Observe the carries
Lower SW9. Set SW4–3 for the starting value and use SW2–0 = 111 to make the digits easy to read. Wait two seconds for the switches to settle. Pulse KEY0 once, then raise SW9. Record two successive stable readings. Repeat from reset for each row.
| Start selection | Before the carry | After the carry |
|---|---|---|
| 01 | ||
| 10 | ||
| 11, first increment | ||
| 11, second increment |
Test two delay settings from the same starting value. Explain which operations change the speed and which change the representation. Submit the changed instruction, the camera readings and a short trace of the division into decimal places for 100.
Based on FPGAcademy Digital Logic Lab 10. Verilog handout · VHDL handout · MIT license
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Make a 16-bit processor call a subroutine from inside another subroutine. Then use your processor to compare four ways of shifting a negative number. You will need the branch and memory-port concepts from Lab 10, a computer with Python 3 and access to the LabsLand DE1-SoC.
Trace the stack
Open the assembly program. The program starts its stack pointer at 0x1000. RAM occupies word addresses 0x0000–0x0FFF. The first push must decrement the stack pointer before writing. Predict the first two addresses written by transform. In render, find the call that would destroy its return address unless the caller saved it. Follow the return through both subroutines.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
stack_cpu, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Repair the shifter
The starter has a fault in one shift operation. Build and upload the starter unchanged first. Lower SW9, pulse KEY0, then raise SW9. SW6–5 selects logical left, logical right, arithmetic right or rotate right in that order. SW3–0 sets the amount. Leave SW4 down. The red LEDs echo the low control bits. Read HEX3–0 as one hexadecimal word.
| SW6–5 | Amount | Predicted from 0x9010 | Starter | After repair |
|---|---|---|---|---|
| 00 | 1 | |||
| 01 | 1 | |||
| 10 | 1 | |||
| 10 | 4 | |||
| 11 | 5 |
For which pair of rows does the starter give the same answer unexpectedly? Track bit 15 through the shifter. Correct the HDL, run the bench and upload the new design. Repeat both arithmetic-right rows. Compare the high bits with the logical-right result. Each switch setting starts from the same 0x9010 seed.
Simulate
Run these commands from the extracted worksheet folder. First try the supplied HDL, then repeat after editing the shifter in the starter file. The bench tests all 64 mode and amount pairs on a running processor with nested calls. It reports the first mismatch. For the arithmetic right shift, compare the new high bit with the original sign.
Verilog
iverilog -g2005 -s test_stack -o bench starter/stack_cpu.v simulation/test_stack.v
vvp bench
Run two diagnostic programs
Stack and shift checks uses a descending stack, saves 0x0F0F across a call and checks that the stack pointer returns to 0x1000. It also checks the carry from a left shift. The program leaves 0x055 on the LEDs on success and 0x00F on failure. Cumulative shifts applies each transformation to the previous result. Reset between modes. The first display is 9010. With a one-bit shift, predict its next value. Run this version in simulation, where you can step through the rapid display changes.
Save your shifter repair in the HDL file under starter/. From the extracted worksheet folder, assemble both programs and insert each one into its own copy of the processor.
If the assembler reports an error, correct the indicated line and assemble again before loading the memory image. A failed build leaves any previous .mif in place.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
Verilog
python3 simulation/sbasm.py simulation/stack_checks.s stack_checks.mif
python3 simulation/load_program.py stack_checks.mif starter/stack_cpu.v --output stack_checks_cpu.v
python3 simulation/sbasm.py simulation/cumulative_shifts.s cumulative_shifts.mif
python3 simulation/load_program.py cumulative_shifts.mif starter/stack_cpu.v --output cumulative_shifts_cpu.v
Run the program testbench with each processor. The first run checks the stack and carry. The second selects arithmetic right shift (mode 2). The bench prints the initial word and five successive one-bit shifts. Before you run modes 1 and 3, predict the first step at which their displays will differ. Run each mode from reset, compare the two traces and identify which bit moved into bit 15. Use mode 0 to check the left shift.
Verilog
iverilog -g2005 -s test_program -o check stack_checks_cpu.v simulation/test_program.v
vvp check
iverilog -g2005 -s test_program -o check cumulative_shifts_cpu.v simulation/test_program.v
vvp check +MODE=2
Design your own assembly program
Choose a switch-controlled transformation and write a program to display its result. Use a nested call, preserve the return address and at least one working register on the stack, and leave an observable result on both the LEDs and the displays. Save a copy of simulation/shift_panel.s as my_program.s in the extracted worksheet folder and edit that copy. Assemble your work and insert the image into your repaired HDL.
Verilog
python3 simulation/sbasm.py my_program.s custom.mif
python3 simulation/load_program.py custom.mif starter/stack_cpu.v --output my_stack_cpu.v
Keep a copy of the repaired processor. Copy the generated HDL from the last command into the original project source file. Keep its original filename, compile it and upload it using the same workflow. Reset the board before testing your two inputs. Submit your assembly, a stack trace showing two return addresses, and two predicted and observed board readings for inputs of your choice. Explain how either observation could reveal an incorrect return.
Based on FPGAcademy Digital Logic Lab 11, Part VIII. Verilog handout · VHDL handout · MIT license
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Make a 16-bit processor call a subroutine from inside another subroutine. Then use your processor to compare four ways of shifting a negative number. You will need the branch and memory-port concepts from Lab 10, a computer with Python 3 and access to the LabsLand DE1-SoC.
Trace the stack
Open the assembly program. The program starts its stack pointer at 0x1000. RAM occupies word addresses 0x0000–0x0FFF. The first push must decrement the stack pointer before writing. Predict the first two addresses written by transform. In render, find the call that would destroy its return address unless the caller saved it. Follow the return through both subroutines.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/stack_cpu.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
stack_cpu. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/stack_cpu.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Repair the shifter
The starter has a fault in one shift operation. Build and upload the starter unchanged first. Lower SW9, pulse KEY0, then raise SW9. SW6–5 selects logical left, logical right, arithmetic right or rotate right in that order. SW3–0 sets the amount. Leave SW4 down. The red LEDs echo the low control bits. Read HEX3–0 as one hexadecimal word.
| SW6–5 | Amount | Predicted from 0x9010 | Starter | After repair |
|---|---|---|---|---|
| 00 | 1 | |||
| 01 | 1 | |||
| 10 | 1 | |||
| 10 | 4 | |||
| 11 | 5 |
For which pair of rows does the starter give the same answer unexpectedly? Track bit 15 through the shifter. Correct the HDL, run the bench and upload the new design. Repeat both arithmetic-right rows. Compare the high bits with the logical-right result. Each switch setting starts from the same 0x9010 seed.
Simulate
Run these commands from the extracted worksheet folder. First try the supplied HDL, then repeat after editing the shifter in the starter file. The bench tests all 64 mode and amount pairs on a running processor with nested calls. It reports the first mismatch. For the arithmetic right shift, compare the new high bit with the original sign.
Verilog
iverilog -g2005 -s test_stack -o bench starter/stack_cpu.v simulation/test_stack.v
vvp bench
Run two diagnostic programs
Stack and shift checks uses a descending stack, saves 0x0F0F across a call and checks that the stack pointer returns to 0x1000. It also checks the carry from a left shift. The program leaves 0x055 on the LEDs on success and 0x00F on failure. Cumulative shifts applies each transformation to the previous result. Reset between modes. The first display is 9010. With a one-bit shift, predict its next value. Run this version in simulation, where you can step through the rapid display changes.
Save your shifter repair in the HDL file under starter/. From the extracted worksheet folder, assemble both programs and insert each one into its own copy of the processor.
If the assembler reports an error, correct the indicated line and assemble again before loading the memory image. A failed build leaves any previous .mif in place.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
Verilog
python3 simulation/sbasm.py simulation/stack_checks.s stack_checks.mif
python3 simulation/load_program.py stack_checks.mif starter/stack_cpu.v --output stack_checks_cpu.v
python3 simulation/sbasm.py simulation/cumulative_shifts.s cumulative_shifts.mif
python3 simulation/load_program.py cumulative_shifts.mif starter/stack_cpu.v --output cumulative_shifts_cpu.v
Run the program testbench with each processor. The first run checks the stack and carry. The second selects arithmetic right shift (mode 2). The bench prints the initial word and five successive one-bit shifts. Before you run modes 1 and 3, predict the first step at which their displays will differ. Run each mode from reset, compare the two traces and identify which bit moved into bit 15. Use mode 0 to check the left shift.
Verilog
iverilog -g2005 -s test_program -o check stack_checks_cpu.v simulation/test_program.v
vvp check
iverilog -g2005 -s test_program -o check cumulative_shifts_cpu.v simulation/test_program.v
vvp check +MODE=2
Design your own assembly program
Choose a switch-controlled transformation and write a program to display its result. Use a nested call, preserve the return address and at least one working register on the stack, and leave an observable result on both the LEDs and the displays. Save a copy of simulation/shift_panel.s as my_program.s in the extracted worksheet folder and edit that copy. Assemble your work and insert the image into your repaired HDL.
Verilog
python3 simulation/sbasm.py my_program.s custom.mif
python3 simulation/load_program.py custom.mif starter/stack_cpu.v --output my_stack_cpu.v
Keep a copy of the repaired processor. Copy the generated HDL from the last command into the original project source file. Keep its original filename, compile it and upload it using the same workflow. Reset the board before testing your two inputs. Submit your assembly, a stack trace showing two return addresses, and two predicted and observed board readings for inputs of your choice. Explain how either observation could reveal an incorrect return.
Based on FPGAcademy Digital Logic Lab 11, Part VIII. Verilog handout · VHDL handout · MIT license
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Make a 16-bit processor call a subroutine from inside another subroutine. Then use your processor to compare four ways of shifting a negative number. You will need the branch and memory-port concepts from Lab 10, a computer with Python 3 and access to the LabsLand DE1-SoC.
Trace the stack
Open the assembly program. The program starts its stack pointer at 0x1000. RAM occupies word addresses 0x0000–0x0FFF. The first push must decrement the stack pointer before writing. Predict the first two addresses written by transform. In render, find the call that would destroy its return address unless the caller saved it. Follow the return through both subroutines.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
stack_cpu, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Repair the shifter
The starter has a fault in one shift operation. Build and upload the starter unchanged first. Lower SW9, pulse KEY0, then raise SW9. SW6–5 selects logical left, logical right, arithmetic right or rotate right in that order. SW3–0 sets the amount. Leave SW4 down. The red LEDs echo the low control bits. Read HEX3–0 as one hexadecimal word.
| SW6–5 | Amount | Predicted from 0x9010 | Starter | After repair |
|---|---|---|---|---|
| 00 | 1 | |||
| 01 | 1 | |||
| 10 | 1 | |||
| 10 | 4 | |||
| 11 | 5 |
For which pair of rows does the starter give the same answer unexpectedly? Track bit 15 through the shifter. Correct the HDL, run the bench and upload the new design. Repeat both arithmetic-right rows. Compare the high bits with the logical-right result. Each switch setting starts from the same 0x9010 seed.
Simulate
Run these commands from the extracted worksheet folder. First try the supplied HDL, then repeat after editing the shifter in the starter file. The bench tests all 64 mode and amount pairs on a running processor with nested calls. It reports the first mismatch. For the arithmetic right shift, compare the new high bit with the original sign.
VHDL
nvc --std=2008 -a starter/stack_cpu.vhd simulation/test_stack.vhd
nvc --std=2008 -e test_stack
nvc --std=2008 -r test_stack
Run two diagnostic programs
Stack and shift checks uses a descending stack, saves 0x0F0F across a call and checks that the stack pointer returns to 0x1000. It also checks the carry from a left shift. The program leaves 0x055 on the LEDs on success and 0x00F on failure. Cumulative shifts applies each transformation to the previous result. Reset between modes. The first display is 9010. With a one-bit shift, predict its next value. Run this version in simulation, where you can step through the rapid display changes.
Save your shifter repair in the HDL file under starter/. From the extracted worksheet folder, assemble both programs and insert each one into its own copy of the processor.
If the assembler reports an error, correct the indicated line and assemble again before loading the memory image. A failed build leaves any previous .mif in place.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
VHDL
python3 simulation/sbasm.py simulation/stack_checks.s stack_checks.mif
python3 simulation/load_program.py stack_checks.mif starter/stack_cpu.vhd --output stack_checks_cpu.vhd
python3 simulation/sbasm.py simulation/cumulative_shifts.s cumulative_shifts.mif
python3 simulation/load_program.py cumulative_shifts.mif starter/stack_cpu.vhd --output cumulative_shifts_cpu.vhd
Run the program testbench with each processor. The first run checks the stack and carry. The second selects arithmetic right shift (mode 2). The bench prints the initial word and five successive one-bit shifts. Before you run modes 1 and 3, predict the first step at which their displays will differ. Run each mode from reset, compare the two traces and identify which bit moved into bit 15. Use mode 0 to check the left shift.
VHDL
nvc --std=2008 -a stack_checks_cpu.vhd simulation/test_program.vhd
nvc --std=2008 -e test_program
nvc --std=2008 -r test_program
nvc --std=2008 -a cumulative_shifts_cpu.vhd simulation/test_program.vhd
nvc --std=2008 -e -gmode=2 test_program
nvc --std=2008 -r test_program
Design your own assembly program
Choose a switch-controlled transformation and write a program to display its result. Use a nested call, preserve the return address and at least one working register on the stack, and leave an observable result on both the LEDs and the displays. Save a copy of simulation/shift_panel.s as my_program.s in the extracted worksheet folder and edit that copy. Assemble your work and insert the image into your repaired HDL.
VHDL
python3 simulation/sbasm.py my_program.s custom.mif
python3 simulation/load_program.py custom.mif starter/stack_cpu.vhd --output my_stack_cpu.vhd
Keep a copy of the repaired processor. Copy the generated HDL from the last command into the original project source file. Keep its original filename, compile it and upload it using the same workflow. Reset the board before testing your two inputs. Submit your assembly, a stack trace showing two return addresses, and two predicted and observed board readings for inputs of your choice. Explain how either observation could reveal an incorrect return.
Based on FPGAcademy Digital Logic Lab 11, Part VIII. Verilog handout · VHDL handout · MIT license
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Make a 16-bit processor call a subroutine from inside another subroutine. Then use your processor to compare four ways of shifting a negative number. You will need the branch and memory-port concepts from Lab 10, a computer with Python 3 and access to the LabsLand DE1-SoC.
Trace the stack
Open the assembly program. The program starts its stack pointer at 0x1000. RAM occupies word addresses 0x0000–0x0FFF. The first push must decrement the stack pointer before writing. Predict the first two addresses written by transform. In render, find the call that would destroy its return address unless the caller saved it. Follow the return through both subroutines.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/stack_cpu.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
stack_cpu. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/stack_cpu.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Repair the shifter
The starter has a fault in one shift operation. Build and upload the starter unchanged first. Lower SW9, pulse KEY0, then raise SW9. SW6–5 selects logical left, logical right, arithmetic right or rotate right in that order. SW3–0 sets the amount. Leave SW4 down. The red LEDs echo the low control bits. Read HEX3–0 as one hexadecimal word.
| SW6–5 | Amount | Predicted from 0x9010 | Starter | After repair |
|---|---|---|---|---|
| 00 | 1 | |||
| 01 | 1 | |||
| 10 | 1 | |||
| 10 | 4 | |||
| 11 | 5 |
For which pair of rows does the starter give the same answer unexpectedly? Track bit 15 through the shifter. Correct the HDL, run the bench and upload the new design. Repeat both arithmetic-right rows. Compare the high bits with the logical-right result. Each switch setting starts from the same 0x9010 seed.
Simulate
Run these commands from the extracted worksheet folder. First try the supplied HDL, then repeat after editing the shifter in the starter file. The bench tests all 64 mode and amount pairs on a running processor with nested calls. It reports the first mismatch. For the arithmetic right shift, compare the new high bit with the original sign.
VHDL
nvc --std=2008 -a starter/stack_cpu.vhd simulation/test_stack.vhd
nvc --std=2008 -e test_stack
nvc --std=2008 -r test_stack
Run two diagnostic programs
Stack and shift checks uses a descending stack, saves 0x0F0F across a call and checks that the stack pointer returns to 0x1000. It also checks the carry from a left shift. The program leaves 0x055 on the LEDs on success and 0x00F on failure. Cumulative shifts applies each transformation to the previous result. Reset between modes. The first display is 9010. With a one-bit shift, predict its next value. Run this version in simulation, where you can step through the rapid display changes.
Save your shifter repair in the HDL file under starter/. From the extracted worksheet folder, assemble both programs and insert each one into its own copy of the processor.
If the assembler reports an error, correct the indicated line and assemble again before loading the memory image. A failed build leaves any previous .mif in place.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
VHDL
python3 simulation/sbasm.py simulation/stack_checks.s stack_checks.mif
python3 simulation/load_program.py stack_checks.mif starter/stack_cpu.vhd --output stack_checks_cpu.vhd
python3 simulation/sbasm.py simulation/cumulative_shifts.s cumulative_shifts.mif
python3 simulation/load_program.py cumulative_shifts.mif starter/stack_cpu.vhd --output cumulative_shifts_cpu.vhd
Run the program testbench with each processor. The first run checks the stack and carry. The second selects arithmetic right shift (mode 2). The bench prints the initial word and five successive one-bit shifts. Before you run modes 1 and 3, predict the first step at which their displays will differ. Run each mode from reset, compare the two traces and identify which bit moved into bit 15. Use mode 0 to check the left shift.
VHDL
nvc --std=2008 -a stack_checks_cpu.vhd simulation/test_program.vhd
nvc --std=2008 -e test_program
nvc --std=2008 -r test_program
nvc --std=2008 -a cumulative_shifts_cpu.vhd simulation/test_program.vhd
nvc --std=2008 -e -gmode=2 test_program
nvc --std=2008 -r test_program
Design your own assembly program
Choose a switch-controlled transformation and write a program to display its result. Use a nested call, preserve the return address and at least one working register on the stack, and leave an observable result on both the LEDs and the displays. Save a copy of simulation/shift_panel.s as my_program.s in the extracted worksheet folder and edit that copy. Assemble your work and insert the image into your repaired HDL.
VHDL
python3 simulation/sbasm.py my_program.s custom.mif
python3 simulation/load_program.py custom.mif starter/stack_cpu.vhd --output my_stack_cpu.vhd
Keep a copy of the repaired processor. Copy the generated HDL from the last command into the original project source file. Keep its original filename, compile it and upload it using the same workflow. Reset the board before testing your two inputs. Submit your assembly, a stack trace showing two return addresses, and two predicted and observed board readings for inputs of your choice. Explain how either observation could reveal an incorrect return.
Based on FPGAcademy Digital Logic Lab 11, Part VIII. Verilog handout · VHDL handout · MIT license
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
Make a 16-bit processor call a subroutine from inside another subroutine. Then use your processor to compare four ways of shifting a negative number. You will need the branch and memory-port concepts from Lab 10, a computer with Python 3 and access to the LabsLand DE1-SoC.
Trace the stack
Open the assembly program. The program starts its stack pointer at 0x1000. RAM occupies word addresses 0x0000–0x0FFF. The first push must decrement the stack pointer before writing. Predict the first two addresses written by transform. In render, find the call that would destroy its return address unless the caller saved it. Follow the return through both subroutines.
Build
- In the LabsLand Online Editor, choose DE1-SoC for your HDL and the Standard interface.
- Create
stack_cpu, paste the design and set it as the top level. - Choose Synthesize → Upload to FPGA. After editing the design, synthesize and upload it again to test the change on the board.
Repair the shifter
The starter has a fault in one shift operation. Build and upload the starter unchanged first. Lower SW9, pulse KEY0, then raise SW9. SW6–5 selects logical left, logical right, arithmetic right or rotate right in that order. SW3–0 sets the amount. Leave SW4 down. The red LEDs echo the low control bits. Read HEX3–0 as one hexadecimal word.
| SW6–5 | Amount | Predicted from 0x9010 | Starter | After repair |
|---|---|---|---|---|
| 00 | 1 | |||
| 01 | 1 | |||
| 10 | 1 | |||
| 10 | 4 | |||
| 11 | 5 |
For which pair of rows does the starter give the same answer unexpectedly? Track bit 15 through the shifter. Correct the HDL, run the bench and upload the new design. Repeat both arithmetic-right rows. Compare the high bits with the logical-right result. Each switch setting starts from the same 0x9010 seed.
Simulate
Run these commands from the extracted worksheet folder. First try the supplied HDL, then repeat after editing the shifter in the starter file. The bench tests all 64 mode and amount pairs on a running processor with nested calls. It reports the first mismatch. For the arithmetic right shift, compare the new high bit with the original sign.
SystemVerilog
iverilog -g2012 -s test_stack -o bench starter/stack_cpu.sv simulation/test_stack.v
vvp bench
Run two diagnostic programs
Stack and shift checks uses a descending stack, saves 0x0F0F across a call and checks that the stack pointer returns to 0x1000. It also checks the carry from a left shift. The program leaves 0x055 on the LEDs on success and 0x00F on failure. Cumulative shifts applies each transformation to the previous result. Reset between modes. The first display is 9010. With a one-bit shift, predict its next value. Run this version in simulation, where you can step through the rapid display changes.
Save your shifter repair in the HDL file under starter/. From the extracted worksheet folder, assemble both programs and insert each one into its own copy of the processor.
If the assembler reports an error, correct the indicated line and assemble again before loading the memory image. A failed build leaves any previous .mif in place.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
SystemVerilog
python3 simulation/sbasm.py simulation/stack_checks.s stack_checks.mif
python3 simulation/load_program.py stack_checks.mif starter/stack_cpu.sv --output stack_checks_cpu.sv
python3 simulation/sbasm.py simulation/cumulative_shifts.s cumulative_shifts.mif
python3 simulation/load_program.py cumulative_shifts.mif starter/stack_cpu.sv --output cumulative_shifts_cpu.sv
Run the program testbench with each processor. The first run checks the stack and carry. The second selects arithmetic right shift (mode 2). The bench prints the initial word and five successive one-bit shifts. Before you run modes 1 and 3, predict the first step at which their displays will differ. Run each mode from reset, compare the two traces and identify which bit moved into bit 15. Use mode 0 to check the left shift.
SystemVerilog
iverilog -g2012 -s test_program -o check stack_checks_cpu.sv simulation/test_program.v
vvp check
iverilog -g2012 -s test_program -o check cumulative_shifts_cpu.sv simulation/test_program.v
vvp check +MODE=2
Design your own assembly program
Choose a switch-controlled transformation and write a program to display its result. Use a nested call, preserve the return address and at least one working register on the stack, and leave an observable result on both the LEDs and the displays. Save a copy of simulation/shift_panel.s as my_program.s in the extracted worksheet folder and edit that copy. Assemble your work and insert the image into your repaired HDL.
SystemVerilog
python3 simulation/sbasm.py my_program.s custom.mif
python3 simulation/load_program.py custom.mif starter/stack_cpu.sv --output my_stack_cpu.sv
Keep a copy of the repaired processor. Copy the generated HDL from the last command into the original project source file. Keep its original filename, compile it and upload it using the same workflow. Reset the board before testing your two inputs. Submit your assembly, a stack trace showing two return addresses, and two predicted and observed board readings for inputs of your choice. Explain how either observation could reveal an incorrect return.
Based on FPGAcademy Digital Logic Lab 11, Part VIII. Verilog handout · VHDL handout · MIT license
Open the LabsLand DE1-SoC lab: https://labsland.com/en/labs/fpga-de1-soc/
Make a 16-bit processor call a subroutine from inside another subroutine. Then use your processor to compare four ways of shifting a negative number. You will need the branch and memory-port concepts from Lab 10, a computer with Python 3 and access to the LabsLand DE1-SoC.
Trace the stack
Open the assembly program. The program starts its stack pointer at 0x1000. RAM occupies word addresses 0x0000–0x0FFF. The first push must decrement the stack pointer before writing. Predict the first two addresses written by transform. In render, find the call that would destroy its return address unless the caller saved it. Follow the return through both subroutines.
Build
Install Quartus. For a new installation, download Quartus Prime Lite 24.1 for Windows or Linux. The DE1-SoC needs Cyclone V device support. If you download the individual files, save cyclonev-24.1std.0.1077.qdz in the same folder as the installer before running it.
- From the extracted worksheet folder, open
starter/stack_cpu.qpfin the selected release of Quartus Prime Lite with Cyclone V support. The project-only download has the QPF at its root. - Edit the HDL file for
stack_cpu. If the exercise generates a new HDL file, copy its contents into that same project file. - Choose Processing → Start Compilation. Check the Fitter report for device 5CSEMA5F31C6.
- In the LabsLand bitstream upload lab, choose Standard and upload
output_files/stack_cpu.sof. Wait for programming confirmation before using the controls. - If your course uses a LabsLand classroom, the upload opens a firmware library instead: check that your SOF is selected and choose Enter board with selected firmware.
Repair the shifter
The starter has a fault in one shift operation. Build and upload the starter unchanged first. Lower SW9, pulse KEY0, then raise SW9. SW6–5 selects logical left, logical right, arithmetic right or rotate right in that order. SW3–0 sets the amount. Leave SW4 down. The red LEDs echo the low control bits. Read HEX3–0 as one hexadecimal word.
| SW6–5 | Amount | Predicted from 0x9010 | Starter | After repair |
|---|---|---|---|---|
| 00 | 1 | |||
| 01 | 1 | |||
| 10 | 1 | |||
| 10 | 4 | |||
| 11 | 5 |
For which pair of rows does the starter give the same answer unexpectedly? Track bit 15 through the shifter. Correct the HDL, run the bench and upload the new design. Repeat both arithmetic-right rows. Compare the high bits with the logical-right result. Each switch setting starts from the same 0x9010 seed.
Simulate
Run these commands from the extracted worksheet folder. First try the supplied HDL, then repeat after editing the shifter in the starter file. The bench tests all 64 mode and amount pairs on a running processor with nested calls. It reports the first mismatch. For the arithmetic right shift, compare the new high bit with the original sign.
SystemVerilog
iverilog -g2012 -s test_stack -o bench starter/stack_cpu.sv simulation/test_stack.v
vvp bench
Run two diagnostic programs
Stack and shift checks uses a descending stack, saves 0x0F0F across a call and checks that the stack pointer returns to 0x1000. It also checks the carry from a left shift. The program leaves 0x055 on the LEDs on success and 0x00F on failure. Cumulative shifts applies each transformation to the previous result. Reset between modes. The first display is 9010. With a one-bit shift, predict its next value. Run this version in simulation, where you can step through the rapid display changes.
Save your shifter repair in the HDL file under starter/. From the extracted worksheet folder, assemble both programs and insert each one into its own copy of the processor.
If the assembler reports an error, correct the indicated line and assemble again before loading the memory image. A failed build leaves any previous .mif in place.
On Windows with the Python launcher, use py -3 wherever a command starts with python3.
SystemVerilog
python3 simulation/sbasm.py simulation/stack_checks.s stack_checks.mif
python3 simulation/load_program.py stack_checks.mif starter/stack_cpu.sv --output stack_checks_cpu.sv
python3 simulation/sbasm.py simulation/cumulative_shifts.s cumulative_shifts.mif
python3 simulation/load_program.py cumulative_shifts.mif starter/stack_cpu.sv --output cumulative_shifts_cpu.sv
Run the program testbench with each processor. The first run checks the stack and carry. The second selects arithmetic right shift (mode 2). The bench prints the initial word and five successive one-bit shifts. Before you run modes 1 and 3, predict the first step at which their displays will differ. Run each mode from reset, compare the two traces and identify which bit moved into bit 15. Use mode 0 to check the left shift.
SystemVerilog
iverilog -g2012 -s test_program -o check stack_checks_cpu.sv simulation/test_program.v
vvp check
iverilog -g2012 -s test_program -o check cumulative_shifts_cpu.sv simulation/test_program.v
vvp check +MODE=2
Design your own assembly program
Choose a switch-controlled transformation and write a program to display its result. Use a nested call, preserve the return address and at least one working register on the stack, and leave an observable result on both the LEDs and the displays. Save a copy of simulation/shift_panel.s as my_program.s in the extracted worksheet folder and edit that copy. Assemble your work and insert the image into your repaired HDL.
SystemVerilog
python3 simulation/sbasm.py my_program.s custom.mif
python3 simulation/load_program.py custom.mif starter/stack_cpu.sv --output my_stack_cpu.sv
Keep a copy of the repaired processor. Copy the generated HDL from the last command into the original project source file. Keep its original filename, compile it and upload it using the same workflow. Reset the board before testing your two inputs. Submit your assembly, a stack trace showing two return addresses, and two predicted and observed board readings for inputs of your choice. Explain how either observation could reveal an incorrect return.
Based on FPGAcademy Digital Logic Lab 11, Part VIII. Verilog handout · VHDL handout · MIT license
Upload the bitstream to LabsLand: https://labsland.com/en/labs/fpga-de1-soc-direct/
A switch and a green indicator live on a virtual breadboard. Two red LEDs live on the physical DE1-SoC. Can you use the red LEDs to tell whether a fault is in the switch input or in the green indicator output?
After Digital Logic Lab 1, use the same DE1-SoC and change its interface to Breadboard. The square brackets in the GPIO diagram identify each signal by number.
Build the circuit
- Open Change beside User interface. Select Breadboard, then Configure. Use + to add a slide switch and an LED.
- Place the switch across three adjacent breadboard columns. Connect its left terminal to the red 3.3 V rail and its right terminal to the ground rail. Connect its middle terminal to FPGA input
V_GPIO[24]. Follow the GPIO_0[24] label in the connector diagram. - Place one LED lead on the ground rail. Wire the other lead to FPGA output
V_GPIO[35]. Each unbroken group of five breadboard holes in a column shares a connection. Trace each wire to its signal before leaving the configurator. - Wait for Ready and Saved, then select Done. Download the starter for your HDL. In the editor, choose New, name the file
indicator_pair, paste the starter and select it as the top-level file. Predict the two red LED states and the green indicator state for each switch position.

Open the full-size wiring diagram. The breadboard and its green indicator are virtual. Your HDL runs on the FPGA, and the camera shows LEDR1 and LEDR0 on the physical board.
Find the fault
Synthesize the starter and select Upload to FPGA. When the station reports that the program is ready, double-click the breadboard switch to change its position. Move the switch once in each direction to establish the starting state. Give the camera a few seconds after each change. Read the green indicator in the breadboard and the two rightmost red LEDs in the camera.
| Switch position | Physical LEDR1 | Physical LEDR0 | Breadboard indicator |
|---|---|---|---|
| First position | |||
| Opposite position | |||
| Return to first position |
Your target is for the green indicator to agree with LEDR0. LEDR1 should still show the opposite state. Change one output expression, synthesize again and repeat the three observations.
| Repaired design | Physical LEDR1 | Physical LEDR0 | Breadboard indicator |
|---|---|---|---|
| First position | |||
| Opposite position | |||
| Return to first position |
Submit your edit, an observation from each position, and an explanation of how the two red LEDs helped you locate the fault. If neither red LED changes when you operate the switch, which connection would you inspect first?
A gust has stopped the airport turbine. A technician holds the controller in reset. Should the runway warning stay on? Use the board LEDs and the station readout to find out.
This extension follows Digital Logic Lab 7 and assumes you can trace a state machine. Your controller runs on a physical DE1-SoC. The board exchanges signals with a simulated turbine and weather station.
Prepare the station
- Open the LabsLand DE1-SoC Online Editor in your HDL. Create a source file named
wind_interlockwith that language's extension, paste the matching starter, and select the file as the top level. - Under User interface, choose Change → Simulations → Airport Wind Station → Apply interface. Synthesize the design and send it to the board. Wait for programming to finish and the weather controls to connect.
- Choose Restart activity to return the simulated weather to its starting conditions. Pulse SW0 high, then low, to initialize the controller. These controls act on different parts of the experiment.
Check the connection
Choose Calm. Raise SW0. LEDR8 should light while Active and Generator stay at zero. Lower SW0 and choose Steady wind. LEDR6 should light when the FPGA receives steady wind. If weather buttons change the scene but LEDR6 never changes, check the selected interface and top-level file before diagnosing the alert.
Reproduce the problem
Use the station's Current outputs as well as the board LEDs. LEDR5 mirrors the runway alert, LEDR3 shows the generator command, and LEDR1–0 show the controller state. An active command can outlast generation while the rotor slows.

During steady generation on this UW board, the five lit LEDs were LEDR7, 6, 4, 3 and 1. Find the generator indicator in the row above the switches before changing the wind.
| Action | What to record |
|---|---|
| Choose Calm | Read Active, Generator, Runway alert and the two state bits. |
| Choose Steady wind | Wait for alignment and generation. Compare the rotor's motion with Generator. |
| Choose Wind direction change | Watch alignment fall and generation pause. Wait for generation to resume. |
| Choose High-wind gust | Record the alert, the generator and the rotor after it settles. |
| Keep the gust selected. Hold SW0 high | Compare your prediction with LEDR5 and the Runway alert output. |
| Release SW0 without changing the weather | Which output changes? What input stayed the same? |
Inspect the assignment to runway_alert. Which of its inputs describes the weather, and which belongs to the turbine controller? Edit just that relationship. Repeat the gust and reset sequence with the repaired build. The generator must stay off during the gust. After restoring calm, check that the alert clears.
Explain the evidence
Hand in a before/after pair for the held-reset case, the corrected expression, and a short explanation of why a stored motion state makes a poor source for the alert. The camera and browser update at different rates. If you miss a brief state, repeat the transition and use a local testbench to examine individual clock edges.
For an offline check, the supplied bench changes the weather and alignment bits at the connector and shortens the clock divider. The bench includes the reserved wind code, which the weather buttons do not produce. On a campus board, use a testbench or a correctly mapped compatible peripheral to supply these signals. The DE1-SoC switches alone do not reproduce the 3D plant.
Run the connector test locally
Use one of these commands from the extracted worksheet folder. Run the resulting file with vvp wind-test. The starter should stop at the held-reset check.
# Verilog
iverilog -g2005-sv -s check_wind -o wind-test starter/wind_interlock.v tests/check_wind.v
# SystemVerilog
iverilog -g2012 -s check_wind -o wind-test starter/wind_interlock.sv tests/check_wind.v
# VHDL (GHDL 6 + Icarus Verilog)
ghdl --synth --std=08 --out=verilog -gCLOCKS_PER_TICK=8 starter/wind_interlock.vhd -e wind_interlock > wind-model.v
iverilog -g2005-sv -DFIXED_DIVIDER -s check_wind -o wind-test wind-model.v tests/check_wind.v
Airport Wind Station was developed with the University of Washington Remote Hub Lab (RHLAB) and integrated with LabsLand. Zhiyun “ZZ” Zhang created the 3D assets and visualization foundation. Luis Rodríguez Gil developed the integration, interface and state model. Brian Chap contributed to the activity specification. Professor Rania Hussein leads RHLAB and is REDTAIL's principal investigator. Development was supported in part by the U.S. National Science Foundation, award 2336745. The findings and opinions are the authors'. Station documentation and acknowledgments
An FPGA counter can change the width of a pulse while keeping its period fixed. Use measurements from a DE1-SoC connected to a two-channel oscilloscope at the University of Deusto. One channel carries the adjustable pulse. The other carries a reference generated from the same clock.
Read the instrument
Download trace A, trace B and trace C. Each contains 500 simultaneous readings from both channels. Open the CSV files in a spreadsheet or plotting tool. The first column counts samples. The other columns give measured volts.
Treat a sample above 1.5 V as high. In trace A, identify a low-to-high transition, then the next low-to-high transition on the same channel. Count sample intervals between them. Count how many of those intervals start high. Divide the high count by the period in samples to obtain the duty cycle.
| Capture | Channel 1 period (samples) | Channel 1 high (samples) | Channel 1 duty (%) | Channel 2 duty (%) |
|---|---|---|---|---|
| A | ||||
| B | ||||
| C |
Interpret the change
Compare A with B, then use C to check whether the circuit returned to its first setting. Which channel changed? Estimate how much the calculated duty would change if you moved one edge by one sample. Explain which observation rules out a change of frequency.
Submit your table and a marked plot of one measured cycle. If you have the trace on paper, the plotted samples below cover more than one full cycle of each capture.

The dashed line marks 1.5 V. Both panels in a row use the same sample numbers. Original LabsLand activity and measurements.
