Hardware Loop Instructions

the execution of a string instruction, interrupts are queued. Queued interrupts are serviced according to their priority after the string operation is complete.

In addition to repeat and string instructions, the combination of repeated string instructions has a very useful function. Since there is only one counter to control the hardware repeat count, it is not possible to nest repeats and strings. When a repeat instruction is followed by a string instruction the string register count is replaced by the value in the preceding repeat instruction. This offers greater utility in some programs and avoids load and store operations on the string register.

Loop Instructions: This is a software loop with an explicit reference to R4. The beginning of the loop is marked with the BEGLOOP instruction which pushes the next sequential address to a temporary register. A second instruction, ENDLOOP, marks the end of the loop. When executed, ENDLOOP loads the temporary register to the program counter if R4 is positive and then post decrements R4. If R4 is negative, the program counter executes a NOP instruction and exits the loop. Since interrupts are queued during the execution of the loop, no provision for saving the contents of the temporary register is made. Interrupts, if enabled before the execution of BEGLOOP, will automatically be re-enabled after exiting the loop. Enabling interrupts inside the loop have no effect. Queued interrupts are processed according to their priority after the loop exits provided the corresponding interrupt is enabled. The loop overhead is 1 instruction cycle per loop cycle, ideal for repeating high priority repeated blocks in DSP routines.

Table 4–42. Hardware Loops in MSP50P614/MSP50C614

Syntax

Operation

Limitations

 

 

 

 

 

RPT imm8 {adrs}8

{repeatable instruction} is executed nR+2 times, where nR is

0

nR

255

{repeatable instruction}

the value in repeat counter. If the instruction following RPT is a

 

 

 

 

string instructions, then string length used will be nR, not the

 

 

 

 

value in the STR register. All interrupts are queued during loop

 

 

 

 

execution. Queued interrupts are processed according to

 

 

 

 

priority after the completion of the RPT loop.

 

 

 

 

 

 

 

 

{STR= nS}

String length for the {string instruction} is nS+2. All interrupts

0

nS

255

{string instruction}

are queued during loop execution. Queued interrupts are

NOTE: 0 nS 29

 

processed according to priority after the completion of the

for accumulator

 

{string instruction}. The maximum accumulator string length is

strings.

 

 

32, i.e., 0 nS 29.

 

 

 

{R4= NLOOP}

The number of times the {...body of loop...} is executed is

0

NLOOP 32767

BEGLOOP

NLOOP+2. All interrupts are queued during loop execution.

 

 

 

{...body of loop...}

Queued interrupts are processed according to priority after the

 

 

 

ENDLOOP

completion of the BEGLOOP/ENDLOOP block.

 

 

 

 

 

 

 

 

4-54

Page 140
Image 140
Texas Instruments MSP50C6xx manual Hardware Loops in MSP50P614/MSP50C614, Syntax Operation Limitations