
...the world's most energy friendly microcontrollers
2011-02-04 - d0002_Rev1.00
43
www.energymicro.com
Note
For B, BL, CBNZ, and CBZ instructions, the value of the PC is the address of the current
instruction plus 4 bytes.
For all other instructions that use labels, the value of the PC is the address of the current
instruction plus 4 bytes, with bit[1] of the result cleared to 0 to make it word-aligned.
Your assembler might permit other syntaxes for PC-relative expressions, such as a label
plus or minus a number, or an expression of the form [PC, #number].
3.3.7 Conditional execution
Most data processing instructions can optionally update the condition flags in the Application Program
instructions update all flags, and some only update a subset. If a flag is not updated, the original value
is preserved. See the instruction descriptions for the flags they affect.
You can execute an instruction conditionally, based on the condition flags set in another instruction,
either:
immediately after the instruction that updated the flags
after any number of intervening instructions that have not updated the flags.
Conditional execution is available by using conditional branches or by adding condition code suffixes
to instructions. See
Table 3.4 (p. 44) for a list of the suffixes to add to instructions to make them
conditional instructions. The condition code suffix enables the processor to test a condition based on
the flags. If the condition test of a conditional instruction fails, the instruction:
does not execute
does not write any value to its destination register
does not affect any of the flags
does not generate any exception.
Conditional instructions, except for conditional branches, must be inside an If-Then instruction block. See
on the vendor, the assembler might automatically insert an IT instruction if you have conditional
instructions outside the IT block.
Use the CBZ and CBNZ instructions to compare the value of a register against zero and branch on the
result.
This section describes:
3.3.7.1 The condition flags
The APSR contains the following condition flags:
N Set to 1 when the result of the operation was negative, cleared to 0 otherwise.
Z
Set to 1 when the result of the operation was zero, cleared to 0 otherwise.
C Set to 1 when the operation resulted in a carry, cleared to 0 otherwise.
V
Set to 1 when the operation caused overflow, cleared to 0 otherwise.
A carry occurs: