# Verilator

**Verilator** 是一款开源工具，它将 Verilog 和 [SystemVerilog](https://www.edgepedia.org/zh/systemverilog) 硬件描述语言（HDL）设计转换为 C++ 或 SystemC 模型，经编译后即可执行；它是一款编译器，而非传统的事件驱动仿真器。<sup>[1](https://verilator.org/guide/latest/overview.html)</sup> 其 GitHub 仓库将其描述为“开源 SystemVerilog 仿真器与静态代码检查系统”，项目 FAQ 则将其列为“四大”SystemVerilog 仿真器之一，与闭源的 [Synopsys VCS](https://www.edgepedia.org/zh/synopsys-vcs)、Mentor Questa/ModelSim 以及 [Cadence Xcelium](https://www.edgepedia.org/zh/cadence-xcelium)/Incisive/NC-Verilog 并列。<sup>[2](https://github.com/verilator/verilator)</sup><sup> • </sup><sup>[3](https://verilator.org/guide/latest/faq.html)</sup>

| 关键事实 | 详情 |
|---|---|
| 功能 | 将 Verilog（IEEE 1364，1995、2001、2005 版）和 SystemVerilog（IEEE 1800，2005 至 2023 版）转换为编译型 C++ 或 SystemC 仿真模型<sup>[1](https://verilator.org/guide/latest/overview.html)</sup> |
| 定位 | 四大领先 SystemVerilog 仿真器之一，也是其中唯一的开源产品<sup>[3](https://verilator.org/guide/latest/faq.html)</sup> |
| 起源 | 1994 年诞生于数字设备公司（Digital Equipment Corp），当时 Paul Wasson 将 Verilog 综合为 C++；后由 DEC 开源发布<sup>[4](https://verilator.org/papers/Verilator_Open_Simulation_DVClub13_pres.pdf)</sup> |
| 许可证 | GNU 宽通用公共许可证第 3 版或 Perl 艺术许可证第 2.0 版；2003—2026 年版权归 Wilson Snyder 所有<sup>[2](https://github.com/verilator/verilator)</sup> |
| 治理 | 由 Linux 基金会下属的 CHIPS 联盟指导的社区项目<sup>[2](https://github.com/verilator/verilator)</sup> |
| 当前版本 | Verilator 5.052，2026-09-05 发布，支持 UVM 2020-3.2<sup>[5](https://verilator.org/guide/latest/changes.html?page=1)</sup> |
| 实测速度 | 在 Embecosm 的一项基准测试中，仿真时钟频率达 42.66 kHz，而 Icarus Verilog 为 1.48 kHz，快近 30 倍<sup>[6](https://www.embecosm.com/appnotes/ean6/html/ch06s05s01.html)</sup> |

## Verilation 的工作原理

Verilator 软件包接收 Verilog 或 SystemVerilog 代码，对其执行静态代码检查，可根据需要添加覆盖率与波形追踪支持，然后将设计编译为多线程的源码级 C++ 或 SystemC“模型”，以 .cpp 和 .h 文件形式输出。项目将这一过程称为“Verilating”，结果称为“Verilated”模型。<sup>[1](https://verilator.org/guide/latest/overview.html)</sup> `--cc` 选项面向 C++，`--sc` 面向 SystemC，`--binary` 则转换为 C++ 并编译为可执行文件。<sup>[7](https://verilator.org/guide/latest/verilating.html?highlight=multithread)</sup>

随后，仿真以编译程序的风格进行，而非解释网表。用户编写一个小的 C++ 封装，定义 `main()`，将 Verilated 模型实例化为 C++ 或 SystemC 对象并驱动它；封装、生成的文件以及 Verilator 的运行时库用 C++ 编译器编译，生成仿真可执行文件。<sup>[1](https://verilator.org/guide/latest/overview.html)</sup> Verilator 不推进时间：调用方应用切换时钟等输入，并在循环中调用模型的 `eval()` 方法。<sup>[4](https://verilator.org/papers/Verilator_Open_Simulation_DVClub13_pres.pdf)</sup> 启用后，可执行文件还可生成波形追踪和覆盖率分析数据。<sup>[1](https://verilator.org/guide/latest/overview.html)</sup>

**大型设计。** Verilating 大型设计可能需要 10 分钟以上和超过 100 GB 内存，因为 Verilator 内部会构建生成仿真器的完整状态以进行优化；超大型设计的常驻内存集大小已超过 64 GB。<sup>[7](https://verilator.org/guide/latest/verilating.html?highlight=multithread)</sup><sup> • </sup><sup>[8](https://veripool.org/guide/latest/faq.html)</sup> 对此，分层 Verilation 允许用户手动拆分出大型底层模块，例如多核 SoC 中的 CPU 核，并通过 `--lib-create` 将其 Verilate 为独立库，代价是仿真速度有所损失，且存在限制，如层次块内不允许延迟。<sup>[7](https://verilator.org/guide/latest/verilating.html?highlight=multithread)</sup>

## 语言支持与限制

Verilator 支持语言的可综合子集，并随时间添加了验证构造。<sup>[9](https://verilator.org/guide/latest/languages.html)</sup> 其事件语义遵循 Synopsys 的 Design Compiler：诸如 `always @(x) y = x & z;` 的块在 x 或 z 可能变化时重新计算 y，而完全合规的仿真器仅在 x 变化时重新计算；文档建议使用 `always_comb` 以获得可移植行为。<sup>[9](https://verilator.org/guide/latest/languages.html)</sup>

若干限制被声明为有意为之。Verilator 仅支持 `bind` 到目标模块名，不支持实例路径；断言及断言驱动的功能覆盖率部分支持；SystemVerilog [功能覆盖率](https://www.edgepedia.org/zh/functional-coverage)中的 `covergroup`、`coverpoint`、bins、交叉覆盖和转换 bins 部分支持；开源仿真器无法使用 IEEE P1735 下的加密 RTL，Verilator 为此提供 `--protect-lib` 功能作为 IP 交付的替代方案。<sup>[9](https://verilator.org/guide/latest/languages.html)</sup> 信号名会为 C 兼容性进行改写：任何非字母数字或单个下划线的字符都会被替换为 `__0hh`，其中 hh 为该字符的十六进制码。<sup>[9](https://verilator.org/guide/latest/languages.html)</sup>

默认情况下，Verilator 是二态仿真器，仅表示逻辑 0 和 1，速度更快、内存效率更高，但无法表达捕获初始化缺陷或总线争用所需的 `x`（未知）和 `z`（高阻）状态。四态逻辑的初始实现由 Antmicro 在 CHIPS 联盟内贡献，于 2026 年 7 月公布；它将四态变量表示为二态变量对，以便现有优化继续有效。<sup>[10](https://www.chipsalliance.org/news/initial-implementation-verilator/?trk=article-ssr-frontend-pulse_little-text-block)</sup>

## 性能

由于设计被编译为原生代码，Verilator 的速度源于消除了传统仿真器的解释器循环。在 Embecosm 对某一设计的比较中，Verilator 达到 42.66 kHz，而 [Icarus Verilog](https://www.edgepedia.org/zh/icarus-verilog) 为 1.48 kHz，快近 30 倍；报告将差距部分归因于 Verilator 是二态的，且不在时钟周期内建模任何内容。<sup>[6](https://www.embecosm.com/appnotes/ean6/html/ch06s05s01.html)</sup> 康奈尔大学的一篇论文测量开源仿真吞吐量，报告 Verilator 在其基准测试中每秒 1500 万至 1800 万个周期。<sup>[11](https://www.csl.cornell.edu/~cbatten/pdfs/jiang-pymtl3-cuthesis2021.pdf)</sup> 特斯拉在 Hot Chips 2019 演讲中报告使用 Verilator 获得约 30 倍加速。<sup>[12](https://veripool.org/verilator/documentation/)</sup>

多线程执行将宏任务静态分配给线程，每个线程按固定顺序运行其宏任务，仅阻塞等待其他线程上的前置条件完成；生成的代码描述每个宏任务图，包含每任务函数、估计成本、触发位和依赖关系，运行时库执行该图。<sup>[13](https://github.com/verilator/verilator/blob/master/docs/internals.rst)</sup> 项目指出，更好的运行时成本估计将改善多线程性能。<sup>[13](https://github.com/verilator/verilator/blob/master/docs/internals.rst)</sup>

## 历史

Verilator 于 1994 年诞生于数字设备公司，当时 Verilog 是新的综合语言，C++ 是测试平台语言，没有好的工具将两者耦合；因此 Paul Wasson 将 Verilog 综合为 C++。该工具随 ARM 业务部门的出售进入英特尔，Duane Galbi 在那里进行了第二次重写，随后 DEC 将 Verilator 开源发布。<sup>[4](https://verilator.org/papers/Verilator_Open_Simulation_DVClub13_pres.pdf)</sup> 1.0 版几乎将 Verilog 逐语句映射到 C。<sup>[14](https://www.veripool.org/papers/verilator_philips_internals.pdf)</sup> 此后 Wilson Snyder 一直维护该项目；版权声明从 2003 年延续至 2026 年。<sup>[2](https://github.com/verilator/verilator)</sup>

2013 年的一次项目演示记录了功能的逐步积累：2007 年和 2011 年添加静态代码检查功能，SystemVerilog 解析覆盖约 95% 的语言，有符号数（2005 年），包与导入（2010 至 2012 年），打包结构（2012 年），DPI/VPI（2010 年），以及模型保存/恢复（2012 年）。<sup>[4](https://verilator.org/papers/Verilator_Open_Simulation_DVClub13_pres.pdf)</sup>

## 验证功能与近期发展

5.002 版（2022-10-29）是一次重大发布：它要求 C++20 以支持新的 `--timing` 功能，支持 IEEE 1800-2017 定义的 Active 和 NBA 调度区域，使生成时钟正确仿真，添加了延迟、事件控制、wait 语句和 fork 等时序控制，并引入了 `--binary` 选项。<sup>[5](https://verilator.org/guide/latest/changes.html?page=1)</sup> Verilator 的时序支持通过 C++20 协程实现。<sup>[13](https://github.com/verilator/verilator/blob/master/docs/internals.rst)</sup> 对所有模型的 C++20 要求仍然搁置，直到 Ubuntu LTS 版本的 GCC 和 clang 默认使用 C++20，估计为 2028 年 5 月。<sup>[15](https://verilator.org/guide/latest/deprecations.html)</sup>

**UVM 支持。** [通用验证方法学](https://www.edgepedia.org/zh/universal-verification-methodology)（UVM）测试平台历史上仅在专有仿真器上运行，Verilator 此前未专注于 UVM 风格的验证。<sup>[16](https://www.chipsalliance.org/news/open-source-systemverilog-tools-in-asic-design/)</sup> Antmicro 在 CHIPS 联盟内与维护者 Wilson Snyder 合作，历时数年构建了前提条件，包括用协程增强的动态调度和约束随机化；2025 年 11 月，CHIPS 联盟宣布 Verilator 无需补丁或变通办法即可展开上游 UVM 2017-1.0。<sup>[17](https://www.chipsalliance.org/news/uvm-verilator/)</sup> 5.050 版（2026-07-01）添加了对 covergroup、coverpoint 和 bins 的支持，5.052 版（2026-09-05）添加了对 UVM 2020-3.2 的支持。<sup>[5](https://verilator.org/guide/latest/changes.html?page=1)</sup>

**生态系统。** Verilator 被开源硬件项目使用，包括 OpenTitan/lowRISC、Ibex 32 位 RISC-V 核、VeeR RISC-V 核、ZipCPU 和 Caliptra，并且是基于 Python 的 cocotb 验证框架最快流程背后的仿真器。<sup>[12](https://veripool.org/verilator/documentation/)</sup><sup> • </sup><sup>[18](https://www.cocotb.org/)</sup> 它还在研究工具链中充当仿真引擎，例如一个基于 LLM 的 Verilog 生成基准，通过 Verilator 编译验证生成的代码。<sup>[19](https://arxiv.org/abs/2607.22759)</sup> Antmicro 等公司提供商业支持。<sup>[20](https://offering.antmicro.com/)</sup>

## References

1. [Overview, Verilator 5.052 documentation](https://verilator.org/guide/latest/overview.html)
2. [verilator/verilator GitHub repository](https://github.com/verilator/verilator)
3. [FAQ, Verilator 5.052 documentation](https://verilator.org/guide/latest/faq.html)
4. [Verilator: Open Simulation Growing Up, Wilson Snyder, DVClub Bristol, January 2013](https://verilator.org/papers/Verilator_Open_Simulation_DVClub13_pres.pdf)
5. [Revision History, Verilator 5.052 documentation](https://verilator.org/guide/latest/changes.html?page=1)
6. [Comparison with Event Driven Simulation, Embecosm Application Note ean6](https://www.embecosm.com/appnotes/ean6/html/ch06s05s01.html)
7. [Verilating, Verilator 5.052 documentation](https://verilator.org/guide/latest/verilating.html?highlight=multithread)
8. [FAQ, Verilator documentation (Veripool mirror)](https://veripool.org/guide/latest/faq.html)
9. [Input Languages, Verilator 5.052 documentation](https://verilator.org/guide/latest/languages.html)
10. [Initial implementation of four-state logic in the open source Verilator RTL simulator, CHIPS Alliance, July 22, 2026](https://www.chipsalliance.org/news/initial-implementation-verilator/?trk=article-ssr-frontend-pulse_little-text-block)
11. [Motivation: Simulation Performance Comparison, Jiang, Cornell University thesis, 2021](https://www.csl.cornell.edu/~cbatten/pdfs/jiang-pymtl3-cuthesis2021.pdf)
12. [Verilator documentation and papers list, Veripool](https://veripool.org/verilator/documentation/)
13. [Verilator Internals, verilator/verilator docs on GitHub](https://github.com/verilator/verilator/blob/master/docs/internals.rst)
14. [Verilator Internals, Wilson Snyder, Philips Semiconductors, July 2005](https://www.veripool.org/papers/verilator_philips_internals.pdf)
15. [Deprecations, Verilator 5.052 documentation](https://verilator.org/guide/latest/deprecations.html)
16. [Open Source SystemVerilog Tools in ASIC Design, CHIPS Alliance](https://www.chipsalliance.org/news/open-source-systemverilog-tools-in-asic-design/)
17. [Support for upstream UVM 2017 in Verilator, CHIPS Alliance, November 24, 2025](https://www.chipsalliance.org/news/uvm-verilator/)
18. [cocotb: Python verification framework](https://www.cocotb.org/)
19. [Benchmarking LLMs for Verilog Design Flows, arXiv](https://arxiv.org/abs/2607.22759)
20. [Antmicro commercial offer for Verilator](https://offering.antmicro.com/)

---
*Initially written Oct 15, 2026*

Topic: 社会与历史 › 经济与商业 › 创始人、经营者与投资者 › Technology founders and companies › Semiconductors and hardware › United States chips and hardware › EDA and design tools

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/verilator

English original: https://www.edgepedia.org/verilator
