Freescale Semiconductor SC140 specifications Rule L.N.2, Rule L.N.3

Models: SC140

1 760
Download 760 pages 48.94 Kb
Page 279
Image 279

Static Programming Rules

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

d1

 

inc

 

dosetup0

label2

 

doen0

#count2

 

move.w

#num,d2

 

loopstart0

;not allowed

label2

d2

 

inc

 

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

 

 

...

#count2,d6

 

move.w

 

dosetup0 label2

 

doen0

d6

; not allowed

doen1

#2

loopstart0

 

doen1

#5

; allowed

doen1

#6

loopstart1

SC140 DSP Core Reference Manual

7-29

Page 279
Image 279
Freescale Semiconductor SC140 specifications Rule L.N.2, Rule L.N.3, Example 7-49. Nested Loops with Ordered Index