R

Chapter 4: Interrupts

A special RETURNI command ensures that the end of an interrupt service routine restores the status of the flags and controls the enable of future interrupts. When the RETURNI instruction is executed, the PC values saved onto the CALL/RETURN stack is automatically reloaded to the PC register. Likewise, the ZERO and CARRY flags are restored and program flow returns to the instruction following the instruction where the interrupt occurred.

If the application does not require an interrupt, tie the INTERRUPT signal Low.

Consequently, all 1,024 instruction locations are available.

Example Interrupt Flow

 

 

ADDRESS 000

 

main:

1

 

 

ENABLE INTERRUPT

INTERRUPT

2

INPUT s0, 00

input

INPUT s1, 01

asserted.

 

ADD s0, s1

 

 

 

 

OUTPUT s0, 00

 

 

6

 

 

CALL critical_timing

 

 

JUMP main

critical_timing: DISABLE INTERRUPT

 

 

ENABLE INTERRUPT

 

 

RETURN

 

isr: TEST s7, 02

 

 

5

 

4

 

 

 

RETURNI ENABLE

 

 

3

 

 

ADDRESS 3FF

 

 

JUMP isr

The interrupt input is not recognized until the INTERRUPT_ENABLE flag is set.

In timing-critical functions or areas where absolute predictability is required, temporarily disable the interrupt. Re-enable the interrupt input when the time-critical function is complete.

Always return from a sub-routine call with the RETURN instruction.

The interrupt input is automatically disabled.

Use the RETURNI instruction to return from an interrupt.

The interrupt vector is always located at the most-significant memory location, where all the address bits are ones. Jump to the interrupt service routine.

UG129_c4_02_051404

Figure 4-2:Example Interrupt Flow

Figure 4-2shows an example program flow during an interrupt event.

1.By default, the INTERRUPT input is disabled. The ENABLE INTERRUPT instruction must execute before the interrupt is recognized.

2.In this example, interrupts are enabled and the PicoBlaze microcontroller is executing the INPUT s1,01 instruction. Simultaneously to executing this instruction, an interrupt arrives on the INTERRUPT input. The PicoBlaze microcontroller does not act on the interrupt until it finishes executing the INPUT s1, 01 instruction.

42

www.xilinx.com

PicoBlaze 8-bit Embedded Microcontroller

 

 

UG129 (v1.1.2) June 24, 2008

Page 42
Image 42
Xilinx UG129 manual 2Example Interrupt Flow