Interrupts on the Nios II

Nios II uses non-vectored interrupts so all interrupts cause the program to jump to the same fixed memory location, software at that location should examine the control registers to determine which interrupts are active and service one (or many) in some user-defined order. Below is a description of the actions taken by the processor when an interrupt occurs, and similarly for the eret instruction which is used to return from the interrupt. Also, the Nios II interrupt hardware is shown in the figure below.

Anatomy of an Interrupt

The following actions are taken by the processor when an interrupt is triggered.

Anatomy of an Interrupt Return

The eret instruction is used to return from the exception handler. It performs the following actions.

Interrupt Hardware



The ienable(Ctl3) control register enables each IRQ line from 0-31. The ipending(Ctl4) control register indicates which interrupts are being asserted. If any interrupts are being asserted and the PIE bit in bit 0 of the status control register is set, then an interrupt occurs.

Breakpoints Inside an Interrupt Service Routine

Note that the debugger has some quirks when debugging with code inside the .exceptions section (so make sure only your ISR goes into .exceptions and the rest of your code stays in .text).

Reference