MicroBlaze supports one external interrupt source
(connected to the Interrupt input port). The processor only reacts to interrupts if the
Interrupt Enable (IE) bit in the Machine Status Register (MSR) is set to 1. On an
interrupt, the instruction in the execution stage completes while the instruction in the
decode stage is replaced by a branch to the interrupt vector. This is either address
C_BASE_VECTORS
+ 0x10, or with low-latency interrupt mode, the
address supplied by the Interrupt Controller.
The interrupt return address (the PC associated with the instruction in the decode stage at the time of the interrupt) is automatically loaded into general purpose register R14. In addition, the processor also disables future interrupts by clearing the IE bit in the MSR. The IE bit is automatically set again when executing the RTID instruction.
Interrupts are ignored by the processor if either of the break in progress
(BIP
) or exception in progress (EIP
) bits in the
MSR are set to 1.
By using the parameter C_INTERRUPT_IS_EDGE
, the
external interrupt can either be set to level-sensitive or edge-triggered:
- When using level-sensitive interrupts, the
Interrupt
input must remain set until MicroBlaze has taken the interrupt, and jumped to the interrupt vector. Software must acknowledge the interrupt at the source to clear it before returning from the interrupt handler. If not, the interrupt is taken again, as soon as interrupts are enabled when returning from the interrupt handler. - When using edge-triggered interrupts, MicroBlaze detects and latches the
Interrupt
input edge, which means that the input only needs to be asserted one clock cycle. The interrupt input can remain asserted, but must be deasserted at least one clock cycle before a new interrupt can be detected. The latching of an edge-triggered interrupt is independent of the IE bit in MSR. Should an interrupt occur while the IE bit is 0, it will immediately be serviced when the IE bit is set to 1.
With periodic interrupt sources, such as the FIT Timer IP core, that do not have a method to clear the interrupt from software, it is recommended to use edge-triggered interrupts.