用形式化验证实现可综合的浮点运算,确保精度与安全
Formally Verified Synthesizable Floating-Point Data Types in ARCH HDL
- 统一源码生成三种硬件表示:可综合Verilog、SMT模型和数学证明
- 所有浮点运算经机器验证,乘法运算在98位路径下实现268MHz流水线
- 关键创新是通过共享乘法器消去复杂性,使等价性可证且不依赖求解器
我们报告了首个在ARCH硬件描述语言中设计并端到端验证的一等公民级IEEE-754 binary32(FP32)和bfloat16(BF16)算术。所有操作符——比较、转换、加、减、乘及融合乘加(FMA)——仅基于单一比特向量中间表示描述,并从同一源生成可综合SystemVerilog、SMT-LIB模型和Lean 4证明模型。三者结构不可偏离,节点对应关系由机器检查:通过Yosys-to-SMT对比器证明生成的SystemVerilog与SMT模型对所有24个操作符等价。验证分界于求解器可处理边界:无乘法操作(比较、加减所有2^64输入、转换及所有二进制BF16运算)被完全等价证明;含乘法操作(FP32乘与FMA)则在Lean中以值级舍入到最近偶数规范,无需抱歉地证明正确舍入。物理特性分析显示FMA为时序瓶颈:其精确宽470位数据通路无法在当前流程中流水。我们将其重实现为98位保护/舍入/粘滞路径,可在Nangate45上达到268 MHz流水,且在Lean中对所有2^96输入证明与原精确参考路径比特完全一致,从而继承其已证明的正确舍入性质。等价性可处理正是由于双方共享乘法器可抵消,无需任何一方求解乘法等价。此外,BF16 FMA被刻意设计为基于FP32累加的融合运算,明确定义为此类。所有机器检查断言均绑定至一个带标签的开源发布版本。
原文摘要 · Abstract (English)
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.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。