VUnit projects in Sigasi
Since version 3.6, Sigasi Studio has a Quick Fix to automatically add the VUnit
vunit_lib VHDL library to your project.
VUnit is an open source unit testing framework for VHDL/SystemVerilog that helps to write, and automatically run, tests. The VUnit project was started by Lars Asplund from Synective Labs and its source code is hosted at GitHub. VUnit automatically scans your projects for unit tests (aka test benches), runs them with your favorite simulator and reports you the results. This automation helps to run tests frequently and iterate faster.
The VUnit scripts are written in Python, so first make sure python is installed on your system. The recommended way to install the latest stable release of VUnit is via
pip. On most systems running the following command should do the trick:
pip install vunit_hdl
Make sure you use
vunit_hdl and not
vunit. The latter is a completely different Python library.
You can check that VUnit is installed correctly by for example running:
In the list of installed Python packages you will find a
vunit-hdl entry and its version number.
Using VUnit in Sigasi Studio
If you want to use VUnit in your VHDL testbenches. You need to add a library clause for the
vunit_lib library. All necessary packages can be imported with the predefined
A typical VUnit test bench file will have following entity declaration:
library vunit_lib; context vunit_lib.vunit_context; entity tb_example is generic (runner_cfg : string); end entity;
Note that the
context clause is VHDL-2008 syntax. So, make sure your project is configured accordingly: Right click project, Properties > VHDL Version > VHDL-2008.
When you enter this VHDL snippet in a VHDL file in a Sigasi Studio project, you will see a warning (Library "vunit_lib" is not available) on the library clause and multiple errors because of references to missing declarations.
To automatically add the VUnit library to your project, click the light bulb icon to trigger the Quick Fix (or press Ctrl-F1 on the line with the warning).
As a result the
vunit_lib is added to your project (Note that this also adds the
osvvm library). Under the hood, Sigasi Studio runs a Python script to query VUnit for the correct paths to the VUnit VHDL source files.
This also resolves the unresolved references to
test_runner_cleanup. You can now easily navigate to their declaration with F3 ("Open Declaration"). You can also use autocomplete to quickly add other VUnit function calls.