Lab 1

Route one of two words to the LEDs

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

Physical DE1-SoCCyclone V · 5CSEMA5F31C6 · camera, switches and buttons in the browser

  1. Get the starterDownload selector.v
  2. Open the LabsLand Online EditorOpen the lab LabsLand asks you to sign in. Use the access your course or institution provides.
  3. Follow the worksheetPredict first, then build, read the board and hand in. The build steps are below.

Starter files · Verilog · VHDL · SystemVerilog

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