Hardware Loops
4-28
ADSP-BF53x/BF56x Blackfin Processor Programming Reference
To avoid unnecessary penalty cycles, the loop hardware follows these
rules:
• Restoring
LC0
and
LC1
registers always re-initializes the loop hard-
ware and causes a ten-cycle “replay” penalty.
• Restoring
LT0
,
LT1
,
LB0
, and
LB1
performs in a single cycle if the
respective loop counter register is zero.
• If
LCx
is non-zero, every write to the
LTx
and
LBx
registers also
attempts to re-initialize the loop hardware and causes a ten-cycle
penalty.
In terms of performance, there is a difference depending on the order that
the loop registers are popped. For best performance, restore the
LCx
regis-
ters last. Furthermore, it is recommended that interrupt service routines
and global subroutines that contain hardware loops terminate their local
loops cleanly, that is, do not artificially break the loops and do not execute
return instructions within their loops. This guarantees that the
LCx
regis-
ters are 0 when
LTx
and
LBx
registers are popped.
Example Code for Using Hardware Loops in an ISR
The following code shows the optimal method of saving and restoring
when using hardware loops in an interrupt service routine.
Listing 4-2. Saving and Restoring With Hardware Loops
lhandler
:
<Save other registers here>
[--SP] = LC0; /* save loop 0 */
[--SP] = LB0;
[--SP] = LT0;
<Handler code here>
Summary of Contents for ADSP-BF53x Blackfin
Page 38: ...Conventions xxxviii ADSP BF53x BF56x Blackfin Processor Programming Reference...
Page 134: ...System Reset and Powerup 3 18 ADSP BF53x BF56x Blackfin Processor Programming Reference...
Page 324: ...Instruction Overview 7 20 ADSP BF53x BF56x Blackfin Processor Programming Reference...
Page 486: ...Instruction Overview 13 28 ADSP BF53x BF56x Blackfin Processor Programming Reference...
Page 512: ...Instruction Overview 14 26 ADSP BF53x BF56x Blackfin Processor Programming Reference...
Page 604: ...Instruction Overview 15 92 ADSP BF53x BF56x Blackfin Processor Programming Reference...
Page 688: ...Instruction Overview 18 48 ADSP BF53x BF56x Blackfin Processor Programming Reference...
Page 742: ...Instruction Overview 19 54 ADSP BF53x BF56x Blackfin Processor Programming Reference...
Page 752: ...Examples 20 10 ADSP BF53x BF56x Blackfin Processor Programming Reference...
Page 790: ...ADSP BF535 Flags A 10 ADSP BF53x BF56x Blackfin Processor Programming Reference...
Page 800: ...Performance Monitor Registers B 10 ADSP BF53x BF56x Blackfin Processor Programming Reference...
Page 1042: ...Index I 40 ADSP BF53x BF56x Blackfin Processor Programming Reference...