Xilinx UG129 Answering Machine User Manual


 
PicoBlaze 8-bit Embedded Microcontroller www.xilinx.com 107
UG129 (v1.1.2) June 24, 2008
RETURNI [ENABLE/DISABLE] — Return from Interrupt Service Routine and Enable or Disable
R
PBlazIDE Equivalent: RET, RET C, RET NC, RET Z, RET NZ
RETURNI [ENABLE/DISABLE] — Return from Interrupt Service
Routine and Enable or Disable Interrupts
The RETURNI instruction is a special variation of the RETURN instruction. It concludes an
interrupt service routine. The RETURNI instruction is unconditional and pops the return
address from the top of the CALL/RETURN stack into the PC. The return address points
to the instruction preempted by an Interrupt Event. The RETURNI instruction restores the
CARRY and ZERO flags to the values preserved by the Interrupt Event.
The ENABLE or DISABLE operand defines whether the INTERRUPT input is re-enabled
or remains disabled when returning from the interrupt service routine (ISR).
Example
RETURNI ENABLE; Return from interrupt, re-enable interrupts
RETURNI DISABLE; Return from interrupt, leave interrupts disabled
Pseudocode
; pop the top of the CALL/RETURN stack into PC
PC Å TOS
; restore the flags to their pre-interrupt values
CARRY Å PRESERVED_CARRY
ZERO Å PRESERVED_ZERO
; if “ENABLE” specified, re-enable interrupts
if (ENABLE = TRUE) then
INTERRUPT_ENABLE Å 1
else
INTERRUPT_ENABLE Å 0
endif
Registers/Flags Altered
Registers: PC, CALL/RETURN stack
Flags: CARRY, ZERO, INTERRUPT_ENABLE
Notes
Do not use the RETURNI instruction to return from a subroutine CALL. Instead, use the
RETURN instruction.
PBlazIDE Equivalent: RETI ENABLE, RETI DISABLE