Figure 1. rtsd
Description
Return from subroutine will branch to the location specified by the contents of rAX plus the sign-extended IMM field.
This instruction always has a delay slot. The instruction following the RTSD is always executed before the branch target.
Pseudocode
PC ← (rAX) + sext(IMM)
allow following instruction to complete execution
Registers Altered
- PC
Latency
- 1 cycle (if successful branch prediction occurs)
- 2 cycles (with Branch Target Cache disabled and
C_AREA_OPTIMIZED
≠2) - 3 cycles (if branch prediction mispredict occurs with
C_AREA_OPTIMIZED
=0) - 6 cycles (with Branch Target Cache disabled and
C_AREA_OPTIMIZED
=2) - 7 cycles (if branch prediction mispredict occurs with
C_AREA_OPTIMIZED
=2)
If C_USE_MMU
> 1 two additional cycles are added with
C_AREA_OPTIMIZED
=2.
Notes
- Convention is to use general purpose register r15 as rAX.
- A delay slot must not be used by the following: imm, branch, or break instructions. Interrupts and external hardware breaks are deferred until after the delay slot branch has been completed.