6-10
SC140 DSP Core Reference Manual
Instruction Set Overview
Conditional change-of-flow instructions (JT/JF/BT/BF) require four cycles to execute (if taken), and
one cycle to execute (if not taken).
The return address of subroutines is kept in an internal return address register (RAS) in addition to
being pushed to the stack. This saves the need to read it from the stack upon return. However, this
shadow register is not valid if there was another jump to a subroutine before the return, in which case,
the core adds two cycles to the RTS instruction to read the return address from the stack.
The core keeps a shadow version of SP-8 to save pre-calculation time in case of a POP. If SP was
explicitly changed by a TFRA or an AGU arithmetic instruction, the shadow SP is not valid and
another cycle is needed for the first POP pre-calculation (or equivalent, such as RTE).
A change-of-flow instruction (jump, branch, interrupt, or long loop jump-back) made to an execution
set destination that is spread over two fetch sets, requires an additional cycle for memory access. An
execution set is not necessarily aligned to a fetch set, and can overlap two fetch sets. The core keeps
two fetch sets in a buffer, so this is not normally a problem. However, when a change-of-flow occurs
to a new execution set spread over two fetch sets, two new fetches are needed.
The subroutine call instructions (JSR, JSRD, BSR, and BSRD) need one free cycle in order to push
the return PC and SR onto the stack. Normally, a subroutine call instruction uses one of the idle
cycles while the pipeline is filling up so that no stall occurs. However, one stall cycle is added if the
instructions that execute in parallel with the subroutine call instruction need more cycles than a
specific number. In essence, an additional cycle is added to a subroutine call instruction when
(C
jn
+ C
d
)
≥
C
j
where:
— C
jn
Highest cycle count of instructions grouped with CALL
— C
j
Cycle count of the non-delayed version of CALL (for example, BSR and BSRD, C
j
= 4)
— C
d
Cycle count of the set in the delayed slot (if CALL is not a delayed instruction, C
d
= 0)
Example 6-5 shows a case when a stall cycle is added.
Example 6-5. Subroutine Call Timing
JSRD _subr
ADDA R0,R1
MOVE.W (R0+2),D0
; C
j
= 3, C
jn
= 2
; C
d
= 1
Table 6-2 summarizes the cycle count for change-of-flow instructions. In the Number of Cycles column,
C
d
represents the length of the delay slot in cycles. The technique of subtracting the cycles of the delay slot
instructions from the cycle count of the delayed change-of-flow instruction assumes that the delay slot
instructions cycles are counted separately. The net count should be zero since the instructions are “hidden”
in the delay slot. The minimum number of cycles is specified for the delayed instructions, but only when
the number of cycles is small enough for the minimum number of cycles to actually occur. If no number
appears in the Minimum Number of Cycles column, the equation in the Number of Cycles column applies,
with no minimum.
Table 6-2. Number of Cycles Needed by Change-of-Flow Instructions
Instruction
Number of
Cycles
Minimum Number
of Cycles
Condition
JMP
3
JMPD
3 – C
d
1
JSR
3
4
C
jn
< 3
C
jn
≥
3