Download Print this page

Texas Instruments SimpleLink CC2620 Technical Reference Manual page 1200

Zigbee rf4ce wireless mcu simplelink cc13 series; simplelink cc26 series

Advertisement

Modules
17.4.1.5.6.2 Loop Flow Control
The loop instructions constitute a special group of flow-control instructions that allow iterative loops to be
efficiently coded and executed.
Mnemonic
Description
loop R1,rel
Loop register
Loop
loop #n,rel
immediate
(1)
Flags: Zero (Z), Negative (N), Carry (C), and Overflow (V)
(2)
The Sensor Controller Studio assembler offsets the end-of-loop label, so it can be placed after the last instruction of the loop.
A loop instruction is executed just before the first instruction of a loop, and causes the following:
The address of the following instruction—the first instruction of the loop itself—is stored in an internal
register loopstart.
The address of the instruction following the last instruction of the actual loop is determined using an 8-
bit, signed displacement in the instruction word, as for the b<cc> disp instructions. The resulting
address is stored in the internal register loopend.
The number of loop iterations, as determined by either the content of the R1 register or a 3-bit
immediate in the instruction word, is stored in an internal register loopcount.
The loop-control logic is armed.
Instruction execution continues unaffected until the address of the next instruction to be executed matches
the address stored in loopend. When this happens, loopcount is decremented, and if nonzero, a branch to
the address in loopstart is executed. If loopcount is 0 after being decremented, the loop-control logic is
disarmed, and instruction fetching continues sequentially.
Because there is only one set of the loopstart, loopend, and loopcount registers, and these registers are
not readable or writable from other instructions, loops using the loop instructions cannot be nested. The
loop instructions are intended for use in the innermost loop only.
The loop immediate instructions provide direct support for seven commonly used iteration counts of 2, 4,
8, 16, 32, 64, and 128 through encoding of a 3-bit field embedded in the instruction word, thus not
requiring the use of register R1.
1200
AUX – Sensor Controller with Digital and Analog Peripherals
Table 17-10
lists the instructions.
Table 17-10. Loop Flow Instructions
Operation
loopcount = R1,
(2)
loopstart = pc+1,
loopend = pc+rel
loopcount = n,
loopstart = pc+1,
(2)
loopend = pc+rel
Copyright © 2015, Texas Instruments Incorporated
(1)
Z
N
SWCU117C – February 2015 – Revised September 2015
Submit Documentation Feedback
www.ti.com
C
V

Hide quick links:

Advertisement

loading