Hardware Loops

The following is an example of a short loop in one execution set.

Example 5-15. Short Loop, One Execution Set

doensh0#$10

...

loopstart0

SA, LA mac d0,d1,d2 move.w (r0)+,d0 loopend0

Loop body

LPMARKA

The following is an example of a nested loop.

Example 5-16. Nested Loop

SA

_start0 loop 0

dosetup0

_start0

 

dosetup1

_start1

 

doen0

#$10

 

...

 

 

loopstart0

 

 

bmset

#$ff01,d0

 

doen1

d7

Loop

clr

d2

body

skipls

_end1

1

loopstart1

 

 

Loop body 0

SA

loop 1

_start1

 

mac d0,d1,d2 move.w (r0)+,d0

 

add d5,d6,d4 move.w (r1)+,d5

loop 1

LA

LA

loop 1

 

loop 0

sub d3,d2,d4 inc d5

 

 

 

 

 

loop 0

 

mac d4,d5,d6 move.w (r0)+,d4

 

 

 

 

add d3,d4,d6 move.w (r1)+,d3

 

 

 

loopend1

 

 

 

loop 0

 

_end1 inc

d0

 

 

 

 

 

 

 

 

loopend0 _end0

LPMARKB LPMARKB

LPMARKA

In Example 5-16, the LPMARKA bit of loop 0 is set because the SKIPLS instruction can skip over the LPMARKB bit of loop 0.

The assembler sets the appropriate LPMARK bits, adding a prefix word with the loopstart or loopend information, if necessary. In disassembly, these LPMARK bits (if used) appear preceding the normal disassembled mnemonics of the set.

SC140 DSP Core Reference Manual

5-31

Page 211
Image 211
Freescale Semiconductor SC140 Following is an example of a nested loop, Example 5-15. Short Loop, One Execution Set