The STM32 Cortex-M0 instruction set
A carry occurs:
●
If the result of an addition is greater than or equal to 2
●
If the result of a subtraction is positive or zero
●
As the result of a shift or rotate instruction
Overflow occurs if the sign of a result, in bit[31], does not match the sign of the result had
the operation been performed at infinite precision, for example:
●
If adding two negative values results in a positive value
●
If adding two positive values results in a negative value
●
If subtracting a positive value from a negative value generates a positive value
●
If subtracting a negative value from a positive value generates a negative value.
The Compare operations are identical to subtracting, for CMP, or adding, for CMN, except
that the result is discarded. See the instruction descriptions for more information.
Condition code suffixes
The instructions that can be conditional have an optional condition code, shown in syntax
descriptions as B{cond}. An instruction with a condition code is only executed if the
condition code flags in the APSR meet the specified condition.
codes to use.
You can use conditional execution with the IT instruction to reduce the number of branch
instructions in code.
Table 17
flags.
Table 17.
Suffix
EQ
NE
CS or HS
CC or LO
MI
PL
VS
VC
HI
LS
GE
LT
GT
LE
AL
40/91
also shows the relationship between condition code suffixes and the N, Z, C, and V
Condition code suffixes and their relationship with the flags
Flags
Z = 1
Z = 0
C = 1
C = 0
N = 1
N = 0
V = 1
V = 0
C = 1 and Z = 0
C = 0 or Z = 1
N = V
N ! = V
Z = 0 and N = V
Z = 1 and N ! = V
Can have any value
Doc ID 022979 Rev 1
Equal, last flag setting result was zero
Not equal, last flag setting result was non-zero
Higher or same, unsigned ≥
Lower, unsigned <
Negative
Positive or zero
Overflow
No overflow
Higher, unsigned >
Lower or same, unsigned
Greater than or equal, signed ≥
Less than, signed <
Greater than, signed >
Less than or equal, signed
Always. This is the default when no suffix is specified.
32
Table 17
shows the condition
Meaning
≤
≤
PM0215
Need help?
Do you have a question about the STM32F0 Series and is the answer not in the manual?