beautypg.com

Long loop -30, Long loop disassembly -30, Short loop, two execution sets -30 – Freescale Semiconductor StarCore SC140 User Manual

Page 210

background image

5-30

SC140 DSP Core Reference Manual

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

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

Example 5-13. Long Loop Disassembly

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

Example 5-14. Short Loop, Two Execution Sets

dosetup0

_start0

Initializes SA0 with address

corresponding to _start0

doen0 #$10

Activates loop0, puts 16 into LC0,

sets LF0

move.w

(r3)+,d1

Puts data into d1

skipls

_end0

Skips loop if LC0 = 0

loopstart0

Assembler directive denoting loopstart

_start0

mac

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

add

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

sub

d3,d2,d4

inc d5

mac

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

sub

d5,d4,d4 inc

d7

loopend0

_end0

Loop body

SA

LA

LPMARKB

p:$00380000 2803 800c

= dosetup0 *+$c

p:$00380004 9050

= doen0 #<$10

p:$00380006 511b

= move.w (r3)+,d1

p:$00380008 2103 801a

= 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

doensh0#$10

...

loopstart0

mac

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

add

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

loopend0

Loop body

LPMARKB

LA

SA