Atmel SAM4S-EK2 Atmel ATSAM4S-EK2 ATSAM4S-EK2 Ficha De Dados
Códigos do produto
ATSAM4S-EK2
91
SAM4S [DATASHEET]
11100E–ATARM–24-Jul-13
Absolute Value
The example below shows the use of a conditional instruction to find the absolute value of a number. R0 = ABS(R1).
MOVS R0, R1 ; R0 = R1, setting flags
IT MI ; IT instruction for the negative condition
RSBMI R0, R1, #0 ; If negative, R0 = -R1
Compare and Update Value
The example below shows the use of conditional instructions to update the value of R4 if the signed values R0 is greater
than R1 and R2 is greater than R3.
than R1 and R2 is greater than R3.
CMP R0, R1 ; Compare R0 and R1, setting flags
ITT GT ; IT instruction for the two GT conditions
CMPGT R2, R3 ; If 'greater than', compare R2 and R3, setting flags
MOVGT R4, R5 ; If still 'greater than', do R4 = R5
12.6.3.8 Instruction Width Selection
There are many instructions that can generate either a 16-bit encoding or a 32-bit encoding depending on the operands
and destination register specified. For some of these instructions, the user can force a specific instruction size by using
an instruction width suffix. The .W suffix forces a 32-bit instruction encoding. The .N suffix forces a 16-bit instruction
encoding.
and destination register specified. For some of these instructions, the user can force a specific instruction size by using
an instruction width suffix. The .W suffix forces a 32-bit instruction encoding. The .N suffix forces a 16-bit instruction
encoding.
If the user specifies an instruction width suffix and the assembler cannot generate an instruction encoding of the
requested width, it generates an error.
requested width, it generates an error.
Note:
In some cases, it might be necessary to specify the .W suffix, for example if the operand is the label of an
instruction or literal data, as in the case of branch instructions. This is because the assembler might not automat-
ically generate the right size encoding.
instruction or literal data, as in the case of branch instructions. This is because the assembler might not automat-
ically generate the right size encoding.
Table 12-16. Condition Code Suffixes
Suffix
Flags
Meaning
EQ
Z = 1
Equal
NE
Z = 0
Not equal
CS or
HS
HS
C = 1
Higher or same, unsigned
≥
CC or
LO
LO
C = 0
Lower, unsigned <
MI
N = 1
Negative
PL
N = 0
Positive or zero
VS
V = 1
Overflow
VC
V = 0
No overflow
HI
C = 1 and Z = 0
Higher, unsigned >
LS
C = 0 or Z = 1
Lower or same, unsigned
≤
GE
N = V
Greater than or equal, signed
≥
LT
N
!= V
Less than, signed <
GT
Z = 0 and N = V
Greater than, signed >
LE
Z = 1 and N
!= V
Less than or equal, signed
≤
AL
Can have any
value
value
Always. This is the default when no suffix is
specified.
specified.