Instruction Set ArchitectureIP2022 Users Manual
194
www.ubicom.com
RET
Return from Subroutine
Operation:
program counter = top-of-stack
Bits affected:
None
Opcode:
0000 0000 0000 0111
Description:
This instruction causes a return from a
subroutine. It pops the 16-bit value previously
stored on the stack and restores that value to the
program counter. This causes the program to
jump to the instruction immediately following the
call instruction that called the subroutine. The
hardware stack used for subroutine call and
return is independent from the stack used with the
push and pop instructions.
It is not necessary to set the PA2:0 bits in the
STATUS register to return to the correct place in
the program. This is because the full 16-bit
program address is restored from the stack. The
ret instruction does not use (and does not
affect) the PA2:0 bits.
Cycles:
3