# 形式等价性验证

形式等价性验证是一种验证方法，它用数学方法证明两个电路设计或系统模型在功能上是否等价，例如证明综合后的门级网表与其黄金RTL（寄存器传输级：物理门实现之前的硬件设计描述）行为完全一致。它与模型检验并列为形式验证最常见的两种形式。<sup>[1](https://www.spec.org/cpu2026/Docs/benchmarks/829.abc_s/cav10_abc.pdf)</sup> 仿真只对碰巧运行的向量抽查行为，而完成的形式等价性证明则针对编码模型和所述假设所允许的全部行为建立等价性，这些行为未必包含所有可能的输入或初始状态。<sup>[2](https://mpardalos.com/publications/equifuzz.pdf)</sup>

| 关键事实 | 详情 |
|---|---|
| 证明的是什么 | 两个设计在模型和所述假设所允许的全部行为范围内的功能同一性，而非测试向量的抽样<sup>[2](https://mpardalos.com/publications/equifuzz.pdf)</sup> |
| 核心判定过程 | 构建对比电路（miter），将其编码为CNF，运行SAT求解器；UNSAT证明等价，SAT给出反例<sup>[1](https://www.spec.org/cpu2026/Docs/benchmarks/829.abc_s/cav10_abc.pdf)</sup> |
| 复杂度 | 组合等价性验证是co-NP困难的；时序等价性存在\( 2^{n} \)状态爆炸，且没有已知的多项式时间算法<sup>[3](https://people.eecs.berkeley.edu/~alanmi/publications/2006/iccad06_cec.pdf)</sup><sup> • </sup><sup>[4](https://people.eecs.berkeley.edu/~alanmi/courses/2008_290A/papers/sakallah_dtc05.pdf)</sup> |
| 主要变体 | 组合LEC（RTL到门级的签核）、时序等价性验证，以及C/C++/SystemC到RTL的验证<sup>[5](https://dvcon-proceedings.org/wp-content/uploads/using-model-checking-to-prove-constraints-of-combinational-equivalence-checking.pdf)</sup><sup> • </sup><sup>[2](https://mpardalos.com/publications/equifuzz.pdf)</sup> |
| 已展示的容量 | 不到20个CPU分钟内完成260万门网表对网表的比较（Gatecomp）；商用LEC工具约20分钟处理50万门设计<sup>[6](https://agra.informatik.uni-bremen.de/doc/work/workshops/gatecomp.PDF)</sup><sup> • </sup><sup>[7](https://averant.com:8443/assets/pdf/FEV2Itself.pdf)</sup> |
| 商用工具 | Cadence Conformal、Synopsys Formality和Siemens FormalPro（原Mentor Formal-Pro）；C到RTL检查器包括Synopsys DPV、Cadence Jasper C2RTL和Siemens SLEC<sup>[7](https://averant.com:8443/assets/pdf/FEV2Itself.pdf)</sup><sup> • </sup><sup>[2](https://mpardalos.com/publications/equifuzz.pdf)</sup> |

## 工作原理

标准构造是对比电路：两个电路中同名的输入相连，每一对同名的输出各接一个异或门；所有异或门的输出再或成一个单一输出。证明等价就是要证明这个对比电路的输出恒为0。<sup>[1](https://www.spec.org/cpu2026/Docs/benchmarks/829.abc_s/cav10_abc.pdf)</sup> 该检查由[SAT求解器](https://www.edgepedia.org/zh/sat-solver)判定：用Tseitin编码将对比电路编码为命题公式，并将失配输出约束为1；当且仅当该约束公式不可满足时，两个电路等价。<sup>[8](https://www.isec.tugraz.at/wp-content/uploads/2023/09/LAC_Lecture_Notes_eqchecking.pdf)</sup> 可满足的结果本身也有用：主输入的一个满足赋值就是能复现失配、供调试使用的反例。<sup>[1](https://www.spec.org/cpu2026/Docs/benchmarks/829.abc_s/cav10_abc.pdf)</sup>

这个问题很难。组合等价性验证是co-NP困难的，现有方法在新的应用和更大的实例上会失效。<sup>[3](https://people.eecs.berkeley.edu/~alanmi/publications/2006/iccad06_cec.pdf)</sup> 对于时序情形，含\( n \)个存储元件的电路其状态转移图有\( 2^{n} \)个顶点，即状态爆炸问题，且没有已知的多项式时间验证算法。<sup>[4](https://people.eecs.berkeley.edu/~alanmi/courses/2008_290A/papers/sakallah_dtc05.pdf)</sup> 因此实用工具会利用结构：现代流程从与-非图表示出发，用哈希检测对比电路中的结构相似性，通过仿真找出全局函数相等的节点类，并在资源限制下应用BDD或SAT检查。<sup>[3](https://people.eecs.berkeley.edu/~alanmi/publications/2006/iccad06_cec.pdf)</sup>

## 如何实施

一次典型的运行遵循固定顺序：读入参考（黄金）模型，读入实现模型，定义两者之间的匹配点，进行验证，然后对报告的差异进行诊断和调试。<sup>[9](https://www.cerc.utexas.edu/~jaa/verification/lectures/3-2.pdf)</sup>

若干实用机制会影响运行的形态。组合检查器只证明状态点之间逻辑锥的等价性，因此所有状态点必须在RTL与门级之间正确映射。<sup>[5](https://dvcon-proceedings.org/wp-content/uploads/using-model-checking-to-prove-constraints-of-combinational-equivalence-checking.pdf)</sup> 切点是被映射并像锁存器一样验证的非状态内部信号，它把大的组合锥切分，以减少所分析的逻辑；极端情况下会改写RTL以便匹配它们。<sup>[9](https://www.cerc.utexas.edu/~jaa/verification/lectures/3-2.pdf)</sup> 黑盒，例如硬IP、大型嵌入式存储器和乘法器，其内部被工具忽略，因此只验证其输入引脚的驱动端和接收端，从而留下验证空洞。<sup>[9](https://www.cerc.utexas.edu/~jaa/verification/lectures/3-2.pdf)</sup> 综合期间插入的扫描链必须通过约束禁用，否则会产生更多空洞。<sup>[9](https://www.cerc.utexas.edu/~jaa/verification/lectures/3-2.pdf)</sup>

## 起源

该方法源于早期几条研究脉络。戈登·L·史密斯（Gordon L. Smith）、拉尔夫·J·巴恩森（Ralph J. Bahnsen）和哈里·哈利韦尔（Harry Halliwell）于1982年在《IBM研究与开发杂志》上发表了早期将硬件与流程图进行形式比较的工作。<sup>[10](https://doi.org/10.1147/rd.261.0106)</sup> 布尔函数的判定图编码以及“二元决策图”一词来自阿克斯（Akers）1978年发表在《IEEE计算机汇刊》上的工作，<sup>[11](https://doi.org/10.1109/tc.1978.1675141)</sup> 而布莱恩特（Bryant）在1986年《IEEE计算机汇刊》论文中描述的约简有序BDD表示与算法，使基于BDD的检查变得实用。<sup>[12](https://doi.org/10.1109/tc.1986.1676819)</sup> 时序方面，C·皮克斯利（C. Pixley）于1992年在《IEEE计算机辅助设计汇刊》上发表了时序硬件等价性的理论与实现，<sup>[13](https://doi.org/10.1109/43.180261)</sup> C.A.J.范艾克（C.A.J. van Eijk）于2000年在同一期刊上发表了基于结构相似性的时序方法。<sup>[14](https://doi.org/10.1109/43.851997)</sup> 莱瑟森（Leiserson）和萨克斯（Saxe）于1991年发表在《Algorithmica》上的重定时变换，正是破坏时序检查中状态匹配的那种变换。<sup>[15](https://doi.org/10.1007/bf01759032)</sup>

后来的技术将该方法扩展到工业规模。一种方法将BDD与电路图哈希、多个切分前沿的自动插入，以及对切分所致假阴性的受控消除结合起来。<sup>[16](https://dl.acm.org/doi/10.1145/266021.266090)</sup> 工业化产生了Siemens/英飞凌（Infineon）的Gatecomp工具<sup>[6](https://agra.informatik.uni-bremen.de/doc/work/workshops/gatecomp.PDF)</sup>以及商用LEC工具Conformal、Formal-Pro和Formality。<sup>[7](https://averant.com:8443/assets/pdf/FEV2Itself.pdf)</sup>

## 变体

**组合与时序。** CEC证明状态点之间组合逻辑锥的等价性，并要求所有状态点都被映射；时序等价性验证（SEC）遍历两个设计的积有限状态机，从电路输入和先前状态点值出发证明等价性，因此中间状态点不必对应。若将时序电路展平并把状态点折叠进一个组合电路，SEC就退化为CEC。<sup>[5](https://dvcon-proceedings.org/wp-content/uploads/using-model-checking-to-prove-constraints-of-combinational-equivalence-checking.pdf)</sup>

**较弱的时序概念。** 对于没有复位的电路，安全替换等价性要求一台机器的I/O行为的每个状态都能由另一台机器的某个状态复现，而同步同态等价性不对上电状态作任何假设。<sup>[4](https://people.eecs.berkeley.edu/~alanmi/courses/2008_290A/papers/sakallah_dtc05.pdf)</sup>

**C到RTL检查。** Synopsys DPV、Cadence Jasper C2RTL和Siemens SLEC等检查器证明RTL实现与用C/C++/[SystemC](https://www.edgepedia.org/zh/systemc)编写的规范相符。<sup>[2](https://mpardalos.com/publications/equifuzz.pdf)</sup> 同样的异或不可满足性公式仍然适用：当规范与实现的异或对所有输入都不可满足时，等价性成立。<sup>[17](https://iris.polito.it/retrieve/75a3a520-45bb-409c-a7f9-69076c5230fb/articolo_raia24.pdf)</sup>

## 应用

RTL到门级的逻辑等价性验证是确保门级电路不改变RTL功能行为的关键步骤。<sup>[5](https://dvcon-proceedings.org/wp-content/uploads/using-model-checking-to-prove-constraints-of-combinational-equivalence-checking.pdf)</sup> 它还用于综合回归、布局后与ECO检查，以及C到RTL数据通路验证；开源引擎ABC和Yosys EQY覆盖RTL与门级逻辑等价性，商用工具则覆盖数据通路与签核流程。<sup>[18](https://arxiv.org/abs/2604.16571)</sup>

已发表的容量数据大多是历史性的。Gatecomp在不到20个CPU分钟内验证了约260万门的网表对网表比较，<sup>[6](https://agra.informatik.uni-bremen.de/doc/work/workshops/gatecomp.PDF)</sup> 商用LEC工具据称通过分治为许多小的组合比较，可在约20分钟内比较50万门设计。<sup>[7](https://averant.com:8443/assets/pdf/FEV2Itself.pdf)</sup>

近期工作改进了引擎并拓宽了前端。截至2024年，最先进的做法采用混合方法，沿两个电路的拓扑结构推进，并用结构感知引擎发出增量SAT查询，而不是把整个对比电路一次性翻译成CNF做单体求解。<sup>[19](https://cca.informatik.uni-freiburg.de/papers/BiereFazekasFleuryFroleyks-FMCAD24.pdf)</sup> FastLEC将SAT求解、BDD推理和等价性扫掠集成到一个混合CEC框架中，具备数据通路感知的结构信息和自适应引擎调度。<sup>[20](https://arxiv.org/html/2512.06627v1)</sup> EquivFusion（2026）通过MLIR/CIRCT读入PyTorch、C/C++、Chisel、[Verilog](https://www.edgepedia.org/zh/verilog)和门级网表，构建对比电路，并分别导出为SMT-LIB、BTOR2和AIGER，供Z3、Bitwuzla和Kissat求解器使用。<sup>[18](https://arxiv.org/abs/2604.16571)</sup> 在开源方面，Yosys EQY工具通过在NERV CPU中发现一个移位器缺陷并在修复后确认等价性，展示了完整的RISC-V流程。<sup>[21](https://yosyshq.readthedocs.io/projects/eqy/en/latest/quickstart.html)</sup>

## 局限与替代方案

代价最高的失败是假阳性：工具把不等价的设计标为等价。由于等价性验证通常决定能否进入下一设计阶段，流片时的错误答案意味着硅片重投。<sup>[9](https://www.cerc.utexas.edu/~jaa/verification/lectures/3-2.pdf)</sup> 英特尔（Intel）记录了处理器和ASIC设计中多起真实的假阳性，最坏情况下产出死片A0硅片，其原因不是工具缺陷，而是约束、映射、黑盒化和不可达点处理的误用。<sup>[22](http://www.erikseligman.com/docs/dvcon_2007.pdf)</sup> 约束是双刃剑：它们去除了否则会导致假不等价的无效状态空间，但错误的约束会使所有CEC结果失效，因此AMD在CEC通过后用模型检验对每条约束进行形式证明。<sup>[5](https://dvcon-proceedings.org/wp-content/uploads/using-model-checking-to-prove-constraints-of-combinational-equivalence-checking.pdf)</sup>

检查器本身也可能出错。Equifuzz是一个模糊测试器，它生成随机的无输入SystemC程序，与显然等价的RTL比较，在两个商用C到RTL检查器中发现了12个不同的缺陷，其中包括7个可能签核错误设计的不健全性缺陷；所有这些都源于两三个语言特性变换的相互作用。<sup>[2](https://mpardalos.com/publications/equifuzz.pdf)</sup> 含糊或误用的Verilog也可能同时导致假阳性和假阴性，因为工具可能对同一段RTL作出不同解释。<sup>[22](http://www.erikseligman.com/docs/dvcon_2007.pdf)</sup> 重定时违反状态匹配，因此不应指望通用等价性工具处理它；一般情形需要时序等价性验证工具。<sup>[9](https://www.cerc.utexas.edu/~jaa/verification/lectures/3-2.pdf)</sup> 推荐的防护措施包括：形式评审所有假设、监控不可达点、验证单元库、使用经lint检查且无歧义的RTL、选择来自不同厂商的综合与FEV工具，以及用门级仿真复核通过FEV验证的逻辑。<sup>[22](http://www.erikseligman.com/docs/dvcon_2007.pdf)</sup> 与仿真相比，形式检查对所有输入和周期都是完备的；尚无已发表的直接对比能确定它与硬件仿真相比如何。

## References

1. [ABC: An Academic Industrial-Strength Verification Tool (CAV 2010; SPEC CPU2026 benchmark documentation)](https://www.spec.org/cpu2026/Docs/benchmarks/829.abc_s/cav10_abc.pdf)
2. [Who checks the checkers? Automatically finding bugs in C-to-RTL Formal Equivalence Checkers (Equifuzz)](https://mpardalos.com/publications/equifuzz.pdf)
3. [Improvements to Combinational Equivalence Checking (ICCAD 2006, Mishchenko et al.)](https://people.eecs.berkeley.edu/~alanmi/publications/2006/iccad06_cec.pdf)
4. [Principles of Sequential-Equivalence Verification (IEEE Design & Test of Computers, 2005)](https://people.eecs.berkeley.edu/~alanmi/courses/2008_290A/papers/sakallah_dtc05.pdf)
5. [Using Model Checking to Prove Constraints of Combinational Equivalence Checking (DVCon, AMD)](https://dvcon-proceedings.org/wp-content/uploads/using-model-checking-to-prove-constraints-of-combinational-equivalence-checking.pdf)
6. [Gatecomp: Equivalence Checking of Digital Circuits in an Industrial Environment](https://agra.informatik.uni-bremen.de/doc/work/workshops/gatecomp.PDF)
7. [You'll never trust unix diff again! (Formal Equivalence Verification itself)](https://averant.com:8443/assets/pdf/FEV2Itself.pdf)
8. [Logic and Computability, Equivalence Checking lecture notes (TU Graz)](https://www.isec.tugraz.at/wp-content/uploads/2023/09/LAC_Lecture_Notes_eqchecking.pdf)
9. [Formal Equivalence Checking, lecture notes (UT Austin, Jacob Abraham)](https://www.cerc.utexas.edu/~jaa/verification/lectures/3-2.pdf)
10. [Gordon L. Smith, Ralph J. Bahnsen, Harry Halliwell (1982). Boolean Comparison of Hardware and Flowcharts. IBM Journal of Research and Development.](https://doi.org/10.1147/rd.261.0106)
11. [Akers (1978). Binary Decision Diagrams. IEEE Transactions on Computers.](https://doi.org/10.1109/tc.1978.1675141)
12. [Bryant (1986). Graph-Based Algorithms for Boolean Function Manipulation. IEEE Transactions on Computers.](https://doi.org/10.1109/tc.1986.1676819)
13. [C. Pixley (1992). A theory and implementation of sequential hardware equivalence. IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems.](https://doi.org/10.1109/43.180261)
14. [C.A.J. van Eijk (2000). Sequential equivalence checking based on structural similarities. IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems.](https://doi.org/10.1109/43.851997)
15. [Charles E. Leiserson, James B. Saxe (1991). Retiming synchronous circuitry. Algorithmica.](https://doi.org/10.1007/bf01759032)
16. [Equivalence checking using cuts and heaps (DAC 1997)](https://dl.acm.org/doi/10.1145/266021.266090)
17. [A Case Study on Formal Equivalence Verification Between a C/C++ Model and Its RTL Design (Politecnico di Torino, 2024)](https://iris.polito.it/retrieve/75a3a520-45bb-409c-a7f9-69076c5230fb/articolo_raia24.pdf)
18. [EquivFusion: Unifying Hardware Equivalence Checking from Algorithms to Netlists via MLIR](https://arxiv.org/abs/2604.16571)
19. [Clausal Equivalence Sweeping (FMCAD 2024)](https://cca.informatik.uni-freiburg.de/papers/BiereFazekasFleuryFroleyks-FMCAD24.pdf)
20. [FastLEC: Parallel Datapath Equivalence Checking with Hybrid Engines](https://arxiv.org/html/2512.06627v1)
21. [EQY Quickstart, EQuivalence checking with Yosys](https://yosyshq.readthedocs.io/projects/eqy/en/latest/quickstart.html)
22. [False Positives in Formal Equivalence (DVCon 2007, Intel)](http://www.erikseligman.com/docs/dvcon_2007.pdf)

---
*Initially written Sep 29, 2026 · Edited: Oct 15, 2026; Oct 21, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Algorithms and computational methods

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/formal-equivalence-checking

English original: https://www.edgepedia.org/formal-equivalence-checking
