Repeat-mode control bits, Repeat-mode operation – Texas Instruments TMS320C3x User Manual

Page 187

Advertising
background image

Repeat Modes

7-3

Program Flow Control

7.1.1

Repeat-Mode Control Bits

Two bits are important to the operation of RPTB and RPTS:

-

RM bit. The repeat-mode (RM) flag bit in the status register specifies
whether the processor is running in the repeat mode.

J

RM = 0: Fetches are not made in repeat mode.

J

RM = 1: Fetches are made in repeat mode.

-

S bit. The S bit is internal to the processor and cannot be programmed,
but this bit is necessary to fully describe the operation of RPTB and RPTS.

J

If RM = 1 and S = 0, RPTB is executing. Program fetches occur from
memory.

J

If RM = 1 and S = 1, RPTS is executing. After the first fetch from
memory, program fetches occur from the instruction register.

7.1.2

Repeat-Mode Operation

Information in the repeat-mode registers and associated control bits controls
the modification of the PC during repeat-mode fetches. The repeat modes
compare the contents of the RE register (repeat-end-address register) with the
PC after the execution of each instruction. If they match and the repeat counter
(RC) is nonnegative, the RC is decremented; the PC is loaded with the repeat-
start-address, and the processing continues. The fetches and appropriate
status bits are modified as necessary. Note that the RC is never modified
when the RM flag is 0.

The repeat counter should be loaded with a value 1 less than the number of
times to execute the block; for example, an RC value of 4 executes the block
five times. The detailed algorithm for the update of the PC is shown in
Example 7–1.

Note:

Maximum Number of Repeats

1) The maximum number of repeats occurs when RC = 8000 0000h. This

results in 8000 0001h repetitions. The minimum number of repeats occurs
when RC = 0. This results in one repetition.

2) RE must be greater than or equal to RS (RE

RS). Otherwise, the code

does not repeat even though the RM bit remains set to 1.

3) By writing a 0 into the repeat counter or writing 0 into the RM bit of the

status register, you can stop the repeating of the loop before completion.

Advertising