Nios® V Processor Software Developer Handbook

ID 743810
Date 1/27/2025
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

9.2.2.2.3. Exception Dispatcher

Upon an exception, the CLINT-Vectored passes control to the exception dispatcher in vector table. As stated in the RISC-V specification, the exception dispatcher is at the vector table base address.

The exception dispatcher performs the following tasks:
  • Switches to the separate exception stack (if enabled)
  • Stores register values onto the stack
  • Checks for a registered instruction-related exception handler.
  • If an instruction-related handler is registered, the exception dispatcher calls it, then restores context and returns.
  • If no instruction-related exception handler is registered,
    • If processor debug module is enabled, the processor enters Debug Mode using the ebreak instruction. Allowing the debugger to take control.
    • If there is no debug module, the processor enters an infinite loop.

Once the exception is serviced, and the exception handler returns to the exception dispatcher, it performs the following tasks:

  • Restores the registers from the stack
  • Restores the stack pointer (if a separate exception stack is used)
  • Exits by issuing an MRET (exception return in machine mode) instruction
Figure 21. Exception Dispatcher

For more information on registering an instruction-related exception handler, refer to the Instruction-Related Exception Handler chapter.

For more information about the RISCV-based processor EBREAK instruction, refer to the The RISC-V Instruction Set Manual in RISC-V International website.