Nios® V Processor Software Developer Handbook

ID 743810
Date 10/06/2025
Public
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)
  • Saves register values onto the stack
  • Checks for a registered hardware exception handler.
  • If an hardware handler is registered, the exception dispatcher calls it, then restores context and returns.
  • If no hardware 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 all 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 22. Exception Dispatcher

For more information on registering an hardware exception handler, refer to the Hardware 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.