Formally Verified Synthesizable Floating-Point Data Types in ARCH HDL

arXiv cs.CL Papers

Summary

This paper presents the design and end-to-end formal verification of IEEE-754 binary32 and bfloat16 arithmetic for ARCH HDL, a hardware description language intended for AI model generation. The operators are proven correctly rounded using a hybrid approach combining exhaustive SMT equivalence checking and Lean 4 proofs, with synthesizable SystemVerilog output.

arXiv:2607.23715v1 Announce Type: new Abstract: We report the design and end-to-end verification of first-class IEEE-754 binary32 (FP32) and bfloat16 (BF16) arithmetic for ARCH, a hardware description language intended to be generated by language models. Every operator - comparisons, conversions, add, sub, mul, and fused multiply-add (FMA) - is described once against a single bit-vector IR and rendered three ways from one source: synthesizable SystemVerilog, an SMT-LIB model, and a Lean 4 proof model. The three artifacts cannot drift apart structurally, and the residual per-node printer correspondence is machine-checked: a Yosys-to-SMT miter proves the emitted SystemVerilog equivalent to the SMT model for all 24 operators. Verification splits at the solver-tractability frontier: multiplier-free operators (comparisons, add/sub over all 2^64 inputs, conversions, and all binary BF16 arithmetic) are proved exhaustively equivalent to the SMT-LIB FloatingPoint theory; the SAT-hard multiplier-bearing operators (FP32 mul and FMA) are proved correctly rounded in Lean, sorry-free, against a value-level round-to-nearest-even specification over exact dyadic values. Physical characterization exposed the FMA as the timing outlier: its exact-wide 470-bit datapath does not pipeline in our flow. We reimplemented it as a bounded 98-bit guard/round/sticky datapath that pipelines to 268 MHz on Nangate45, and proved, in Lean and over all 2^96 inputs, that it is bit-identical to the exact-wide reference, so it inherits the reference's proven correct rounding. The equivalence is tractable precisely because the shared multiplier appears on both sides and cancels: neither a SAT solver nor the proof ever solves a multiplier equivalence. (The BF16 FMA is deliberately an FP32-accumulating fusion, characterized as exactly that.) All machine-checked claims are pinned to a tagged open-source release.
Original Article
View Cached Full Text

Cached at: 07/28/26, 06:30 AM

