Nested loops with ordered index -29, Nested doenn/doenshn instructions -29, Rule l.n.2 – Freescale Semiconductor StarCore SC140 User Manual

Page 279: Rule l.n.3

Advertising
background image

Static Programming Rules

SC140 DSP Core Reference Manual

7-29

Rule L.N.2

A loop body n must be surrounded by the LOOPSTARTn and LOOPENDn assembly directives, and can
only be nested inside a loop body having a smaller index.

Example 7-49. Nested Loops with Ordered Index

doen1 #count1
move.w #num,d1
move.l #mem_l,r1
move.w #offset,n0

loopstart1

label1

inc d1
dosetup0 label2
doen0 #count2
move.w #num,d2

loopstart0

;not allowed

label2

inc d2
impyuu d1,d2,d3
move.w d3,(r1)+
loopend0

nop
loopend1

Rule L.N.3

A DOENn/DOENSHn instruction having a different loop index and any LOOPEND directive cannot come
between the DOENn/DOENSHn instruction and LOOPSTARTn directive of loop n.

Also, it is not allowed to place a DOENSH instruction with any index between the DOENn and its
respective LOOPSTARTn directive, or a DOEN instruction with any index between the DOENSHn
instruction and its respective LOOPSTARTn directive.

Example 7-50. Nested DOENn/DOENSHn Instructions

count2 equ 5

...
move.w #count2,d6
dosetup0 label2
doen0 d6
doen1 #2

; not allowed

loopstart0
doen1 #5
doen1 #6

; allowed

loopstart1

Advertising