Definition
In the Ibex core verification context, an interrupt is a form of external stimulus that triggers a trap in the core. Together with debug requests and memory faults, interrupts are the principal class of asynchronous, externally-driven events that the RTL/ISS co-simulation flow must cover [chunk:9a950617-e250-431d-8371-91884e237d19].
Why ISS Models Cannot Model Interrupts
The standard end-to-end RTL/ISS co-simulation flow compares every register writeback produced by the Ibex RTL against the writebacks produced by a golden-model instruction set simulator (ISS). This works for ordinary instruction execution, but it falls apart once external stimulus such as interrupts is introduced, because ISS models can simulate traps due to exceptions but cannot model traps due to external stimulus [chunk:9a950617-e250-431d-8371-91884e237d19].
Verification Approach for Interrupts
To provide coverage for interrupt scenarios, the Ibex testbench relies on the handshaking mechanism provided by the RISCV-DV instruction generator. This mechanism allows the core to send status information to the testbench during program execution, enabling the testbench to verify that the core has entered the proper interrupt handler, entered Debug Mode properly, updated any CSRs correctly, and so on [chunk:9a950617-e250-431d-8371-91884e237d19].
Key details of the handshaking setup:
- The signature address used by the testbench for the handshaking is
0x8ffffffc[chunk:9a950617-e250-431d-8371-91884e237d19]. - A small set of API tasks is provided in
dv/uvm/core_ibex/tests/core_ibex_base_test.svto enable easy and efficient integration of the handshake mechanism [chunk:9a950617-e250-431d-8371-91884e237d19]. - Real usage during simulations can be seen in
dv/uvm/core_ibex/tests/core_ibex_test_lib.sv(thecore_ibex_test_libcode artifact). The mechanism is extensively used to provide runtime verification for situations involving external debug requests, interrupt assertions, and memory faults [chunk:9a950617-e250-431d-8371-91884e237d19]. - The full handshake mechanism is documented in the RISCV-DV project at https://github.com/google/riscv-dv/blob/master/docs/source/handshake.rst [chunk:9a950617-e250-431d-8371-91884e237d19].
Trace Log Comparison Around Interrupts
On top of the handshaking mechanism, a modified version of trace log comparison is used. Comparing every register write performed during the entire simulation would yield incorrect results, because the ISS trace log does not contain any execution information for code executed in the debug ROM or in any interrupt handler code [chunk:9a950617-e250-431d-8371-91884e237d19].
To address this, the flow compares only the final values contained in every register at the end of the test. This works because any code executed in the debug ROM and trap handlers — including interrupt handlers — should not corrupt register state in the rest of the program [chunk:9a950617-e250-431d-8371-91884e237d19].
Relationship to Other Concepts
- External stimulus: Interrupts are a subclass of external stimulus. While ISS models can simulate traps due to exceptions, they cannot model traps due to external stimulus such as interrupts [chunk:9a950617-e250-431d-8371-91884e237d19].
core_ibex_test_lib.sv: This test-library code artifact is where the handshaking mechanism (and therefore interrupt-handling verification) is put into practice for real simulations [chunk:9a950617-e250-431d-8371-91884e237d19].