Functional Description
132
SLAU723A – October 2017 – Revised October 2018
Copyright © 2017–2018, Texas Instruments Incorporated
Cortex-M4 Peripherals
2.2.5.5.3 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. For information on flush-to-zero mode, see the Arm
Architecture Reference Manual.
When the FPU is not in flush-to-zero mode, operations are performed on subnormal operands. If the
operation does not produce a tiny result, it returns the computed result, and the UFC flag, FPSCR[3], is
not set. The IXC flag, FPSCR[4], is set if the operation is inexact. If the operation produces a tiny result,
the result is a subnormal or zero value, and the UFC flag, FPSCR[3], is set if the result was also inexact.
2.2.5.6
Exceptions
The FPU sets the cumulative exception status flag in the FPSCR register as required for each instruction,
in accordance with the FPv4 architecture. The FPU does not support user-mode traps. The exception
enable bits in the FPSCR read-as-zero, and writes are ignored. The processor also has six output pins,
FPIXC, FPUFC, FPOFC, FPDZC, FPIDC, and FPIOC, that each reflect the status of one of the cumulative
exception flags. For a description of these outputs, see the
Arm Cortex-M4 Integration and Implementation
Manual
.
The processor can reduce the exception latency by using lazy stacking. For more information, see
Auxiliary Control Register (ACTLR). This means that the processor reserves space on the stack for the FP
state, but does not save that state information to the stack. For more information, see the
Armv7-M
Architecture Reference Manual
.
2.2.5.7
Enabling the FPU
The FPU is disabled from reset. You must enable it before you can use any floating-point instructions. The
processor must be in privileged mode to read from and write to the Coprocessor Access Control (CPAC)
register. The below example code sequence enables the FPU in both privileged and user modes.
; CPACR is located at address 0xE000ED88
LDR.W R0, =0xE000ED88
; Read CPACR
LDR R1, [R0]
; Set bits 20-23 to enable CP10 and CP11 coprocessors
ORR R1, R1, #(0xF << 20)
; Write back the modified value to the CPACR
STR R1, [R0]; wait for store to complete
DSB
;reset pipeline now the FPU is enabled