Skip to main content

Common tools and helpers to simplify the VUnit run scripts

Project description

VUnit-helpers

This package contains project independent tools and helpers to simplify VUnit run scripts. Using this, the run script gets shorter, more readable and easier to maintain.

Installing VUnit_helpers

You can install this package from source or via PyPi

Installing via PyPi

python -m pip install vunit_helpers

Installing from source:

  1. Clone or download the repository
  2. navigate to the directory and run python -m pip install .

Optionally add the -e flag to install the package in the editable mode.

Usage Examples

Get the root path of a git repository

Working with relative paths in VUnit is dangerouse, since it depends on the working directory of python during execution. Instead, you can use your git repository as the root reference of all paths.

import vunit_helpers
git_repo_path = vunit_helpers.get_git_repo_root_path()

Add UVVM to VUnit

Use vunit_helpers.add_uvvm_sources() to add all UVVM source files to VUnit. VUnit will compile UVVM in the correct order.

from vunit import VUnit
import vunit_helpers

VU = VUnit.from_argv()
# add all UVVM components
vunit_helpers.add_uvvm_sources(VU, git_repo_path / "UVVM")

# add some specific UVVM components only
vunit_helpers.add_uvvm_sources(VU, git_repo_path / "UVVM", ["uvvm_util", "uvvm_vvc_framework", "bitvis_vip_scoreboard", "bitvis_vip_uart"])

If you have precompiled UVVM using its compile_all.do TCL script, you can use vunit_helpers.add_precompiled_uvvm_libraries():

VU = VUnit.from_argv()
vunit_helpers.add_precompiled_uvvm_libraries(VU,["uvvm_util", "uvvm_vvc_framework", "bitvis_vip_scoreboard", "bitvis_vip_uart"],"path/to/UVVM")

Advanced add Source Files

Vunit helpers allows including and excluding wildcard patterns. That way, it's easier to exclude specific files from VUnit.

from vunit import VUnit
import vunit_helpers
from vunit_helpers import File_pattern

VU = VUnit.from_argv()
lib = VU.add_library("lib") 

include_patterns=[
    File_pattern(git_repo_path  / "verification"/ "*" / "hdl" / "*.vhd"),
    File_pattern(git_repo_path  / "units" / "unit*" / "tb" / "*.vhd"),
]

# The files that match the exclude patterns won't be added to the lib (these files are excluded from the include_patterns)
exclude_patterns=[
    # the SPI testbench uses external_names, that are not supported in GHDL yet
    File_pattern(git_repo_path  / "units" / "unit*" / "tb" / "tb_Formal.vhd", when_simulator_is_not="ghdl"),
    File_pattern(git_repo_path  / "units" / "unitTop" / "tb" / "AnyFileIDontWant.vhd),
    File_pattern(git_repo_path  / "units" / "unitTop" / "tb" / "VerificationDefinitions-p.vhd", when_simulator_is="modelsim") 
]
vunit_helpers.advanced_add_source_files(VU,lib,include_patterns,exclude_patterns)

UVVM with GHDL

To run UVVM with GHDL, some additional compile and sim flags must be set.

VU = VUnit.from_argv()
vunit_helpers.set_ghdl_flags_for_UVVM(VU)

TOML File for RustHDL

RustHDL is a free and open source VHDL language server. It's setup requires a TOML file, that lists all libraries and source files of a project. The fuction generate_rust_hdl_toml() will generate the TOML file for RustHDL based on all files that are included in the VUnit project. Call this function after adding the files to VUnit.

VU = VUnit.from_argv()
vunit_helpers.add_uvvm_sources(VU, "path/to/UVVM")

vunit_helpers.generate_rust_hdl_toml(VU, str(git_repo_path / "vhdl_ls.toml"), str(git_repo_path))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

VUnit-helpers-1.0.2.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

VUnit_helpers-1.0.2-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file VUnit-helpers-1.0.2.tar.gz.

File metadata

  • Download URL: VUnit-helpers-1.0.2.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for VUnit-helpers-1.0.2.tar.gz
Algorithm Hash digest
SHA256 11657a904bff80367a2cf6351fdb864f84ba8069a3a35d7753597102bc6461cc
MD5 4617dbbc14149ee42be10d7216f4fefc
BLAKE2b-256 3e9a60f5fcb889db2ccb92f7cf7038122e6d68aaa54989814466b9d9e808a230

See more details on using hashes here.

File details

Details for the file VUnit_helpers-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: VUnit_helpers-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for VUnit_helpers-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d225b368d2914e0da45938747d4945d0d97802c22430300031f1a2a6725a21df
MD5 804bc931eb846f6e3be7ab6c0e4c3579
BLAKE2b-256 29be8932dd90ffba40b37da6a9d9a737067255bd0643a52a2c2591e6f7d02d2e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page