# Formally Verified Synthesizable Floating-Point Data Types in ARCH HDL
Source: [https://arxiv.org/html/2607.23715](https://arxiv.org/html/2607.23715)
###### Abstract

We report the design and end\-to\-end verification of first\-class IEEE\-754 binary32 \(FP32\) and bfloat16 \(BF16\) arithmetic for ARCH, a hardware description language intended to be generated by language models from natural\-language specifications\. Every floating\-point operator — comparisons, conversions, add, sub, multiply, and fused multiply–add, in both formats — is described once in a host\-language embedded DSL against a single bit\-vector intermediate representation, which is rendered three ways from one source: to synthesizable SystemVerilog \(the hardware\), to SMT\-LIB \(a formal model\), and to Lean 4 \(a structured proof model\)\. Because the three back\-ends consume one description and one linearization, the hardware, the formal model, and the proof model cannot drift apart structurally: they are the same dataflow graph printed in three syntaxes\. What remains between them is the per\-node syntax table of roughly twenty printers; on the hardware side even that is machine\-checked — Yosys independently reads the emitted SystemVerilog and a solver proves it equivalent to the SMT model, for all operators\. We verify the operators with a hybrid strategy matched to the solver\-tractability frontier: the*multiplier\-free*operators \(all six FP32 comparisons and bounded add/sub over the full2642^\{64\}input space, the format conversions, and all*binary*BF16 arithmetic over2322^\{32\}\) are proved equivalent to the SMT\-LIBFloatingPointtheory exhaustively; the*multiplier\-bearing*operators \(FP32mulandfma\), which are SAT\-hard for any bit\-blaster, are machine\-proved correctly rounded in Lean by algebraic lifting, with zerosorry\. \(The one deliberate exception: the BF16fmais an FP32\-accumulating fusion — the Tensor\-Core/TPU convention — machine\-characterized as exactly that, not claimed correctly rounded\.\) Physical characterization \(open\-source Yosys synthesis and OpenSTA timing\) then exposed thefmaas the timing outlier: its exact\-wide470470\-bit aligned adder is a single combinational cone that our synthesis flow cannot pipeline \(ABC retiming moves no registers through it\)\. We therefore reimplemented thefmaas a bounded9898\-bit guard / round / sticky datapath that pipelines cleanly to268268MHz — and proved, in Lean and*sorry*\-free, that the bounded datapath is*bit\-identical*to the exact\-wide reference over all2962^\{96\}inputs, so it inherits the reference’s proven correct rounding without re\-engaging the multiplier\. The equivalence proof is tractable precisely because the shared multiplier appears on both sides and cancels\. We give the architecture, the two\-tier proof methodology, the synthesis results, the trust base \(the standard three axioms plusbv\_decide’s native\-checked LRAT\-certificate axioms\), and an independent adversarial audit\.

## 1Introduction

ARCH111[https://github\.com/arch\-hdl\-lang/arch\-com](https://github.com/arch-hdl-lang/arch-com)is a purpose\-built hardware description language for micro\-architecture work, designed so that the language surface can be generated correctly by language models from natural\-language hardware descriptions, and compiled to deterministic, readable SystemVerilog\. A language meant to describe real datapaths needs first\-class floating\-point: not a library bolted on, but FP32\[[1](https://arxiv.org/html/2607.23715#bib.bib1)\]and BF16\[[2](https://arxiv.org/html/2607.23715#bib.bib2)\]as built\-in types with operators that are \(i\)*correctly rounded*to IEEE\-754, \(ii\)*synthesizable*to efficient RTL, and \(iii\)*trustworthy*, since machine\-generated hardware most needs machine\-checked guarantees\. These three goals are in tension\. Correct rounding is a precise but subtle specification\. Exhaustive formal equivalence checking hits a wall at the one operator that matters most for throughput — the fused multiply–add — because its significand multiplier makes the miter SAT\-hard\[[9](https://arxiv.org/html/2607.23715#bib.bib9),[11](https://arxiv.org/html/2607.23715#bib.bib11)\]\(a*miter*ties the two circuits under comparison to shared inputs and XORs their outputs, reducing equivalence to unsatisfiability of that XOR\)\. And the most obviously\-correctfmadatapath \(compute the exact wide product\-sum, then round\) is the worst for timing\.

This paper reports how we resolved all three for ARCH, and the path is the contribution as much as the endpoint:

1. 1\.One source, three back\-ends\.Each operator is defined once against a shared bit\-vector IR — a DAG whose subterms are shared by construction; three renderers emit synthesizable SystemVerilog, SMT\-LIB, and Lean 4 from that one description and one linearization \(Section[3](https://arxiv.org/html/2607.23715#S3)\)\. The hardware, the SMT model, and the proof model are*structurally*the same artifact in three syntaxes; the SystemVerilog printer’s semantic correspondence is machine\-checked by a Yosys\-to\-SMT miter, the Lean printer’s by a byte\-identical regeneration audit \(Section[10](https://arxiv.org/html/2607.23715#S10)\)\.
2. 2\.A two\-tier proof methodology at the tractability frontier\.Multiplier\-free operators are discharged*exhaustively*by SMT against the IEEE\-754FloatingPointtheory; multiplier\-bearing operators are*structurally*proved in Lean by lifting the bit pattern to an algebraic value, so the24×2424\\times 24array never gets bit\-blasted \(Section[4](https://arxiv.org/html/2607.23715#S4)\)\.
3. 3\.Timing\-driven design, verified after the fact\.Synthesis and static timing \(Section[5](https://arxiv.org/html/2607.23715#S5)\) show the exact\-widefmais the outlier and resisted retiming \(ABC moved no registers through the cone in any tested configuration\); we redesign it as a bounded sticky\-fold datapath \(Section[6](https://arxiv.org/html/2607.23715#S6)\) that pipelines to268268MHz, and prove it*bit\-identical*to the exact\-wide reference over all2962^\{96\}inputs \(Section[7](https://arxiv.org/html/2607.23715#S7)\), so the fast datapath inherits the reference’s proven correct rounding\. The equivalence is provable without re\-engaging the multiplier, because the shared multiplier cancels\.

The result is a floating\-point feature whose every operator is either exhaustively or structurally verified against its stated contract \(for the BF16fma, an FP32\-accumulating fusion, that contract is stated rather than correct rounding; Section[4\.3](https://arxiv.org/html/2607.23715#S4.SS3)\), on a model that is provably the emitted RTL, with a clean axiom base and an independent audit \(Section[8](https://arxiv.org/html/2607.23715#S8)\)\.

## 2Background

#### Correct rounding\.

For a destination format withpp\-bit significand, a correctly rounded operation returnsRNE​\(v\)\\mathrm\{RNE\}\(v\), wherevvis the*exact*real result andRNE\\mathrm\{RNE\}is round\-to\-nearest, ties\-to\-even\[[1](https://arxiv.org/html/2607.23715#bib.bib1)\]\. Forfma,v=a⋅b\+cv=a\\cdot b\+cformed without intermediate rounding\. “Correctly rounded” is thus two claims: form the exact value, and round it\.

#### Guard / round / sticky\.

Hardware keeps the result significand plus three summary bits: guard \(the first bit below the kept significand\), round \(the next\), and sticky \(the OR of all lower bits\)\. RNE on a GRS\-encoded value is exact — round up iffguard∧\(round∨sticky\)\\text\{guard\}\\wedge\(\\text\{round\}\\vee\\text\{sticky\}\), ties to even — so the engineering problem is producing the GRS bits without materializing the full exact value\.

#### The multiplier wall\.

After special values are dispatched, equivalence of an arithmetic circuit to its specification is a quantifier\-free bit\-vector \(and floating\-point\) formula\. Bit\-blasting turns the24×2424\\times 24significand multiplier into a quadratic gate network whose conjunctive normal form is intractable across the binary32 input space\. Multiplier miters are canonically hard SAT instances — a standard benchmark family for exactly this reason\[[9](https://arxiv.org/html/2607.23715#bib.bib9)\], with lower\-bound analyses of why solvers struggle on nonlinear integer arithmetic\[[10](https://arxiv.org/html/2607.23715#bib.bib10)\]— hard enough that state\-of\-the\-art multiplier verification abandons plain SAT for computer algebra\[[11](https://arxiv.org/html/2607.23715#bib.bib11)\]\. Consistently, z3, cvc5, and the Lean tacticbv\_decide\[[8](https://arxiv.org/html/2607.23715#bib.bib8)\]all stall onmulandfmahere\. Everything without a multiplier — comparisons, conversions, and bounded add/sub whose datapath stays narrow — is exhaustively decidable; the multiplier\-bearing operators are not\. Our methodology is organized around exactly this frontier\.

## 3Single\-source architecture

one operator description \(Rust eDSL\)bit\-vector IR: pointer\-shared DAGshared linearization: one SSA order\_t0…\_tNrender\_svSystemVerilogrender\_smtSMT\-LIBrender\_leanLean 4synthesis, sim; SV→\\toSMT miter: 24/24unsatmiters vs\.fp\.\* \(z3 / cvc5, §4\.1\)equivalence \+ value*proofs*\(§4\.2, §7–8\); printer: byte\-identical regen*proved:*one structure, one order

Figure 1:One description, three back\-ends\. Everything above the fork is a single shared artifact \(structural identity is by construction\); the residual trust is the per\-node syntax table below the fork; the SystemVerilog side is discharged mechanically by the Yosys\-to\-SMT miter \(all2424operatorsunsat, §[10](https://arxiv.org/html/2607.23715#S10)\), the Lean side by the byte\-identical regeneration audit\.Each operator is built once, in Rust, against a pointer\-shared bit\-vector IR \(Figure[1](https://arxiv.org/html/2607.23715#S3.F1)\): a directed acyclic graph of nodes \(add,sub,mul,ite,extract,concat,zero\_extend, the bit\-vector comparisons, and named calls\), where a subterm the builder reuses is one node, not a copy\. One shared*linearization*pass flattens that DAG into a straight\-line program: a single topological sequence of temporary assignments\_t0,\_t1, … in single\-static\-assignment form — each temp defined once, referring only to earlier temps, each shared node emitted exactly once\. The three renderers walk that one numbered sequence \(Table[1](https://arxiv.org/html/2607.23715#S3.T1)\) and differ only in how a line is spelled, via the per\-node syntax table \(aBin::Addnode prints\+in SystemVerilog,bvaddin SMT\-LIB, and\+onBitVecin Lean\); consequently\_t44names the*same node*in the hardware, the SMT model, and the proof model\.

Table 1:One bit\-vector IR, three renderers\. Sharing the IR*and*the linearization, the renderers cannot disagree on structure — only on the per\-operator syntax table\.Because all three consume the same IR and the same linearization, they cannot disagree on sharing, control flow, or node order; the Lean proof model is a generated snapshot ofrender\_lean, and we confirm \(Section[8](https://arxiv.org/html/2607.23715#S8)\) it is byte\-identical to a fresh regeneration — so the proof is about the emitted artifact, not a paraphrase\. The only way the three artifacts*can*diverge is a wrong entry in the syntax table — a mistranslation of a single node kind, which would appear uniformly in every operator using that node, not as an operator\-specific bug\. That failure mode is what Section[10](https://arxiv.org/html/2607.23715#S10)scopes as the residual renderer trust — and what the Yosys\-to\-SMT miter now discharges mechanically for the SystemVerilog renderer\. The operator set spans the six FP32 comparisons; FP32add,sub,mul,fma; the conversions FP32→\\toBF16 \(narrowing, RNE\), BF16→\\toFP32 \(widening, exact\), and FP32→\\tosigned/unsigned integer \(toward\-zero, saturating\); and the BF16 comparisons and arithmetic, which route through the FP32 datapath\. NaN canonicalization follows a selectable profile \(e\.g\. the RISC\-V vs\. CUDA conventions\)\.

## 4Verification methodology

### 4\.1Tier 1 — exhaustive SMT for the multiplier\-free operators

The SMT renderer emits each operator as adefine\-fun; a miter asserts the negation of equivalence to the SMT\-LIBFloatingPointtheory\[[7](https://arxiv.org/html/2607.23715#bib.bib7)\]— the standardized formalization of IEEE\-754 RNE, the same value semantics Berkeley SoftFloat implements\. Anunsatverdict means the emitted RTL operator matches the theory’s RNE*value*semantics — the result bit pattern, with our canonical\-NaN choice pinned explicitly in the miter — over its entire input space\. We discharge, exhaustively:

- •all six FP32 comparisons and the conversions over their full domains \(the2642^\{64\}compare space; FP32→\\toBF16 narrowing over2322^\{32\}; BF16→\\toFP32 widening over2162^\{16\}; FP32→\\tointeger for in\-range inputs, the partial\-function boundary documented rather than silently claimed\);
- •FP32addandsubversusfp\.add/fp\.subover all2642^\{64\}inputs\. The decisive factor is datapath width, not input space: the bounded adder keeps the aligned magnitude near5656bits \(no multiplier\), so the bit\-blasted miter stays small;
- •all*binary*BF16 arithmetic \(mul,add,sub, and the six compares\) over the full2322^\{32\}input space\. BF16’s small input space makes even the multiplier\-bearing binary operators tractable, even though they route through the FP32 datapath; cross\-checked across solvers\. The ternary BF16fma\(a2482^\{48\}space\) is deliberately*not*on this list: it is FP32\-accumulating, and its distinct contract is stated in Section[4\.3](https://arxiv.org/html/2607.23715#S4.SS3)\.

#### The exact contract\.

“IEEE\-754” in this paper means*result\-bit value semantics under a fixed rounding regime*, and no more\. Rounding is statically RNE for arithmetic and format conversions \(toward\-zero for the saturating float\-to\-integer path\); there is no dynamic rounding\-mode input, and no status flags —invalid,inexact,overflow,underfloware not computed\. NaN handling is by explicit canonical profile: IEEE\-754 and SMT\-LIB both abstract NaN payloads, so each miter’s NaN branch pins our canonicalized output rather than appealing to the theory\. Comparisons implement the quiet predicates \(fp\.eqand kin\); there are no signaling variants and hence no invalid\-operation side channel\. Float\-to\-integer is*saturating*with defined NaN and out\-of\-range results at the ARCH level; SMT\-LIB leavesfp\.to\_sbv/fp\.to\_ubvunspecified there, so the miter covers exactly the in\-range domain where the theory is defined, and the saturation/NaN behavior is a documented ARCH contract validated by directed simulation rather than by the proof\. Finally, all three models are*two\-state*: the IR and its SMT and Lean renderings have noX/Z, so SystemVerilog four\-state behavior \(Xpropagation, high impedance\) is outside the verified contract, which speaks to fully driven binary inputs\.

### 4\.2Tier 2 — structured Lean for the multiplier wall

FP32mulandfmacarry the24×2424\\times 24multiplier and time out for any bit\-blaster\. A structured prover clears the wall by*not*bit\-blasting\. Following the Flocq / FloVer methodology\[[3](https://arxiv.org/html/2607.23715#bib.bib3),[4](https://arxiv.org/html/2607.23715#bib.bib4)\], the proof lifts the bit pattern to an algebraic\(sign,significand,exponent\)\(\\text\{sign\},\\text\{significand\},\\text\{exponent\}\)view over a rational value and shows the operator computesRNE​\(a⋅b​\[\+c\]\)\\mathrm\{RNE\}\(a\\cdot b\\,\[\+\\,c\]\)structurally: the24×2424\\times 24array collapses to a singleNatmultiply, whose algebra is elementary\. The development factors into a reusable*rounder*characterization — that the shared round\-to\-nearest\-even encoder finds the true leading bit \(a count\-leading\-zeros / most\-significant\-bit bridge\), performs an exact round\-trip, and satisfies1⋅x=x1\\cdot x=x— and per\-operator reductions on top of it\. Forfmathis yieldsarch\_round470\_correctand a*sorry*\-free proof that the finite FP32fmais correctly rounded against a value\-level RNE specification\. The development is dependency\-free \(Lean coreBitVecandbv\_decide; no Mathlib\)\.

### 4\.3BF16fma: an honest exception

The BF16fmais intentionally a*fused f32\-accumulate*: one correctly rounded FP32fmafollowed by a narrowing rounding FP32→\\toBF16\. It is therefore*not*a correctly rounded BF16fma: the second rounding is not innocuous, and it differs fromRNEbf16​\(a⋅b\+c\)\\mathrm\{RNE\}\_\{\\text\{bf16\}\}\(a\\cdot b\+c\)on a small fraction of finite inputs, always by one unit in the last place\. This is the FP32 accumulation\-format convention of NVIDIA tensor cores\[[12](https://arxiv.org/html/2607.23715#bib.bib12)\], Google TPUs\[[13](https://arxiv.org/html/2607.23715#bib.bib13)\], and BF16 training practice\[[2](https://arxiv.org/html/2607.23715#bib.bib2)\]— a convention about the accumulation format only; vendor implementations are not otherwise bit\-identical \(TPU subnormal handling differs, for instance\)\. The operator is separately machine\-characterized as “the narrowing of the correctly rounded FP32fma” rather than claimed as correctly rounded\. An earlier “innocuous double rounding” argument for it was a round\-to\-nearest fallacy; we record the corrected characterization\.

### 4\.4Differential backstop

The same IR also drives a differential campaign against Berkeley SoftFloat\[[15](https://arxiv.org/html/2607.23715#bib.bib15)\], the de\-facto reference IEEE\-754 implementation, on directed corner vectors \(signed zeros and infinities, quiet and signaling NaNs, subnormal and normal extrema, exact ties, overflow and underflow boundaries\) and large randomized vectors, providing an empirical cross\-check independent of the SMT theory\.

## 5Physical characterization

We synthesized the emitted SystemVerilog of every arithmetic and format\-conversion operator through an open\-source flow \(Yosys for logic synthesis, OpenSTA for static timing\), reporting maximum frequency asfmax=1000/\(critical\-path delay in ns\)f\_\{\\max\}=1000/\\text\{\(critical\-path delay in ns\)\}against a virtual clock\. Table[2](https://arxiv.org/html/2607.23715#S5.T2)gives the per\-operator combinational result on Nangate45 standard cells \(typical corner\); the six comparisons and the saturating integer conversions carry no rounding chain and are not characterized here\. The complete flow — the Yosys scripts, the bufferedabcrepair script of Remark[1](https://arxiv.org/html/2607.23715#Thmremark1), the OpenSTA scripts, tool versions \(Yosys 0\.67, OpenSTA 3\.1\.0\), and the Liberty file’s provenance by SHA\-256 — is archived in the repository \(tests/fp\_v1/synth/nangate45/\), with a reproduction check: the archived seven\-stagefmasource re\-measures at268\.0268\.0MHz, and a representative combinational operator regenerated from the current compiler lands within3%3\\%of its published figure \(compiler\-side RTL drift, not flow drift\)\.

Table 2:Per\-operator combinationalfmaxf\_\{\\max\}\(MHz\) and mapped cell count, Nangate45 standard cells \(typical corner\), Yosys\+\+OpenSTA, buffered flow \(Remark[1](https://arxiv.org/html/2607.23715#Thmremark1)\)\. The widen/narrow conversions are near\-wire; every arithmetic operator clears276276MHz — except thefmas, and the exact\-wide FP32fmais the clear outlier: slowest at160160MHz and, at1919k cells,3×3\\timesthe area of the multiplier\.The exact\-widefmais not merely the slowest: it does not*pipeline*\. Its470470\-bit aligned adder is a single combinational cone, and ABC’s register retiming moves no flops into such a cone at all \(we verified this directly: under every retiming configuration we tried, the register count and positions are unchanged\), while a hand\-inserted three\-stage split of the470470\-bit datapath yielded no improvement either\. This is the design problem the next section addresses\. \(The exact\-widefmais, however, the simplest*specification*: it computes the exact value and rounds once, and is the object the equivalence proof targets\.\)

## 6The bounded sticky\-foldfma

exact\-wide reference \(470 b\): alignment exact, nothing droppedhi⋅2Δ\\cdot\\,2^\{\\Delta\}\(48 b\)lo \(48 b\)gapΔ≤421\\Delta\\leq 421— every lo bit retained24692^\{469\}202^\{0\}add /\|−\|\|\{\-\}\|,
round oncesticky\-fold \(98 b\): same hi, lo survives only down to the guard; the rest ORs into one sticky bithi at weight2492^\{49\}\(48 b\)surviving top of lo, doubled \(guard at212^\{1\}\)stbits of lo shifted below the guard \(dropped\)OR\-fold⇒\\Rightarrow
sticky bit202^\{0\}Figure 2:The twofmadatapaths, schematic \(not to scale\)\. The exact\-wide reference keeps a field wide enough \(Δ≤421<470\\Delta\\leq 421<470\) that alignment loses nothing\. The sticky\-fold keeps the same high significand at weight2492^\{49\}and only the top of the shifted low operand, doubled to expose a guard bit; everything shifted below the guard is OR\-folded into a single sticky bit — exactly the information RNE needs \(§[2](https://arxiv.org/html/2607.23715#S2)\)\. Section[7](https://arxiv.org/html/2607.23715#S7)proves the two produce identical results on all2962^\{96\}inputs\.We reimplement thefmaas a bounded guard/round/sticky datapath\. Both datapaths share the front end — unpack to sign / biased exponent /2424\-bit significand \(subnormals floored at exponent−149\-149\), form the4848\-bit product, select the higher operand by unbiased exponent\. LetΔ\\Deltabe the exponent gap; for finite operandsΔ≤421\\Delta\\leq 421\.

#### Reference \(arch\_fma\_f32\_ref\)\.

Zero\-extend both significands toFMA​\_​W=470\\mathrm\{FMA\\\_W\}=470bits, shift the higher one up byΔ\\Delta, add or take the absolute difference, round once\. SinceΔ≤421<470\\Delta\\leq 421<470the field is exact; that the result isRNE​\(exact​a⋅b\+c\)\\mathrm\{RNE\}\(\\text\{exact \}a\\cdot b\+c\)is itself a theorem, not a construction argument: the aligned magnitude and selected sign are proved equal to the decoded\|a⋅b\+c\|\|a\\cdot b\+c\|and its sign \(fma\_mag\_exact,fma\_sign\_exact; Section[8](https://arxiv.org/html/2607.23715#S8)\)\. This is the specification \(and the160160\-MHz circuit above that our flow could not retime\)\.

#### Sticky\-fold \(arch\_fma\_f32\)\.

Use a9898\-bit field \(Figure[2](https://arxiv.org/html/2607.23715#S6.F2)\) withFMA​\_​G=48\\mathrm\{FMA\\\_G\}=48guard bits: the high significand sits at weight2492^\{49\}and the shifted low significand is doubled to make room for a guard bit, with one sticky bit absorbing everything the shift drops\. The guard widthFMA​\_​G=48\\mathrm\{FMA\\\_G\}=48is chosen so that any cancellation ina⋅b\+ca\\cdot b\+cthat could affect rounding keeps the product/addend least\-bit gap at most4747— it stays*inside*the guard region, so the fold below it loses no rounding information\. This is the structural fact the equivalence proof formalizes\.

Being a fixed\-width GRS datapath rather than a470470\-bit adder, the sticky\-fold pipelines\. Table[3](https://arxiv.org/html/2607.23715#S6.T3)reports anfmaxf\_\{\\max\}\-versus\-pipeline\-depth sweep on the same Nangate45 cells and flow:180180MHz combinational, rising to a260260–268268MHz plateau at five to seven stages, with the best measured point at seven stages \(268268MHz\)\. Beyond the plateau more registers only add fixed per\-stage overhead \(clock\-to\-Q\+\+setup≈0\.4\\approx 0\.4ns each\) without splitting the remaining fine\-grained cones — eight and ten stages regress\. The depth–fmaxf\_\{\\max\}relation is also non\-monotone within the sweep because register*placement*strategy matters as much as count\.

Table 3:Bounded sticky\-fold FP32fma:fmaxf\_\{\\max\}and cell count vs\. pipeline depth, Nangate45 standard cells \(typical corner\), Yosys\+\+OpenSTA, buffered flow \(Remark[1](https://arxiv.org/html/2607.23715#Thmremark1); best register\-placement strategy per depth\)\. The bounded datapath pipelines cleanly to a260260–268268MHz plateau — unlike the exact\-wide reference, which retiming does not improve at all\.Because both tables use the same Nangate45 flow, the numbers are directly comparable, and they separate the two effects cleanly\.*Combinationally*the sticky\-fold is a modest win:180180MHz vs\. the exact\-wide’s160160MHz, at1\.8×1\.8\\timesless area \(10\.810\.8k vs\.19\.219\.2k cells\)\. The decisive difference is*pipelinability*: the sticky\-fold reaches268268MHz at seven stages —1\.68×1\.68\\timesthe exact\-wide’s ceiling, since the exact\-wide gained nothing from retiming in our flow\. Thefmawas the only operator in Table[2](https://arxiv.org/html/2607.23715#S5.T2)whose ceiling demanded a redesign; at seven stages it sits within3%3\\%of FP32mul\(268268vs\.276276MHz\) instead of40%40\\%below the field\.

Replacing a verified datapath with a faster one creates a new obligation: does the fold change the result? The next section answers it\.

## 7Bit\-exact equivalence of the twofmadatapaths

Our central new theorem is a*sorry*\-free Lean 4 proof

∀a,b,c∈BitVec​32,arch\_fma\_f32​\(a,b,c\)=arch\_fma\_f32\_ref​\(a,b,c\),\\forall\\,a,b,c\\in\\mathrm\{BitVec\}\\,32,\\\\ \\texttt\{arch\_fma\_f32\}\(a,b,c\)=\\texttt\{arch\_fma\_f32\_ref\}\(a,b,c\),\(1\)over the entire2962^\{96\}input space\. Composed with the reference’s proved correct rounding \(Section[8](https://arxiv.org/html/2607.23715#S8)\), it yields the machine\-checked end\-to\-end theoremarch\_fma\_f32\_correct: the synthesizable boundedfmais correctly rounded against the exact value of its decoded operands — proved without ever re\-engaging the multiplier\.

#### Why it is tractable\.

Both datapaths compute the*same*product significand and apply the*same*special\-value wrapper; in the equivalence miter these cancel under common\-subexpression elimination, so neither a bit\-blaster nor the Lean proof ever solves a multiplier equivalence\. The residual content is \(a\) bit\-precise field construction and operand selection, discharged bybv\_decideover concrete widths — an*identity*over the shared multiply, hence cheap — and \(b\) rounding, discharged structurally on integers; the variable alignment shift is never bit\-blasted\.

#### Rounding collapse\.

Reduce eachfmatoroundNE\_f32​\(s,m,e\)\\texttt\{roundNE\_f32\}\(s,m,e\)and compare magnitudes:

###### Lemma 1\(GRS collapse\)\.

Letm1,m2m\_\{1\},m\_\{2\}agree above bitgg\(m1/2g=m2/2gm\_\{1\}/2^\{g\}=m\_\{2\}/2^\{g\}\) and share their low\-ggsticky status \(m1mod2g=0⇔m2mod2g=0m\_\{1\}\\bmod 2^\{g\}=0\\iff m\_\{2\}\\bmod 2^\{g\}=0\)\. Ifgglies at or below the rounding position —g\+24≤log2⁡m1g\+24\\leq\\log\_\{2\}m\_\{1\}for a normal result, org<−149−eg<\-149\-efor a subnormal one — thenroundNE\_f32​\(s,m1,e\)=roundNE\_f32​\(s,m2,e\)\\texttt\{roundNE\_f32\}\(s,m\_\{1\},e\)=\\texttt\{roundNE\_f32\}\(s,m\_\{2\},e\)\.

To apply Lemma[1](https://arxiv.org/html/2607.23715#Thmlemma1)across datapaths, the proof characterizes the sticky\-fold and reference magnitudes as closed\-form integer expressions \(for both same\- and opposite\-sign alignment\), relates them by an exact power of two whenΔ≤48\\Delta\\leq 48, and relates the two alignment exponents through a balanced\-modulus bridge at the signed\-integer level; an exponent\-alignment lemma scales the sticky\-fold magnitude into the reference’s frame\.

#### The case lattice\.

The top theorem is a decision tree: NaN / infinity / zero\-factor special cases \(each a two\-step rewrite chaining a sticky\-fold special\-value lemma with its reference mirror, both discharged bybv\_decideon the9898\- and470470\-bit datapaths\); zero addend; exact cancellation \(magnitude=0⇒±0\\text\{magnitude\}=0\\Rightarrow\\pm 0\); and the finite non\-cancelling region, split by sign, byΔ≤48\\Delta\\leq 48vs\.Δ\>48\\Delta\>48, and by the higher significand’s magnitude \(with the normal / subnormal result branch dispatched internally via Lemma[1](https://arxiv.org/html/2607.23715#Thmlemma1)\)\.

#### The hard case\.

One configuration resists the generic collapse: an opposite\-signfmawhose higher significand is exactly a power of two, with a non\-zero lower operand and a normal result\. The subtraction borrow drops the leading bit, so the round shift coincides with the natural collapse position and violates the strict precondition of Lemma[1](https://arxiv.org/html/2607.23715#Thmlemma1)\. We resolve it in two pieces: atΔ=49\\Delta=49the fold is the identity, so the two magnitudes are equal and the rounding is trivial; forΔ≥50\\Delta\\geq 50a tighter bound on the folded low part lets the collapse be taken one bit lower, satisfying the precondition with equality\. This case is a good illustration of why the development must be bit\-precise: the rounding decision turns on a single guard bit at a position that moves with the inputs\.

## 8Trust base, audit, and assurance

#### Axioms\.

\#print axiomson the equivalence and end\-to\-end theorems reports the standard three \(propext,Classical\.choice,Quot\.sound\) plus one\_native\.bv\_decide\.ax\_\*axiom perbv\_decideinvocation\. To be precise about what those axioms mean: the external SAT solver \(CaDiCaL\) is*untrusted*— it must emit an LRAT refutation certificate\[[14](https://arxiv.org/html/2607.23715#bib.bib14)\]\(a SAT\-unsatisfiability proof format whose steps carry explicit propagation hints, checkable in linear time without search — which is what makes a small*verified*checker practical\), validated by exactly such a formally verified checker — but the checker is executed by Lean’s*compiled native evaluator*, and its verdict enters the proof as an axiom\. The trusted base for thebv\_decidesteps is therefore the Lean kernel*plus*the Lean compiler and native\-evaluation bridge \(the same trust class asnative\_decide\), not the kernel alone\[[8](https://arxiv.org/html/2607.23715#bib.bib8)\]\. By contrast, the value\-level rounder anchor is kernel\-only:\#print axiomsonroundNE\_nearestreports exactly the standard three \(and on the R1 kernel characterizationrneQuot\_nearest, onlypropextandQuot\.sound\) — no native evaluation anywhere in that chain; the native trust enters solely through the bit\-level datapath lemmas\. There is nosorry, no hand\-declared axiom, and no soundness\-weakening option\. The development is about9 0009\\,000lines across2323modules \(Lean v4\.30\.0\)\.

#### Artifact\.

Every machine\-checked claim in this paper — the Lean theorems, the Tier\-1 SMT proofs, the renderer miters, and the archived synthesis flow — is checked against one release of the ARCH repository:v0\.71\.0\(commit1a7d9fd\),[https://github\.com/arch\-hdl\-lang/arch\-com/releases/tag/v0\.71\.0](https://github.com/arch-hdl-lang/arch-com/releases/tag/v0.71.0)\.

#### Independent audit\.

An adversarial audit, run separately, rebuilt the project, re\-derived the axiom set, and — the strongest check against a hollow proof —*regenerated*the Lean model from the operator source and confirmed it byte\-identical to the committed model\. Soarch\_fma\_f32andarch\_fma\_f32\_refare the genuine emitted artifacts, structurally independent \(9898\-bit fold vs\.470470\-bit exact\), hence not trivially equal; the audit further confirmed the top\-level case split exhaustive and non\-vacuous, everybv\_decideoperating on the real datapaths, and the rounder a genuine RNE encoder\.

#### Where the IEEE anchor bottoms out\.

No verification proves a specification correct absolutely; it bottoms out in a trusted definition\. Forfmathat definition isRNE​\(exact​a⋅b\+c\)\\mathrm\{RNE\}\(\\text\{exact \}a\\cdot b\+c\)— and the chain from it to the emitted datapath is now proved*end to end*, with no by\-construction step\. A value\-level Lean theorem \(arch\_fma\_f32\_correct, moduleArchFpEquiv\.FmaValue\) states that for finite nonzero operands whose exact result is nonzero and in range, thefmareturns the finite FP32 pattern nearest in magnitude to the exact real valuea⋅b\+ca\\cdot b\+camong*all*finite patterns, with ties to an even mantissa \(roundNE\_tie\_even\), the exact sign, and overflow to signed infinity occurring exactly when the correctly rounded magnitude reaches21282^\{128\}, the IEEE criterion \(arch\_fma\_f32\_overflow,biasedFinal\_overflow\_iff\)\. Both halves of the specification are theorems rather than construction arguments: “exact” is the magnitude identityfma\_mag\_exact— the reference’s aligned470470\-bit magnitude at its alignment exponent equals\|a⋅b\+c\|\|a\\cdot b\+c\|of the decoded operands, with the datapath’s sign selection equal to the exact value’s sign \(fma\_sign\_exact\) — and “RNE” is the rounder theoremroundNE\_nearest\. All quantities in play are dyadic rationals, so every comparison is carried out*exactly*overℕ\\mathbb\{N\}\(the valuea⋅b\+ca\\cdot b\+clives on the fixed grid2−2982^\{\-298\}\); no reals and no rational arithmetic are needed, and the proofs stay in core Lean\. The trusted base thus shrinks to three defining lines a reviewer checks by reading: the signed magnitude an FP32 bit pattern denotes \(in units of2−1492^\{\-149\}\), the exact valuefmaExact=sA​sB\+sC⋅2149\\texttt\{fmaExact\}=s\_\{A\}s\_\{B\}\+s\_\{C\}\\cdot 2^\{149\}\(in units of2−2982^\{\-298\}\), and the nearest\-among\-representables predicate\. The datapath additionally remains cross\-checked by the SMTFloatingPointtheory and the SoftFloat differential\.

## 9Related work

Mechanized floating\-point verification has a long lineage: Harrison verified IEEE division and transcendental functions for Intel in HOL Light\[[5](https://arxiv.org/html/2607.23715#bib.bib5)\]; Russinoff verified arithmetic units at AMD in ACL2\[[6](https://arxiv.org/html/2607.23715#bib.bib6)\]; the Flocq\[[3](https://arxiv.org/html/2607.23715#bib.bib3)\]Coq library formalizes IEEE\-754 and underpins verified compilers and the FloVer\[[4](https://arxiv.org/html/2607.23715#bib.bib4)\]round\-off analyzer\. These efforts prove hardware or kernels correctly rounded against a real/rational specification — the methodology our Tier\-2 multiplier proofs follow, through to the end\-to\-end value\-levelfmatheorem\. On the automated side, the SMT\-LIBFloatingPointtheory\[[7](https://arxiv.org/html/2607.23715#bib.bib7)\]and solvers such as z3, cvc5, and Bitwuzla decide bit\-vector floating\-point formulas, and Lean’sbv\_decide\[[8](https://arxiv.org/html/2607.23715#bib.bib8)\]brings LRAT\-certified bit\-blasting into Lean, validating solver certificates with a verified checker run under compiled native evaluation; all hit the multiplier wall onfma, which our two\-tier split \(exhaustive SMT below the wall, structured Lean above\) and our multiplier\-cancelling equivalence proof are organized to route around\. Berkeley SoftFloat\[[15](https://arxiv.org/html/2607.23715#bib.bib15)\]is the standard differential oracle\. We are not aware of prior work that delivers FP32/BF16*as a verified, synthesizable HDL feature*from a single source, nor of the specific device of pairing a provably\-wide exactfmareference with a bounded GRS datapath and joining them by an equivalence in which the multiplier cancels\.

## 10Limitations

The proofs establish equivalence and correct rounding of the Lean\-rendered models; transfer to the emitted SystemVerilog rests on the SV and Lean renderers denoting the same IR semantics\. The shared linearizer reduces this to a per\-operator correspondence rather than a whole\-function obligation, and for the SystemVerilog renderer that correspondence is now machine\-checked: Yosys — an independent implementation of SystemVerilog semantics — reads the emitted SV and exports it to SMT, and a solver proves the export equivalent to the SMT renderer’s model,unsatfor all2424exposed operators — including the saturating integer conversions — \(the twofmamiters via a sound510510\-way case\-split on the alignment gap, under which both barrel shifters collapse; the split covers all inputs by construction\)\. Three mechanical transformations sit inside this path and are part of its trust base, disclosed in the artifact: a syntactic declaration\-hoisting preprocessor on the SV \(Yosys cannot parse declaration\-with\-initializer inside functions\), Yosys’sopt\_cleandead\-wire removal after flattening, and a specialization of the SMT export that eliminates Yosys’s state sort by instantiating it at the single state constant\. Modulo those, a divergence would have to be a bug shared with Yosys’s independent frontend\. The Lean renderer remains covered by the byte\-identical regeneration audit\. Relatedly, the IR and both formal models are two\-state: SystemVerilogX/Zbehavior is out of scope, the verified statements quantify over binary inputs, and driving every input is the environment’s obligation\. The IEEE\-754 anchor is proved end to end against a value\-level dyadic specification of the exacta⋅b\+ca\\cdot b\+c\(Section[8](https://arxiv.org/html/2607.23715#S8)\); the residual trust there is the three\-line spec itself — the signed magnitude a bit pattern denotes, the exact\-value expression, and the nearest\-among\-representables predicate — checked by reading\. The verified contract is value semantics under static rounding \(Section[4](https://arxiv.org/html/2607.23715#S4)\): dynamic rounding modes, IEEE status flags, and signaling comparisons are not implemented, and NaN payloads follow an explicit canonical profile\. The synthesis numbers are preliminary characterizations from a single flow on a single open cell library and corner \(Nangate45, typical\); a multi\-corner, multi\-library study is future work\. Finally, the BF16fmais, by design, fused f32\-accumulate and not correctly rounded, as Section[4](https://arxiv.org/html/2607.23715#S4)states\.

## 11Conclusion

We added first\-class FP32 and BF16 to a hardware description language and verified every operator against its stated contract from a single source — end to end, with the SystemVerilog renderer correspondence machine\-checked and the Lean renderer audited \(Section[10](https://arxiv.org/html/2607.23715#S10)\); for the BF16fma, that contract is the FP32\-accumulating fusion of Section[4\.3](https://arxiv.org/html/2607.23715#S4.SS3)\. The methodology splits at the solver\-tractability frontier — exhaustive SMT below the multiplier wall, structured Lean above — and the headline result turns a timing problem into a verification one and dispatches it cleanly: a correctly roundedfmacan be made fast and pipelineable by replacing its exact\-wide datapath with a bounded sticky fold, and the replacement can be proved bit\-identical to the exact reference over all2962^\{96\}inputs*without ever solving a multiplier equivalence*, because the shared multiplier cancels\. We see the two\-reference pattern — an inspectable wide specification plus a synthesizable bounded implementation, joined by a multiplier\-cancelling equivalence proof — as broadly applicable to multiplier\-bearing arithmetic that defeats direct bit\-blasting\.

#### Availability\.

The compiler, the operator IR and its three renderers, and the Lean development are intended for open release; the proofs are reproducible with Lean 4 \(v4\.30\.0\) and a standardbv\_decidetoolchain\.

## References

- \[1\]IEEE,*IEEE Standard for Floating\-Point Arithmetic*, IEEE Std 754\-2019 \(and 754\-2008\)\.
- \[2\]D\. Kalamkar, D\. Mudigere, N\. Mellempudi, et al\., “A Study of BFLOAT16 for Deep Learning Training,” arXiv:1905\.12322, 2019\.
- \[3\]S\. Boldo and G\. Melquiond, “Flocq: A Unified Library for Proving Floating\-Point Algorithms in Coq,”*20th IEEE Symposium on Computer Arithmetic \(ARITH\)*, 2011\.
- \[4\]H\. Becker, E\. Darulova, M\. O\. Myreen, and Z\. Tatlock, “FloVer: A Certificate Checker for Finite\-Precision Round\-off Error,”*Tools and Algorithms for the Construction and Analysis of Systems \(TACAS\)*, 2018\.
- \[5\]J\. Harrison, “Formal Verification of Floating Point Trigonometric Functions,”*Formal Methods in Computer\-Aided Design \(FMCAD\)*, 2000\.
- \[6\]D\. M\. Russinoff,*Formal Verification of Floating\-Point Hardware Design: A Mathematical Approach*, Springer, 2018\.
- \[7\]M\. Brain, C\. Tinelli, P\. Rümmer, and T\. Wahl, “An Automatable Formal Semantics for IEEE\-754 Floating\-Point Arithmetic,”*22nd IEEE Symposium on Computer Arithmetic \(ARITH\)*, 2015\. \(SMT\-LIBFloatingPointtheory\.\)
- \[8\]Leanbv\_decide: an LRAT\-certified bit\-vector decision procedure for Lean 4 \(Lean FRO\); certificates are validated by a formally verified checker executed via Lean’s native evaluator\.
- \[9\]A\. Biere, “Collection of Combinational Arithmetic Miters Submitted to the SAT Competition 2016,”*Proc\. SAT Competition 2016 — Solver and Benchmark Descriptions*, University of Helsinki, Dept\. of Computer Science Series B\-2016\-1, pp\. 65–66, 2016\.
- \[10\]P\. Beame and V\. Liew, “Towards Verifying Nonlinear Integer Arithmetic,”*Computer Aided Verification \(CAV\)*, 2017\.
- \[11\]D\. Kaufmann, A\. Biere, and M\. Kauers, “Verifying Large Multipliers by Combining SAT and Computer Algebra,”*Formal Methods in Computer\-Aided Design \(FMCAD\)*, pp\. 28–36, 2019\.
- \[12\]NVIDIA Corporation,*NVIDIA A100 Tensor Core GPU Architecture*\(Ampere architecture whitepaper\), v1\.0, 2020\.[https://www\.nvidia\.com/content/dam/en\-zz/Solutions/Data\-Center/nvidia\-ampere\-architecture\-whitepaper\.pdf](https://www.nvidia.com/content/dam/en-zz/Solutions/Data-Center/nvidia-ampere-architecture-whitepaper.pdf)
- \[13\]Google Cloud, “Improve Your Model’s Performance with bfloat16,” Cloud TPU documentation\.[https://cloud\.google\.com/tpu/docs/bfloat16](https://cloud.google.com/tpu/docs/bfloat16)
- \[14\]L\. Cruz\-Filipe, M\. J\. H\. Heule, W\. A\. Hunt, M\. Kaufmann, and P\. Schneider\-Kamp, “Efficient Certified RAT Verification,”*Automated Deduction — CADE 26*, LNCS 10395, pp\. 220–236, 2017\.
- \[15\]J\. Hauser,*Berkeley SoftFloat*, release 3e\.[http://www\.jhauser\.us/arithmetic/SoftFloat\.html](http://www.jhauser.us/arithmetic/SoftFloat.html)

Similar Articles

More Floating Point Alternatives

Hacker News Top

This article explains various software-based alternatives to floating-point arithmetic, including decimal floating point, fractions, symbolic computation, interval arithmetic, and binary-coded decimal.

Novel Aspects of IEEE SA P3109 Arithmetic Formats for Machine Learning

arXiv cs.LG

The IEEE P3109 draft standard defines a parameterized family of binary floating-point formats and operations tailored for machine learning, supporting configurable width, precision, signedness, and infinities, along with extensive rounding modes including stochastic rounding and a novel scale-invariant approximation measure called kappa-approximation.

Moving integer division to floating-point is trivial

Lobsters Hottest

A technical blog post explains how to perform integer division and remainder using floating-point division and fused multiply-add, with constraints on operand bit widths, and discusses practical considerations for SIMD and rounding modes.