The additional function allows the external SystemC model to call into the Or1ksim ISS to request an interrupt. The ISS requires that interrupts are not taken mid-instruction (for example while a peripheral memory access upcall is in progress), so a flag is set internally, allowing the ISS to trigger the interrupt at the start of the next instruction.
The standard version of Or1ksim uses edge triggered interrupts, and they are used in this example. However Or1ksim can support level triggered interrupts. For this additional interface functions are provided, although they are not used in this example.
void or1ksim_interrupt( int i );
or1ksim_interrupt
requests the the
interrupt given by its argument be taken at the start of the
next instruction cycle. This is edge-triggered interrupt
functionality, and there is no need to clear the interrupt.
void or1ksim_interrupt_set( int i );
or1ksim_interrupt_set
asserts
the interrupt given by its argument for consideration by
Or1ksim at the start of the next instruction cycle. This is
for level triggered interrupt handling, and must be explicitly
cleared when the interrupt handling is complete.
void or1ksim_interrupt_clear( int i );
or1ksim_interrupt_clear
deasserts the
interrupt given by its argument for consideration by Or1ksim
at the start of the next instruction cycle. This is to clear an
interrupt previously asserted with void
or1ksim_interrupt_set
when using level triggered
interrupt handling.
or1ksim_interrupt
requests the
interrupt given by its argument be taken at the start of the
next instruction cycle.
These functions are a standard part of the Or1ksim 0.3.0 and Or1ksim 0.4.0 libraries.