242
SAM4CP [DATASHEET]
43051E–ATPL–08/14
12.12 Floating Point Unit (FPU)
The Cortex-M4F FPU implements the FPv4-SP floating-point extension.
The FPU fully supports single-precision add, subtract, multiply, divide, multiply and accumulate, and square root
operations. It also provides conversions between fixed-point and floating-point data formats, and floating-point constant
instructions.
The FPU provides floating-point computation functionality that is compliant with the ANSI/IEEE Std 754-2008, IEEE
Standard for Binary Floating-Point Arithmetic, referred to as the IEEE 754 standard.
The FPU contains 32 single-precision extension registers, which can also be accessed as 16 doubleword registers for
load, store, and move operations.
12.12.1 Enabling the FPU
The FPU is disabled from reset. It must be enabled before any floating-point instructions can be used. An example code
sequence for enabling the FPU in both privileged and user modes is showed below. The processor must be in privileged
mode to read from and write to the CPACR.
Example of Enabling the FPU:
; 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
ISB
12.12.2 Floating Point Unit (FPU) User Interface
Table 12-42. Floating Point Unit (FPU) Register Mapping
Offset
Register
Name
Access
Reset
0xE000ED88
Coprocessor Access Control Register
CPACR
Read/Write
0x00000000
0xE000EF34
Floating-point Context Control Register
FPCCR
Read/Write
0xC0000000
0xE000EF38
Floating-point Context Address Register
FPCAR
Read/Write
–
–
Floating-point Status Control Register
FPSCR
Read/Write
–
0xE000E01C
Floating-point Default Status Control Register
FPDSCR
Read/Write
0x00000000