Lab 7

Change interrupt frequency without losing the count

Debugger setup

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

  1. Get the sourceDownload main.c
  2. Open the simulatorOpen CPUlator

KEY0 pauses a binary counter. KEY1 should double its rate, KEY2 should halve it and KEY3 should leave it alone. The quarter-second starting period must stay between 6,250,000 and 100,000,000 timer ticks.

In CPUlator select C in Language, open File → Open and choose main.c. Use Compile and Load (F5), then Continue (F3).

Repair one direction

Find the KEY1 branch. Derive the new compare value when the frequency doubles. Leave the bounds and the acknowledge operation in place. Observe mtimecmp in Machine Timer while the program runs. Use press-and-release gestures.

Exercise both limits

Starting from a fresh run, release KEY1 three times, then KEY2 and KEY3. Record mtimecmp after each event. Restart and release KEY2 three times to reach the opposite limit. For one recorded value calculate the expected time between consecutive LED words.

Trial Initial First release Second release Third release
KEY1 × 3
KEY2 × 3 after restart

Pause with KEY0 and compare two LED readings more than a second apart. Resume with KEY0. Submit both limit traces and indicate which press changes neither the period nor the count rate.

Original LabsLand activity following FPGAcademy Computer Organization Lab 7, Part III. FPGAcademy PDF · MIT

Run a signed maximum on a physical Nios V board