Visible to Intel only — GUID: scl1742180769531
Ixiasoft
Visible to Intel only — GUID: scl1742180769531
Ixiasoft
9.2.3.1. How the Hardware Works
When the Nios® V processor responds to a software-vectored interrupt or exception, it performs the following tasks:
- Disables interrupts by clearing mstatus.mie and saves the previous value to mstatus.mpie.
- Saves the next execution address in Machine Exception Program Counter (mepc).
- Saves the cause of the trap in Machine Cause register (mcause).
- Saves the active interrupt level in Machine Interrupt Status Register (mintstatus).
- Switch to shadow register set through Shadow Register File Status register (msrfstatus) if enabled.
- Transfers control to the trap handling system (vector base address), held in the Machine Trap-Vector Base-Address (mtvec) register.
- The same transfer of control is applied to all types of traps – interrupts and exceptions.
Software-vectored interrupts are not vectored. Therefore, the same vector base address receives control for all software-vectored interrupts and exception.
At the vector base address, the trap handling code must support pre-emptive interrupt by saving CSRs – msrfstatus, mepc and mcause before reenabling interrupts (setting mstatus.mie). If there is no pre-emptive interrupt, the trap handling code proceeds to determine the type of trap (i.e. exception, platform interrupt, timer interrupt or software interrupt), and assign the relevant handler.
All Nios® V processor trap types are precise. This means that after a trap is handled, the Nios® V processor can re-execute the instruction that caused the trap.