# The VFP11 coprocessor (VFPv2) Sources: DDI 0360F chapters 16-20 (the VFP11 inside the MPCore), DDI 0100I part C (VFPv2), GBATEK "ARM Vector Floating-point Unit (VFP)". DOC unless marked. ## What it is - One VFP11 per MP11 CPU, reached as coprocessors 10 (single) and 11 (double). - 32 single registers S0-S31 overlapping 16 doubles D0-D15; short vectors through FPSCR.LEN and STRIDE over four banks (GBATEK "ARM VFP Floating Point Registers"). - FPSID (New 3DS: 410120B4h: ARM, VFPv2, part 20h = VFP11, variant Bh, revision 4: DOC, GBATEK), FPSCR, FPEXC, FPINST/FPINST2 (the bounced instruction), MVFR0/1. - **Precision:** single and double in hardware. ## Modes, and why they matter to an emulator The VFP11 is not a complete IEEE 754 machine in hardware. In **full-compliance mode**, any CDP with a subnormal input, a NaN input, a potential underflow, or an enabled trap is **bounced**: the coprocessor raises an Undefined Instruction exception and "support code" (system software) finishes the operation in software (DDI 0360F 16.5.1, chapter 20). **Flush-to-zero** (FPSCR.FZ), **default NaN** (FPSCR.DN) and **RunFast** (both, with no traps enabled) let hardware finish every operation without bouncing. So what a 3DS program sees for a subnormal or a NaN depends on: 1. the FPSCR the title runs with (set by the SDK runtime or the kernel at thread creation: unknown U10), and 2. in full-compliance mode, what the Horizon kernel's support code does with a bounce (it is Nintendo's code: an HLE board must state what its kernel model does; an LLE board runs the real handler). The core therefore specifies the hardware exactly, including the bounce (FPEXC.EX, the FPINST registers and the Undefined exception), and leaves the support code to whoever runs above it (n3ds-python's HLE kernel or Nintendo's kernel). The arithmetic is IEEE 754 binary32/binary64 with round-to-nearest, toward +inf, toward -inf and toward zero, the flush-to-zero and default-NaN rules of DDI 0100I C2, and the VFP's own NaN propagation and default NaN values (DDI 0100I C2.4). ## In Python Python floats are binary64 with round-to-nearest only, and no flush-to-zero. The specification must not lean on host floating point for anything but the easy case: - **Single precision**: implemented on integers (sign, exponent, significand) with explicit rounding modes, as a softfloat. Readable, slow, exact. - **Double precision**: the same softfloat at 64 bits. `float` may be used only where a test shows bit-identity across all four rounding modes, which it cannot (one mode only): so no. - The Rust tiers may use host floating point where it is bit-identical (round-to-nearest, no subnormals involved, default NaN fixed up) and fall back to the softfloat otherwise: a `-fast` choice under the lockstep gate. ## Timing The VFP11 has its own pipelines (FMAC, DS for divide/sqrt, LS) with scoreboards, forwarding and resource hazards (DDI 0360F 16.4, 19.4-19.11), executing in parallel with the integer pipeline. Proposal: instruction-level costs from chapter 19's tables plus the register scoreboard, as for the integer core (timing.md). HYPOTHESIS until measured: no test of VFP timing on a 3DS is known. ## Judges None hardware-captured for the VFP11 was found. Candidates: Berkeley TestFloat's vectors (hardware-independent IEEE results, a document-level judge for the arithmetic in RunFast and full-compliance mode excluding bounces; licence to be checked before use, U11); a 3DS homebrew that runs TestFloat on a console (none found).