Support for upstream UVM 2017 in Verilator
Universal Verification Methodology (UVM) is one of the most popular verification methods in digital design, focusing on standardization and reusability of verification IP and environments. For the last few years, Antmicro has been gradually completing milestones toward full UVM support in the open source Verilator RTL simulator, from dynamic scheduling (later enhanced with coroutines) through a proof-of-concept UVM testbench running in Verilator to constrained randomization.
With this article, CHIPS Alliance is happy to announce that Verilator can now elaborate upstream UVM 2017-1.0 - no patches or workarounds required. This important milestone was spearheaded by Antmicro’s efforts within CHIPS Alliance and complemented by the work of Wilson Snyder, the maintainer of Verilator, as well as the broader open source community.
The following paragraphs summarize Antmicro’s contributions that enabled UVM support in Verilator and describe the most recent developments in the project, including support for features required to enable the examples from the UVM Cookbook. A step-by-step tutorial for running Verilator with upstream UVM is also provided.
Enhancing Verilator with UVM support and better simulation analysis
Antmicro’s work with Verilator, be it on new features, bugfixes or enhancements, stems from customer projects, where the CHIPS member is either providing direct commercial support for Verilator as such for our customer’s ASIC work, or providing digital design and verification services where we use Verilator alongside other tools, both open and closed. On top of the UVM work described in this article, Antmicro is also making numerous improvements to RTL simulation analysis. From recent examples, to gain more detailed insights into the designs they work with and ensure thorough testing, the team has been improving coverage reporting or adding features like support for SAIF to enable more efficient power analysis.
Many of those use cases employ Verilator as a supporting tool, increasing productivity and development speed as well as filling gaps otherwise unserved by other workflows. To push the adoption of Verilator in modern silicon designs beyond its current footprint, especially for verification purposes, solid UVM support is however a must.
Antmicro has been steadily contributing to UVM support in Verilator over the past few years, with the ultimate goal being full UVM support, including complex testbenches. To easily track the progress of these efforts, we leverage our Verilator verification dashboard and SystemVerilog test suite, which together (among other things) help visualize the current state of UVM support in Verilator.
UVM Cookbook support
Antmicro’s most recent contributions have focused on enabling samples from the UVM Cookbook in Verilator, including support for generic interfaces. They also improved the way Verilator handles parameterized classes: added a step that resolves default class parameters upon instantiation, and fixed other bugs, such as parameter dependent type linking, typedef linking, and passing a type as a parameter. Additionally, support for nested classes was added.
When working on the examples from the Cookbook, the team managed to find a few cases where expression purity was computed incorrectly (a pure expression doesn’t contain side effects). Simple purity measurement was added to Verilator a long time ago, and in recent months this was significantly expanded, with fixed purity calculation of dynamic cast operators and the way side effects are handled in select expressions.
Building on top of previous work on constrained randomization in Verilator, Antmicro introduced several new features and fixes:
- Support for randomize..with with complex expressions containing accessing object members
- Fixing a regression in randomize..with handling
- Fixing inline constraints with member selects
- Support for $countones in constraints
- Support for randomize..with on objects of aliased types
- Fixing randomize..with for parameterized classes
- Partial support for size constraints
- Fixing rand dynamic arrays with null handles
- Support for rand dynamic arrays of objects
The way covergroups are handled was improved by enabling the parsing of covergroup constructs and their initial elaboration. This allows you to exclude them from the code to ensure successful tests when the actual tests function properly but lack covergroups support.
Apart from the UVM Cookbook-related contributions, the disable statement was also improved, namely disabling blocks by label. Support for most simple cases was added a few years back already, and Antmicro recently enabled it for cases containing forks, including disabling a fork from within that fork, disabling begin blocks that are directly under fork blocks, and disabling a fork from outside that fork.
Running Verilator with upstream UVM
Previously, Verilator required patches to the UVM source code to elaborate it. Now, thanks to the numerous contributions described in the previous sections, Verilator can elaborate all of UVM 2017-1.0 without any workarounds.
This repository contains an example of how to use UVM with Verilator. Clone it using the following command:
git clone https://github.com/antmicro/verilator-uvm-example
cd verilator-uvm-example
Next, we need to build Verilator. You may need to install some dependencies:
sudo apt update -y
sudo apt install -y bison flex libfl-dev help2man z3
# You may already have these:
sudo apt install -y git autoconf make g++ perl python3
Then, clone and build latest Verilator:
git clone https://github.com/verilator/verilator
pushd verilator
autoconf
./configure
make -j `nproc`
popd
For the full instructions, visit Verilator’s documentation.
Next, download the UVM code:
wget https://www.accellera.org/images/downloads/standards/uvm/Accellera-1800.2-2017-1.0.tar.gz
tar -xvzf Accellera-1800.2-2017-1.0.tar.gz
Now, set up the UVM_HOME environment variable to point to the extracted UVM sources, and PATH to point to Verilator:
UVM_HOME="$(pwd)/1800.2-2017-1.0/src"
PATH="$(pwd)/verilator/bin:$PATH"
To build the simulation, run:
verilator -Wno-fatal --binary -j $(nproc) --top-module tbench_top \
+incdir+$UVM_HOME +define+UVM_NO_DPI +incdir+$(pwd) \
$UVM_HOME/uvm_pkg.sv $(pwd)/sig_pkg.sv $(pwd)/tb.sv
Finally, run the simulation:
./obj_dir/Vtbench_top +UVM_TESTNAME=sig_model_test
Advancing open source RTL verification with Verilator
While support for upstream UVM 2017 in Verilator marks an important milestone toward a collaborative, software-driven ASIC development ecosystem, Antmicro continues the work to further enhance the implementation. Plans for future improvements include adding support for more testbenches and, eventually, UVM 2020, as well as UVM-adjacent verification features.
You can watch a recording of Antmicro’s talk at FOSSi Foundation’s ORConf 2025 about this and other recent developments in Verilator. Subscribe to the CHIPS SV Tools Workgroup mailing list (https://lists.chipsalliance.org/g/tools-wg) and feel free to join the bi-weekly open meetings on every other Friday, currently even weeks, at 7 a.m. PT: https://meet.google.com/ncy-rzzp-tfv?hs=122.