dsp56800e Freescale Semiconductor, Inc, dsp56800e Datasheet - Page 258

no-image

dsp56800e

Manufacturer Part Number
dsp56800e
Description
16-bit Digital Signal Controller Core
Manufacturer
Freescale Semiconductor, Inc
Datasheet
Program Controller
copied to the LF bit. The OMR's NL bit is then cleared. Instruction execution then continues at the address
that immediately follows the end-of-loop address.
One hardware stack location is used for each nested DO or DOSLC loop. Thus, a two-deep hardware stack
allows for a maximum of two nested loops. The REP instruction does not use the hardware stack, so repeat
loops can be nested within DO loops.
8.5.3
If a loop count of zero is specified for the DO instruction, or if a zero or negative loop count is specified for
DOSLC, the instructions in the body of the loop are skipped, and execution continues with the instruction
immediately following the loop body. An example of this process appears in Example 8-7.
END_CPY
Note that an immediate loop count of zero (for the DO instruction) is not allowed and will be rejected by
the assembler. A loop count of zero can only be specified by using a register that is loaded with zero as the
argument to the DO instruction, or by placing a zero in the LC register and executing DOSLC.
8.5.4
A DO loop normally terminates when the body of the loop has been executed for the specified number of
times (the end of the loop has been reached, and LC is one). Alternately, a DO loop terminates if the count
specified is zero. Similarly, if the LC register is zero or negative, a DOSLC loop will also terminate, which
causes the body of the loop to be skipped entirely.
When the inner loop of a nested loop terminates naturally, the LA2 and LC2 registers are copied into the
LA and LC registers, respectively, restoring these two registers with their values for the outer loop. A loop
is determined to be a nested inner loop if the OMR’s NL bit is set. If the NL bit is not set, the LA and LC
registers are not modified when a loop is terminated or skipped.
If it is necessary to terminate a DO loop early, use one of the techniques discussed in Section 8.5.4.1,
“Allowing Current Block to Finish and Then Exiting,” and Section 8.5.4.2, “Immediate Exit from a
Hardware Loop.”
8.5.4.1
One method for terminating a DO loop is to modify the loop counter register so that the remainder of the
instructions in the loop are executed, but so that the loop does not return to the top of the loop. This
modification can be accomplished through explicitly setting the value in LC to one:
Because the loop is allowed to complete, the hardware stack will be popped, and the internal looping state
will be reset correctly.
8-20
MOVEU.W #1,LC
Specifying a Loop Count of Zero
Terminating a DO Loop
MOVE.W
.
.
.
DO
MOVE.L
MOVE.L
Allowing Current Block to Finish and Then Exiting
#0,X0
X0,END_CPY
X:(R0)+,A
A10,X:(R1)+
Example 8-7. DO Loop Special Case
DSP56800E Core Reference Manual
; Loop count is zero upon entry
; Copy a 32-bit memory location
;
Freescale Semiconductor

Related parts for dsp56800e