English
Language : 

SH7713 Datasheet, PDF (121/904 Pages) Renesas Technology Corp – Renesas 32-Bit RISC Microcomputer SuperHTM RISC engine Family / SH7700 Series
Section 3 DSP Operating Unit
• Example 4: Repeat loop consisting of one instruction
LDRS RptStart +8
; Sets (repeat detection instruction
address + 8) to the RS register
LDRE RptStart +4
; Sets (repeat detection instruction
address + 4) to the RE register
SETRC #4
; Sets the number of repetitions (4) to
the RC[11:0] bits of the SR register
; If RE-RS==-4 during SETRC instruction
execution, the repeat loop is regarded
as one-instruction repeat.
RptDtct: instr0
; An instruction prior to the Repeat
start instruction is regarded as a
repeat detection instruction.
RptStart:
RptEnd: instr1
; [Repeat start instruction] ==
[Repeat end instruction]
In repeat loops consisting of three instructions, two instructions and one instruction, specific
addresses are specified in the RS register. RE – RS is calculated during SETRC instruction
execution, and the number of instructions included in the repeat loop is determined according to
the result. A value of 0, –2,and –4 in the result correspond to 3 instructions, two instructions, and
one instruction, respectively.
If repeat instruction execution is completed without branching and if RC[11:0]>0, an instruction
following the repeat detection instruction is regarded as a repeat start instruction and instruction
execution is repeated for the number of times corresponding to the recognized number of
instructions. If RC[11:0] ≥ 2 when the repeat end instruction is completed, the RC[11:0] is
decremented by 1 and then control is passed to the address specified by the RS register. If
RC[11:0] ==1(or 0) when the repeat end instruction is completed, the RC[11:0] is cleared to 0 and
then the control is passed to the next instruction following the repeat end instruction.
Note:
If RE – RS is a positive value, the CPU regards the repeat loop as a four-instruction repeat
loop. (In a repeat loop consisting of four or more instructions, RE – RS is always a
positive value. For details, refer to example 1 above.) If RE – RS is positive, or a value
other than 0, –2,and –4, correct operation cannot be guaranteed.
Rev.1.50 Aug. 30, 2006 Page 81 of 860
REJ09B0288-0150