Project Setup: Before creating a VUnit automation task, you must first configure your VUnit project as a
scripted targetin yourproject.sigasifile. For detailed instructions, please refer to our tech article on Setting up VUnit with Sigasi Projects.
This feature integrates the VUnit open-source unit testing framework by creating a task that compiles your testbench files. With a Sigasi Visual HDL Professional Edition license or higher, this task also populates the VS Code Test Explorer view , allowing you to see and manage your tests directly within the IDE.
Creating the VUnit Task
Follow the general process. The only VUnit-specific step is providing the path to your VUnit runner script, usually run.py. Sigasi will automatically detect this file if it’s in your project root.
Advanced Configuration (tasks.json)
For more advanced control, you can directly edit the sigasiVUnitIntegration task in your .vscode/tasks.json file. All tasks share a set of common base properties, but VUnit has its own specific options.
Here is an example of a configured VUnit task:
{
"version": "2.0.0",
"tasks": [
{
"label": "VUnit Integration (test_runner)",
"type": "sigasiVUnitIntegration",
"target": "test_runner",
"watch": true,
"runOptions": {
"runOn": "folderOpen"
},
"runPy": "vunit_tests/run.py",
"simulator": "modelsim",
"simulatorInstallationPath": "/tools/questa_sim/bin",
"venv": ".venv",
"modelsimIni": "config/modelsim.ini"
}
]
}
VUnit Task Properties
In addition to the common base properties, the following options are available for sigasiVUnitIntegration tasks:
| Property | Type | Description |
|---|---|---|
runPy | string | The path to your main VUnit script, relative to the project’s root directory. Defaults to run.py. |
simulator | string | Optionally, specify which simulator VUnit should use. If this is not provided, VUnit will use the first supported simulator it finds on your system. Supported values are: "activehdl", "rivierapro", "ghdl", "nvc", "modelsim". See the VUnit simulator selection guide for the complete list and resolution rules. |
simulatorInstallationPath | string | Optional path to the simulator’s installation directory. This can be useful if the simulator is not on your system’s PATH. |
venv | string | Optional path to a Python virtual environment directory. If provided, the task will activate this environment before running VUnit. |
modelsimIni | string | If you are using ModelSim or Questa, this property allows you to specify a path to a custom modelsim.ini file. |
A Note on Python Virtual Environments
The VUnit integration fully supports the use of Python virtual environments. If your VUnit installation is inside a virtual environment, it is crucial that you specify the path to it using the
venvproperty.This feature works with standard environments created with
venv, as well as modern alternatives likeuv.Before running the task, please ensure that your virtual environment is correctly initialized and contains all necessary dependencies, including VUnit itself. The task will then activate this environment before executing the VUnit script.