Nios® V Processor Reference Manual

ID 683632
Date 3/28/2022
Public

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

Document Table of Contents

2.3.5. Interrupt Controller

The Nios® V/m processor implementation supports the following interrupts:
  • Platform interrupts with 16 level-sensitive interrupt request (IRQ) inputs.
  • Timer and Software interrupt - generated internally. You can access the timer interrupt register using the Timer and Software interrupt module interface by connecting to the data bus.

During an interrupt, the core writes the Program Counter of the attached instruction into the Machine Exception Program Counter (mepc) register. An interrupt is usually attached to the instruction in E-stage or in the preceding F or D pipeline stages. This is because the M-stage initiates the General Purpose Register. Thus, the core is not capable of retracting a memory instruction in M-stage. When an instruction in M-stage flags an exception while an interrupt is pending and ready to be serviced, the core will fetch and execute the exception instruction. If a memory or multicycle instruction is pending in M-stage, for example, the core is waiting for the response, the core does not flag an interrupt until the core receives a response for that instruction. Pending interrupts are flagged by their corresponding bits in Machine Interrupt-Pending (mip) register.

An interrupt is taken only when Machine Status Register (mstatus) bit 3 is asserted and bits corresponding to its pending interrupt in Machine Interrupt-pending (mip) register is asserted.

Table 7.  Interrupt Control and Status Registers/Bits
Register Description
mstatus mstatus[3] / Machine Interrupt-enable (MIE) field
  • Global interrupt-enable bit for machine mode
mie
mie[7] / Machine Timer Interrupt-enable (MTIE) field
  • Timer interrupt-enable bit for machine mode
mie[3] / Machine Software Interrupt-enable (MSIE) field
  • Software interrupt-enable bit for machine mode
mip mip[7] / Machine Timer Interrupt-pending (MTIP) field
  • Timer interrupt-pending bit for machine mode
mip[3] / Machine Software Interrupt-pending (MSIP) field
  • Software interrupt-pending bit for machine mode