Freescale Semiconductor SC140 Example 5-12. Long Loop, Example 5-13. Long Loop Disassembly

Models: SC140

1 760
Download 760 pages 48.94 Kb
Page 210
Image 210

Hardware Loops

instruction to the last address, the LPMARKA bit will be placed at LA in addition to the LPMARKB bit at LA-2. In nested loops, if the LPMARKA and LPMARKB bits occur in the same execution set, the LPMARKA bit belongs to the inner loop, and the LPMARKB bit belongs to the outer loop.

The following is an example of a long loop.

Example 5-12. Long Loop

 

 

 

 

 

dosetup0 _start0

Initializes SA0 with address

 

 

 

 

 

doen0

#$10

 

corresponding to _start0

 

 

 

 

 

 

Activates loop0, puts 16 into LC0,

 

 

 

 

 

move.w

(r3)+,d1

sets LF0

 

 

 

 

 

 

 

Puts data into d1

 

 

 

 

 

 

 

skipls

_end0

 

Skips loop if LC0 = 0

SA

 

_start0

loopstart0

 

Assembler directive denoting loopstart

 

mac

d0,d1,d2

move.w (r0)+,d0

 

 

 

Loop body

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

add

d5,d6,d4

move.w (r1)+,d5

 

 

 

 

 

 

 

 

sub

d3,d2,d4

inc d5

 

 

 

 

 

 

LPMARKB

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

mac

d0,d1,d6

move.w (r0)+,d7

 

 

 

 

 

LA

 

 

sub

d5,d4,d4

inc d7

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

_end0

loopend0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Example 5-13 shows the disassembly of the long loop in Example 5-12.

Example 5-13. Long Loop Disassembly

p:$00380000 2803 800c

= dosetup0 *+$c

p:$00380004 9050

 

= doen0 #<$10

p:$00380006 511b

801a

= move.w (r3)+,d1

p:$00380008 2103

= skipls >*+$1a

p:$0038000c 2111

5018

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

p:$00380010

2e5a

5519

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

p:$00380014

94d0

6e3d 66ef = lpmarkb sub d3,d2,d4 inc d5

p:$0038001a

2311

5718

= mac d0,d1,d6 move.w (r0)+,d7

p:$0038001e

2e35

67ef

= sub d5,d4,d4 inc d7

The following is an example of a short loop in two execution sets.

Example 5-14. Short Loop, Two Execution Sets

doensh0#$10

...

loopstart0

SA

 

 

mac

d0,d1,d2

move.w (r0)+,d0

LA

 

 

add

d5,d6,d4

move.w (r1)+,d5

 

loopend0

LPMARKB

Loop body

5-30

SC140 DSP Core Reference Manual

Page 210
Image 210
Freescale Semiconductor SC140 specifications Example 5-12. Long Loop, Example 5-13. Long Loop Disassembly