R

Appendix : PicoBlaze Instruction Set and Event Reference

INTERRUPT Event, When Enabled

The interrupt event is not an instruction but the response of the PicoBlaze microcontroller to an external interrupt input. If the INTERRUPT_ENABLE flag is set, then a recognized logic level on the INTERRUPT input generates an Interrupt Event. The action essentially generates a subroutine CALL to the most-significant instruction address, location 1023 ($3FF). The currently executing instruction is allowed to complete. Once the PicoBlaze microcontroller recognizes the interrupt input, the INTERRUPT_ENABLE flag is automatically reset. The next instruction in the normal program flow is preempted by the Interrupt Event and the current PC is pushed onto the CALL/RETURN stack. The PC is loaded with all ones and the program calls the instruction at the most-significant address.

The instruction at the most-significant address must jump to the interrupt service routine (ISR).

Pseudocode

;only respond to INTERRUPT input if INTERRUPT_ENABLE flag is set if ( (INTERRUPT_ENABLE = 1)and (INTERRUPT input = High) ) then

;clear the INTERRUPT_ENABLE flag

INTERRUPT_ENABLE Å 0

;push the current program counter (PC) to the stack

;TOS = Top of Stack

TOS Å PC

;preserve the current CARRY and ZERO flags

PRESERVED_CARRY Å CARRY PRESERVED_ZERO Å ZERO

;load program counter (PC) with interrupt vector ($3FF) PC Å $3FF

endif

Registers/Flags Altered

Registers: PC, CALL/RETURN stack

Flags: CARRY, ZERO, INTERRUPT_ENABLE

Notes

The PicoBlaze microcontroller asserts the INTERRUPT_ACK output on the second CLK cycle of the two-cycle Interrupt Event, as shown in Figure 4-3, page 43. This signal is optionally used to clear any hardware interrupt flags.

The programmer must ensure that a RETURNI instruction is only performed in response to a previous interrupt. Otherwise, the PC stack may not contain a valid return address.

Do not use the RETURNI instruction to return from a subroutine CALL. Instead, use the RETURN instruction.

Because an interrupt event may happen at any time, the values of the CARRY and ZERO flags cannot be predetermined. Consequently, the corresponding Interrupt Service Routine (ISR) must not depend on specific values for the CARRY and ZERO flags.

100

www.xilinx.com

PicoBlaze 8-bit Embedded Microcontroller

 

 

UG129 (v1.1.2) June 24, 2008

Page 100
Image 100
Xilinx UG129 manual Interrupt Event, When Enabled