Lab 1

Connect ten switches to ten lights

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.

Lab setup

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

  1. Get the starterDownload switch_bank.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

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.

  1. If the editor tour is open, finish it or select Skip. If User interface shows a simulation, choose Change → Basic → Standard.
  2. Select New. Name the file switch_bank, choose the extension for your HDL (.v, .sv or .vhd) and select Create.

    The New file dialog with switch_bank as the file name and .v as the extension

  3. Copy the starter into the file and choose switch_bank under Top level entity. Only SW0 is connected so far.

  4. Complete the assignment so that LEDR[i] follows SW[i] for all ten bits.
  5. Choose Synthesize. When a green message reports that the program was verified and compiled, choose Upload to FPGA.

    The editor after Synthesize: switch_bank.v is the only file and the top level entity, the starter code is open, and a green message confirms the compilation

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

    The board page: a camera view of the DE1-SoC on the left and the ten switches SW9 to SW0 on the right, with SW0 switched on

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