Freescale Semiconductor SC140 Loop Control Instructions, lists the loop instructions

Models: SC140

1 760
Download 760 pages 48.94 Kb
Page 209
Image 209

Hardware Loops

5.4.6 Loop Control Instructions

Table 5-10 lists the loop instructions.

Table 5-10. Loop Control Instructions

Instruction

Operation

 

 

 

 

DOSETUPn <label>

Initialize register SAn with <label> address.

 

Used only in long loops.

 

 

DOENn (reg or imm)

Activate loop n as a long loop. Performs the

 

following operations:

 

• Initializes LCn

 

• Sets LFn in the SR

 

 

DOENSHn (reg or imm)

Activate loop n as a short loop. Performs the

 

following operations:

 

• Initializes LCn

 

• Sets LFn and SLF in the SR

 

 

SKIPLS <label>

If LCn <= 0, jumps to <label>, clearing LFn.

 

 

CONT <label>

Within an active loop, if LC > 1, jumps to SAn and

 

decrements LCn. If LC <= 1 jumps to <label> and

 

clears the LCn register as well as LFn.

 

 

CONTD <label>

Provides a delayed version of the CONT

 

instruction.

 

 

BREAK <label>

Within an active loop, jumps to <label> and clears

 

LFn.

 

 

The instructions that activate the loop are either DOENn or DOENSHn. In nested loops, DOENn or DOENSHn must be re-executed in order to re-activate the inner loops. In other words, the DOENn or DOENSHn instruction for an inner loop must be contained in its corresponding outer loop. DOSETUPn is only used to initialize SAn in long loops and need not be re-executed if the value of the SAn register is unchanged. In short loop initialization, DOSETUPn is not needed at all. The instructions SKIPLS, CONT, and BREAK (along with their variants) are optional, to be used only if needed.

The above instructions are assembled from source mnemonics in the conventional way. They are also disassembled normally. In addition, looping bits are encoded in the instruction prefix. When coding a hardware loop in assembly, two loop-related assembly directives must be used to set the LPMARKA and LPMARKB bits as follows:

LOOPSTARTn — Placed immediately before SA.

LOOPENDn — Placed immediately after LA.

By definition, a loop body n is enveloped by the LOOPSTARTn and LOOPENDn directives.

In disassembled code, the LOOPSTART and LOOPEND directives are not available. The start address information is encoded as an offset in the DOSETUPn instruction for long loops, or in the LPMARK prefix bits for short loops. The last address information is encoded in the LPMARK prefix bits for long loops. The assembler normally places the LPMARKB bit at LA-2. For special cases, such as a SKIPLS

SC140 DSP Core Reference Manual

5-29

Page 209
Image 209
Freescale Semiconductor SC140 specifications Loop Control Instructions, lists the loop instructions, Instruction Operation