RTL Studio Open IDE

3.1 · RV SYS CLASS

IRQ vector table

Place a trap handler at the mtvec word index of the program image to handle interrupts correctly.

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

What you practice

IRQ vector table (3.1). Place a trap handler at the mtvec word index of the program image to handle interrupts correctly. It is in IRQ vector table .hex — Part 3 · Interrupts & DMA of the RISC-V on SoC & System Masterclass.

The core and the mini-SoC simulate as one workspace in the IDE. Follow MMIO, interrupts, and the program on the Verilator waveform, not only a pass line.

What you will learn

Today you will configure the program image to handle interrupts correctly. You will place a trap handler at the mtvec word index of the program image. This ensures the core jumps to the right code when an interrupt occurs.

Learning objectives

  • Understand the role of the mtvec register in interrupt handling.
  • Configure the program image to include a valid trap handler.
  • Connect the testbench signals to the DUT instance ports.
  • Verify the core halts after executing the trap handler.

Theory

The mtvec (Machine Trap Vector) register holds the base address of the trap handler. When an interrupt occurs, the core jumps to this address. The program image must contain the trap handler code at the correct memory location. The testbench loads the program image into the core's instruction memory. You must ensure the vector table is correctly laid out in the hex file. The core expects the handler to be at a specific word index. This lesson focuses on the software side of the interrupt setup.

Practice

  1. Open RtlStudio and select this chapter from the Examples list.
  2. Open student/tb/tb_top.sv in the Explore panel.
  3. Locate the dut_i instance block.
  4. Replace the __TODO__[0] placeholders with the correct signal names.

- Look up the required port names in student/rtl/design.sv if needed.

  1. Run Simulation from the sidebar.
  2. Check the Log panel for INFO: PASS.

Summary

You configured the testbench to load the correct program image containing the trap handler for the IRQ vector table. You connected the GPIO ports to verify that the RISC-V core correctly handles interrupts via the mtvec register. The simulation confirmed that the core halts after executing the trap handler, demonstrating successful interrupt handling.

© 2026 RtlStudio. Licensed under CC BY-NC-ND 4.0. Commercial use and modifications by third parties are not permitted.

Run it in the Verilog IDE

  1. Open the system lesson in the IDE. The RV32I core and the mini-SoC fabric simulate together.
  2. Run Verilator and trace the program through MMIO: address, load/store data, and the peripheral response.
  3. Interrupts and DMA belong on the waveform next to the instruction stream, not only in a pass/fail line.
  4. Edit the integration RTL, resimulate, and run Yosys on the structural block when you want a netlist.

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