RTL Studio Open IDE

4.6 · RISC-V CLASS

Trap and interrupt integration

Integrate trap and interrupt handling by redirecting the PC to mtvec on a trap and restoring it from mepc on MRET.

Video coming soon. This lesson page stays at the same URL when the lecture publishes.

What you practice

Trap and interrupt integration (4.6). Integrate trap and interrupt handling by redirecting the PC to mtvec on a trap and restoring it from mepc on MRET. It is in Trap/IRQ integration top — Part 4 · CSR, Trap & IRQ Interface of the RISC-V RV32I Core Masterclass.

The RV32I core is Verilog you simulate in the browser IDE. Verilator runs the program; the waveform shows PC, the instruction, and the register write.

Run it in the Verilog IDE

  1. Open the RV32I lesson in the IDE. Fetch, decode, and execute are source you can simulate.
  2. Run Verilator and watch PC, the instruction, and the register write on the waveform.
  3. Treat a program printout as done only after the ISA step this lesson names matches the wave.
  4. Change the RTL in the editor, rerun Verilator, and read the waveform again in the same tab.

The lesson is done when the simulation matches Trap and interrupt integration. Change the source, run the Verilog simulator again, and read the waveform without leaving the IDE. Simulation guide · Yosys guide.