Nios® V Processor Reference Manual

ID 683632
Date 5/25/2025
Public

Visible to Intel only — GUID: aaz1741141485444

Ixiasoft

Document Table of Contents

4.3.11.2.1.1. Software-Vectored Interrupt Handling

When clicintattr[i].shv is set to 0, the associated interrupt is handled as software-vectored interrupts. When servicing a software-vectored interrupt, the CLIC switches the processor execution to the common trap handling code by configuring the pc to the address specified in the BASE field of the mtvec register.

This is a simple and efficient approach for trap controllers to manage software-vectored interrupts and exceptions in embedded systems. In this mode, exceptions and software-vectored interrupts are assigned to a fixed memory address where the common trap handling code resides.

The common trap handling code is expected to provide a quick and direct response to the event, by executing the following operations:  

  • Switches to the separate exception stack (if enabled)
  • Stores register values onto the stack
  • Determines the type of traps (either exceptions or interrupts)
  • Passes control to the exception dispatcher, or the interrupt dispatcher
  • Optionally, support back-to-back software-vectored interrupts (with mxnti register).
Table 138.  Address Computation in CLIC Direct HandlingAssume mtvec register holds the value of 0x1003, thus the BASE field in mtvec register is 0x40.
Trap Address Computation Description Results
Exceptions pc <= BASE << 6 All exceptions and software-vectored interrupts pc <= 0x1000
Software-vectored Interrupts

CLIC extends interrupt pre-emption to support up to 256 interrupt levels for machine mode, where higher-numbered interrupt levels can pre-empt lower-numbered interrupt levels. Interrupt level 0 corresponds to regular execution outside of an interrupt handler. Refer to Trap Handling with Pre-emption for more information.