Texas Instruments MSP50C6xx Calculator User Manual


 
Hardware Loop Instructions
4-54
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 442. Hardware Loops in MSP50P614/MSP50C614
Syntax Operation Limitations
RPT imm8 | {adrs}
8
{repeatable instruction}
{repeatable instruction} is executed n
R
+2 times, where n
R
is
the value in repeat counter. If the instruction following RPT is a
string instructions, then string length used will be n
R
, 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.
0 n
R
255
{STR= n
S
}
{string instruction}
String length for the {string instruction} is n
S
+2. All interrupts
are queued during loop execution. Queued interrupts are
processed according to priority after the completion of the
{string instruction}. The maximum accumulator string length is
32, i.e., 0 n
S
29.
0 n
S
255
NOTE: 0 n
S
29
for accumulator
strings.
{R4= N
LOOP
}
BEGLOOP
{...body of loop...}
ENDLOOP
The number of times the {...body of loop...} is executed is
N
LOOP
+2. All interrupts are queued during loop execution.
Queued interrupts are processed according to priority after the
completion of the BEGLOOP/ENDLOOP block.
0 N
LOOP
32767