Lab 1

Reverse bytes in place

Debugger setup

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

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

Load mirror.s. In Memory (Ctrl-M), go to label_text and find the six ASCII bytes, the zero terminator and the following guard byte 5a. Predict the order after reversal. Save a copy of the memory row before execution.

Watch a swap

Set a breakpoint at swap_pair. Record the two pointer values and identify the characters they address. Step until both stores have executed. Inspect the same row of memory, then continue through the remaining swaps. At hold, check the text, terminator and guard again.

Replace ROTOR7 with a five-character word, then an empty string. Recompile between runs. Submit the before and after rows for all three inputs. Explain how the loop treats a middle character and why the guard byte must survive unchanged.

Adapted from FPGAcademy · Computer Organization 24.1 · Lab 1, IV. Original LabsLand assembly and worksheet. MIT

Run a signed maximum on a physical Nios V board