dsp56800e Freescale Semiconductor, Inc, dsp56800e Datasheet - Page 257

no-image

dsp56800e

Manufacturer Part Number
dsp56800e
Description
16-bit Digital Signal Controller Core
Manufacturer
Freescale Semiconductor, Inc
Datasheet
The REP instruction can only be used to repeatedly execute single-word instructions. Repeat looping
cannot be used on:
8.5.2
The DO instruction performs hardware looping on a single instruction or a block of instructions. DO loops
can be nested up to two deep, accelerating more complex algorithms. Unlike REP loops, loops initiated
with DO are interruptible.
Hardware DO looping (DO or DOSLC) executes a block of instructions for the number of specified times.
For a DO instruction, the loop count is specified with a 6-bit unsigned value or 16-bit register value. The
DOSLC instruction works identically to DO, but assumes that the loop count has already been placed in
the LC register.
Example 8-6 demonstrates hardware DO looping on a block of two instructions. This example copies a
block of forty 32-bit memory locations from one area of memory to another.
END_CPY
When a hardware loop is initiated with a DO or DOSLC instruction, the following events occur:
Instructions in the loop are then executed. The address of each instruction is compared to the value in LA
to see if it is the last instruction in the loop. When the end of the loop is reached, the loop count register is
checked to see if the loop should be repeated. If the value in LC is greater than one, LC is decremented and
the loop is re-started from the top. If LC is equal to one, the loop has been executed for the proper number
of times and should be exited.
When a hardware loop ends, the hardware stack is popped (and the popped value is discarded), the LA2
register is copied to LA, the LC2 register is copied to LC, and the NL bit in the operating mode register is
Freescale Semiconductor
1. When the DO instruction is executed, the contents of the LC register are copied to the LC2
2. The old contents of the LA register are copied to the LA2 register, and the LA register is
3. The address of the first instruction in the program loop (top-of-loop address) is pushed onto
An instruction that is more than 1 program word in length.
An instruction that accesses program memory.
A REP or ENDDO instruction.
Any instruction that changes program flow.
A SWI, SWI #x, SWILP, DEBUGEV, DEBUGHLT, WAIT, or STOP instruction.
A Tcc, SWAP SHADOWS, or ALIGNSP instruction.
register, and LC is loaded with the loop count that the instruction specifies. The DOSLC
instruction does not modify the LC and LC2 registers.
loaded with the address of the last instruction word in the loop. If a 16-bit address is
specified, the upper 8 bits of LA are cleared.
the hardware stack. This push sets the LF bit and updates the NL bit, as occurs with any
hardware stack push.
DO Looping
DO
MOVE.L
MOVE.L
#40,END_CPY
X:(R0)+,A
A10,X:(R1)+
Example 8-6. DO Loop Example
; Set up hardware DO loop
; Copy a 32-bit memory location
;
Program Controller
Hardware Looping
8-19

Related parts for dsp56800e