161
SAM4CP [DATASHEET]
43051E–ATPL–08/14
12.6.11.5 VCVT between Floating-point and Fixed-point
Converts a value in a register from floating-point to and from fixed-point.
Syntax
VCVT{
cond
}.
Td
.F32
Sd
,
Sd
, #
fbits
VCVT{
cond
}.F32.
Td
Sd
,
Sd
, #
fbits
where:
cond
is an optional condition code, see
“Conditional Execution”
.
Td
is the data type for the fixed-point number. It must be one of:
S16 signed 16-bit value.
U16 unsigned 16-bit value.
S32 signed 32-bit value.
U32 unsigned 32-bit value.
Sd
is the destination register and the operand register.
fbits
is the number of fraction bits in the fixed-point number:
If
Td
is S16 or U16,
fbits
must be in the range 0-16.
If
Td
is S32 or U32,
fbits
must be in the range 1-32.
Operation
These instructions:
1.
Either
Converts a value in a register from floating-point to fixed-point.
Converts a value in a register from fixed-point to floating-point.
Places the result in a second register.
The floating-point values are single-precision.
2.
The fixed-point value can be 16-bit or 32-bit. Conversions from fixed-point values take their operand from the low-order
bits of the source register and ignore any remaining bits.
Signed conversions to fixed-point values sign-extend the result value to the destination register width.
Unsigned conversions to fixed-point values zero-extend the result value to the destination register width.
The floating-point to fixed-point operation uses the
Round towards Zero
rounding mode. The fixed-point to floating-point
operation uses the
Round to Nearest
rounding mode.
Restrictions
There are no restrictions.
Condition Flags
These instructions do not change the flags.
12.6.11.6 VCVTB, VCVTT
Converts between a half-precision value and a single-precision value.
Syntax
VCVT{
y
}{
cond
}.F32.F16
Sd
,
Sm
VCVT{
y
}{
cond
}.F16.F32
Sd
,
Sm
where:
y
Specifies which half of the operand register
Sm
or destination register
Sd
is used for the operand or
destination:
- If y is B, then the bottom half, bits [15:0], of
Sm
or
Sd
is used.
- If
y
is T, then the top half, bits [31:16], of
Sm
or
Sd
is used.
cond
is an optional condition code, see
“Conditional Execution”
.