3.3.15.1 REPEAT Loop Construct
The REPEAT instruction causes the instruction that follows it to be repeated a specified number of times. A literal value contained in the instruction, or a value in one of the W registers, can be used to specify the REPEAT count value. The W register option enables the loop count to be a software variable.
An instruction in a REPEAT loop is executed at least once. The number of iterations for a REPEAT loop is the 20-bit literal value + 1 or Wn + 1. The syntax for the two forms is shown in REPEAT Loop Construct.
REPEAT Loop Construct
; Using a literal value as a counter
REPEAT #lit20 ; RCOUNT <-- lit20
(Valid target Instruction)
;
; Using a W register as a counter
REPEAT Wn ; RCOUNT <-- Wn
(Valid target Instruction)