Skip to content
STIMSMITH

interrupt handling

Concept WIKI v2 · 5/27/2026

Interrupt handling appears in the provided evidence as both generated RISC-V trap-handler code and as a verification concern for asynchronous external stimuli. In riscv-dv, interrupt and exception handling are generated as assembly-program sections, including an mtvec_handler section with interrupt_handler and exception_handler definitions. In co-simulation, interrupts require explicit messaging because asynchronous events can make standalone trace comparison diverge; Dromajo supports this through mechanisms such as raise_interrupt(), which communicates the interrupt cause and sets the trap vector.

Overview

In the provided RISC-V verification evidence, interrupt handling is a trap-related part of generated assembly programs and a special case for reference-model co-simulation. The riscv-dv riscv_asm_program_gen class generates multiple assembly-program sections, including initialization, instruction, data, stack, page-table, interrupt-handling, and exception-handling sections.

Interrupt handling in generated RISC-V assembly

The riscv-dv assembly-generation flow treats interrupt handling as part of the generated program structure. The gen_program() function is described as the main entry point that generates all sections of a program by calling other riscv_asm_program_gen functions. After main-program and optional subprogram generation, host-interface code such as write_tohost and _exit is added through gen_section().

For trap-related code, the flow calls push_gpr_to_kernel_stack(), which pushes general-purpose registers onto a stack for trap handling. The generated program then uses gen_section() to select the mtvec_handler instruction section; that section contains both exception_handler and interrupt_handler definitions.

Why interrupts are special in verification

Interrupts are asynchronous external stimuli. The evidence notes that trace comparison can fail when testing external stimuli such as interrupts or debug requests: because the stimulus can fire randomly during execution, a single interrupt can make the execution logs of independently running models differ.

Co-simulation addresses this by running models in parallel and supporting communication between them. In such a setup, the RTL model can signal events to the reference model, and the reference model can be forced to follow the same interrupt-driven execution path.

Dromajo co-simulation behavior

Dromajo is presented as a RISC-V reference model that can boot Linux and handle external stimuli such as interrupts and debug requests. In the described RTL-Dromajo interaction, a step() DPI wrapper communicates program counter, instruction, and store data to Dromajo whenever a valid instruction is committed; Dromajo then commits one instruction and compares communicated data.

Because co-simulation is synchronous but interrupts are not, the evidence describes a separate raise_interrupt() DPI wrapper. When a core takes an interrupt, raise_interrupt() communicates the cause and sets the trap vector in Dromajo, allowing the interrupt trap-handler routines to be co-simulated.

Broader contexts

Interrupt handling also appears in operating-system and processor-controller research contexts in the provided public sources. A formal ARINC 653 operating-system specification includes interrupt handling among its modeled OS services and behaviors. In virtualized RISC-V mixed-criticality systems, interrupt virtualization is described as challenging because virtual guests need transparency while real-time features such as interrupt vectoring, nesting, and tail-chaining are preserved; the vCLIC work proposes a virtualization extension to the RISC-V CLIC fast interrupt controller for this setting.

LINKED ENTITIES

1 links

CITATIONS

9 sources
9 citations
[1] riscv-dv generated assembly programs include interrupt and exception handling sections RISC-V source class riscv_asm_program_gen, the brain behind ...
[2] gen_program() generates all sections of the program and uses helper functions such as gen_section() RISC-V source class riscv_asm_program_gen, the brain behind ...
[3] trap-handler generation includes push_gpr_to_kernel_stack() and an mtvec_handler section with exception_handler and interrupt_handler definitions RISC-V source class riscv_asm_program_gen, the brain behind ...
[4] trace comparison can fail for interrupts because external stimuli are asynchronous and can cause execution logs to diverge [PDF] Effective Processor Verification with Logic Fuzzer Enhanced Co ...
[5] co-simulation for asynchronous interrupts requires messaging so the RTL can inform the emulator or reference model to follow the interrupt-driven execution path [PDF] Effective Processor Verification with Logic Fuzzer Enhanced Co ...
[6] Dromajo can handle external stimuli such as interrupts and debug requests [PDF] Effective Processor Verification with Logic Fuzzer Enhanced Co ...
[7] Dromajo co-simulation uses step() for committed instructions and raise_interrupt() to communicate an interrupt cause and set the trap vector [PDF] Effective Processor Verification with Logic Fuzzer Enhanced Co ...
[8] A formal ARINC 653 operating-system specification includes interrupt handling A Formal Specification of Operating System based on ARINC 653
[9] vCLIC addresses interrupt handling in virtualized RISC-V mixed-criticality systems, including challenges around interrupt vectoring, nesting, and tail-chaining vCLIC: Towards Fast Interrupt Handling in Virtualized RISC-V Mixed-criticality Systems

VERSION HISTORY

v2 · 5/27/2026 · gpt-5.5 (current)
v1 · 5/27/2026 · gpt-5.5