Route one of two words to the LEDs
Online version: https://fpga.labsland.com/altera/digital-logic/lab-01/part-02/
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.
Lab setup
LabsLand Online Editor · DE1-SoC
Physical DE1-SoCCyclone V · 5CSEMA5F31C6 · camera, switches and buttons in the browser
Build in Quartus and upload the bitstream
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.
- Get the starterDownload
selector.v - Open the LabsLand Online EditorOpen the lab Choose DE1-SoC · Verilog when you open the lab. LabsLand asks you to sign in. Use the access your course or institution provides.
- Follow the worksheetPredict first, then build, read the board and hand in. The build steps are below.
- Install Quartus Prime Lite with Cyclone V supportSkip this if it is already installed.
- Download the activityDownload worksheet and Quartus project Includes the worksheet and the Quartus project.
- Complete the design and compileStart with Predict in the worksheet below, then complete the design as its build steps describe. Open
selector.qpfand choose Processing → Start Compilation. Quartus writesoutput_files/selector.sof. - Upload the bitstream to LabsLandUpload bitstream LabsLand asks you to sign in. Use the access your course or institution provides.
Already compiled? Upload your .sof directly
Starter files · Verilog · VHDL · SystemVerilog
Worksheet and starter (.zip) for offline work or printing
Predict
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
