Rpts instruction – Texas Instruments TMS320C3x User Manual

Page 189

Advertising
background image

Repeat Modes

7-5

Program Flow Control

All block repeats initiated by RPTB can be interrupted. When RPTB

src

(source) instruction executes, it performs the following sequence:

1) Load the start address of the block into repeat-start-address register (RS).

This is the next address following the instruction:

RS

z

PC (program-counter) of RPTB + 1

2) Load the end address of the block into repeat-end-address register (RE).

-

In PC-relative mode, the end address is the 24-bit

src operand plus

RS:

RE

z

src + PC of RPTB + 1

-

In register mode, the end address is the contents of the

src register:

RE

z

src register

3) Set the status register to indicate the repeat-mode operation.

RM

z

1

4) Indicate repeat-mode operation by clearing the S bit.

S

z

0

Note:

You can stop the loop from repeating before its completion by writing a 0 to
the repeat counter or writing a 0 to the RM bit of the status register.

7.1.4

RPTS Instruction

An RPTS

src instruction repeats the instruction following the RPTS (src + 1)

times. Repeats of a single instruction initiated by RPTS are not interruptible,
because the RPTS fetches the instruction word only once and then keeps it
in the instruction register for reuse. An interrupt in this situation would cause
the instruction word to be lost. Refetching the instruction word from the instruction
register reduces memory accesses and, in effect, acts as a one-word program
cache. If you need a single instruction that is repeatable and interruptible, you can
use the RPTB instruction.

When RPTS

src is executed, the following sequence of operations occurs:

1) PC + 1

RS

2) PC + 1

RE

3) 1

RM status register bit

4) 1

S bit

5)

src

RC (repeat

count register)

Advertising