Program Sequencing
3.4
BRANCHES (CALL, JUMP, RTS, RTI)
The CALL instruction initiates a subroutine. Both jumps and calls transfer
program flow to another memory location, but a call also pushes a return
address onto the PC stack so that it is available when a return from
subroutine instruction is later executed. Jumps branch to a new location
without allowing return.
A return causes the processor to branch to the address stored at the top of
the PC stack. There are two types of returns: return from subroutine (RTS)
and return from interrupt (RTI). The difference between the two is that the
RTI instruction not only pops the return address off the PC stack, but also:
1) pops the status stack if the ASTAT and MODE1 status registers have
been pushed (if the interrupt was
vector interrupt), and 2) clears the appropriate bit in the interrupt latch
register (IRPTL) and the interrupt mask pointer (IMASKP).
There are a number of parameters you can specify for branches:
• Jumps, calls and returns can be conditional. The program sequencer can
evaluate any one of several status conditions to decide whether the
branch should be taken. If no condition is specified, the branch is
always taken.
• Jumps and calls can be indirect, direct, or PC-relative. An indirect branch
goes to an address supplied by one of the data address generators,
DAG2. Direct branches jump to the 24-bit address specified in an
immediate field in the branch instruction. PC-relative branches also use a
value specified in the instruction, but the sequencer adds this value to
the current PC value to compute the destination address.
• Jumps, calls and returns can be delayed or nondelayed. In a delayed
branch, the two instructions immediately after the branch instruction
are executed; in a nondelayed branch, the program sequencer suppresses
the execution of those two instructions (NOPs are performed instead).
• The JUMP (LA) instruction causes an automatic loop abort if it occurs
inside a loop. When the loop is aborted, the PC and loop address stacks
are popped once, so that if the loop was nested, the stacks still contain
the correct values for the outer loop. JUMP (LA) is similar to the break
instruction of the C programming language used to prematurely
terminate execution of a loop. (Note: JUMP (LA) may not be used in the
last three instructions of a loop.)
www.BDTIC.com/ADI
IRQ
, the timer interrupt, or the VIRPT
2-0
3
3 – 9
Need help?
Do you have a question about the ADSP-2106x SHARC and is the answer not in the manual?
Questions and answers