RTL Studio Open IDE

3.3 · RV SYS CLASS

GPIO IRQ change

Clear a sticky peripheral IRQ status bit from inside the handler by setting AXI address widths.

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

What you practice

GPIO IRQ change (3.3). Clear a sticky peripheral IRQ status bit from inside the handler by setting AXI address widths. It is in Sticky IRQ status and clear — 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

You will learn how to clear a sticky peripheral IRQ status bit from inside the handler. This ensures the interrupt controller knows the event has been serviced.

Learning objectives

  • Understand the role of the IRQ clear register in the interrupt controller.
  • Identify the correct memory-mapped address for the GPIO IRQ status register.
  • Write a store instruction to clear the sticky bit in the assembly handler.
  • Verify the system halts correctly after the IRQ is serviced.

Theory

Interrupt controllers often use sticky bits to indicate that an interrupt event occurred. These bits remain set until software explicitly clears them. If the bit is not cleared, the interrupt controller may trigger the handler repeatedly. The handler must write a specific value to the peripheral's control register. This action acknowledges the interrupt and allows new events to be detected.

OperationDescription
Read StatusCheck if the IRQ bit is set in the status register.
Write ClearWrite a 1 to the status register to clear the sticky bit.
ReturnExecute mret to resume normal program execution.

Practice

  1. Open student/rtl/design.sv.
  2. Replace __TODO__[0] with 32 in all axi_if instance declarations.
  3. Save the file.
  4. Open student/tb/tb_top.sv.
  5. No changes are required in the testbench for this lesson.
  6. Run the simulation.
  7. Check the Log panel for the PASS message.

Summary

You practiced writing the specific memory-mapped write required to clear a sticky GPIO IRQ status bit within the interrupt handler. This step is essential to acknowledge the interrupt and prevent the interrupt controller from immediately re-triggering the same request. By implementing this clear operation, you ensured the system halts correctly after the handler completes its task.

© 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 GPIO IRQ change. Change the source, run the Verilog simulator again, and read the waveform without leaving the IDE. Simulation guide · Yosys guide.