Functional Peripherals Description
90
SLAU356I – March 2015 – Revised June 2019
Copyright © 2015–2019, Texas Instruments Incorporated
Cortex-M4F Peripherals
•
Decimal-to-binary conversions
•
Direct comparison of single-precision and double-precision values
The Cortex-M4 FPU supports fused MAC operations as described in the IEEE standard. For complete
implementation of the IEEE 754-2008 standard, floating-point functionality must be augmented with library
functions.
2.2.5.5
IEEE 754 Standard Implementation Choices
NaN handling
All single-precision values with the maximum exponent field value and a nonzero fraction field are valid
NaNs. A most-significant fraction bit of zero indicates a Signaling NaN (SNaN). A one indicates a Quiet
NaN (QNaN). Two NaN values are treated as different NaNs if they differ in any bit. The following table
shows the default NaN values.
Sign
Fraction
Fraction
0
0xFF
bit [22] = 1, bits [21:0] are all zeros
Processing of input NaNs for Arm floating-point functionality and libraries is defined as follows:
•
In full-compliance mode, NaNs are handled as described in the Arm Architecture Reference Manual.
The hardware processes the NaNs directly for arithmetic CDP instructions. For data transfer
operations, NaNs are transferred without raising the Invalid Operation exception. For the non-arithmetic
CDP instructions, VABS, VNEG, and VMOV, NaNs are copied, with a change of sign if specified in the
instructions, without causing the Invalid Operation exception.
•
In default NaN mode, arithmetic CDP instructions involving NaN operands return the default NaN
regardless of the fractions of any NaN operands. SNaNs in an arithmetic CDP operation set the IOC
flag, FPSCR[0]. NaN handling by data transfer and non-arithmetic CDP instructions is the same as in
full-compliance mode.
(1)
IOC is the Invalid Operation exception flag, FPSCR[0].
Table 2-6. QNaN and SNaN Handling
Instruction Type
Default NaN
Mode
With QNaN Operand
With SNaN Operand
Arithmetic CDP
Off
The QNaN or one of the QNaN operands, if
there is more than one, is returned
according to the rules given in the Arm
Architecture Reference Manual.
IOC
(1)
set. The SNaN is quieted and the
result NaN is determined by the rules given
in the Arm Architecture Reference Manual.
On
Default NaN returns.
IOC
(1)
set. Default NaN returns.
Non-arithmetic CDP
Off/On
NaN passes to destination with sign changed as appropriate.
FCMP(Z)
-
Unordered compare
IOC set. Unordered compare.
FCMPE(Z)
-
IOC set. Unordered compare.
IOC set. Unordered compare.
Load/store
Off/On
All NaNs transferred.
Comparisons
Comparison results modify the flags in the FPSCR. You can use the MVRS APSR_nzcv instruction
(formerly FMSTAT) to transfer the current flags from the FPSCR to the APSR. See the Arm Architecture
Reference Manual for mapping of IEEE 754-2008 standard predicates to Arm conditions. The flags used
are chosen so that subsequent conditional execution of Arm instructions can test the predicates defined in
the IEEE standard.
Underflow
The Cortex-M4F FPU uses the before rounding form of tininess and the inexact result form of loss of
accuracy as described in the IEEE 754-2008 standard to generate Underflow exceptions.
In flush-to-zero mode, results that are tiny before rounding, as described in the IEEE standard, are flushed
to a zero, and the UFC flag, FPSCR[3], is set. See the Arm Architecture Reference Manual for information
on flush-to-zero mode.