dsp56800e Freescale Semiconductor, Inc, dsp56800e Datasheet - Page 256

no-image

dsp56800e

Manufacturer Part Number
dsp56800e
Description
16-bit Digital Signal Controller Core
Manufacturer
Freescale Semiconductor, Inc
Datasheet
Program Controller
The state of the NL and LF bits can be used to determine the status of program looping and thus of the
hardware stack, as shown in Table 8-5. To ensure the integrity of the hardware stack values, make certain
that a program never puts the processor in the illegal state that this table specifies. Avoid this illegal state
by ensuring that the LF bit is never explicitly cleared when the NL bit is set.
If both the NL and LF bits are set (that is, two DO loops are active) and a DO or DOSLC instruction (or a
write to HWS) is executed, a hardware stack overflow interrupt occurs because there is no more space on
the hardware stack to support a third DO loop. There is no interrupt on hardware stack underflow.
8.5
Loops are one of the most common software constructs, especially in DSC algorithms. In order to speed up
these critical algorithms, the core includes special hardware to accelerate loops. Two types of
hardware-accelerated loops are supported: fast repetition of a single instruction a specified number of
times, using the REP instruction; and more traditional multi-instruction loops, using the DO and DOSLC
instructions.
8.5.1
Repeat looping, using the REP instruction, executes a single 1-word instruction a number of times. The
number of times the instruction should be repeated is specified by the parameter to the REP instruction,
which is either a 6-bit immediate or 16-bit register value. The instruction that is to be repeated is the one
that immediately follows REP.
Example 8-5 demonstrates repeat looping on the move instruction. In this example, 64 words are cleared in
data memory, 2 words at a time.
The instruction that is to be repeated (MOVE.L in this case) is fetched only once from program memory.
Until the repeat loop is complete, the program counter is frozen and interrupts are disabled. If a repeat loop
must be interruptible, a DO loop should be used instead. See Section 8.5.2, “DO Looping.”
The repeat count that is specified in the REP instruction must be a positive value. If the count specified is
zero, the instruction following REP is skipped, and execution continues with the subsequent instruction.
8-18
NL
0
0
1
1
Hardware Looping
Repeat (REP) Looping
MOVE.W
REP
MOVE.L
#0,A
#32
A10,X:(R0)+
LF
0
1
0
1
Example 8-5. Repeat Loop Example
DSP56800E Core Reference Manual
Table 8-5. Hardware Stack Status
; Clear the A Accumulator
; Set up hardware repeat of the following instruction
; Clear 2 words in memory
Single DO loop active
Two DO loops active
No DO loops active
DO Loop Status
(Illegal)
# Words of Hardware Stack
Freescale Semiconductor
0
1
2

Related parts for dsp56800e