Lab 3

Send a switch word to LEDs and segment bars

Debugger setup

CPUlator simulatorRISC-V · DE1-SoC Nios V computer, simulated in your browser. No board or sign-in needed.

  1. Get the sourceDownload switch_ports.s
  2. Open the simulatorOpen CPUlator

A row of LEDs and a seven-segment digit receive the same number. Predict what each will show when switch 7 alone is on. Then test your prediction on the simulated DE1-SoC.

Trace the three ports

Open switch_ports.s in CPUlator. Find the load from the ten switches at 0xFF200040 and the stores to the red LEDs at 0xFF200000 and HEX3…0 at 0xFF200020. Read the starter before you change it. Which output can respond to the switches as written?

Compile and load, then select Continue. Under Devices, change the numbered switches. Note what the starter does with switch 0 alone. Stop, correct the source register in the second store, recompile and repeat. Set a new switch word for each row, clearing the switches left on from the previous row.

Switches on Red LEDs on Illuminated bars on HEX1 and HEX0
None
0
1 and 2
7
8
9
All ten

On each digit, bits 0 through 6 control the top, upper right, lower right, bottom, lower left, upper left and middle bars. Each digit occupies one byte. Explain why switch 7 and switch 8 give different results. Submit the corrected loop, your table and a sketch for switch 8 alone.

Adapted from FPGAcademy Computer Organization, Lab 3, Part I. LabsLand wrote the assembly and activities. MIT notice

Run a signed maximum on a physical Nios V board