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.
| Operation | Description |
|---|---|
| Read Status | Check if the IRQ bit is set in the status register. |
| Write Clear | Write a 1 to the status register to clear the sticky bit. |
| Return | Execute mret to resume normal program execution. |
Practice
- Open
student/rtl/design.sv. - Replace
__TODO__[0]with32in allaxi_ifinstance declarations. - Save the file.
- Open
student/tb/tb_top.sv. - No changes are required in the testbench for this lesson.
- Run the simulation.
- 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
- Open the system lesson in the IDE. The RV32I core and the mini-SoC fabric simulate together.
- Run Verilator and trace the program through MMIO: address, load/store data, and the peripheral response.
- Interrupts and DMA belong on the waveform next to the instruction stream, not only in a pass/fail line.
- 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.