VUnit-helpers


NameVUnit-helpers JSON
Version 1.0.2 PyPI version JSON
download
home_page
SummaryCommon tools and helpers to simplify the VUnit run scripts
upload_time2024-02-04 13:32:49
maintainer
docs_urlNone
author
requires_python>=3.7
license
keywords vunit unit testing
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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.
``` Python
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.  

``` Python
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():
``` Python
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. 
``` Python
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. 
``` Python
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. 

``` Python
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))
```




            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "VUnit-helpers",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "VUnit,unit testing",
    "author": "",
    "author_email": "Markus Leiter <leiter@p2l2.com>",
    "download_url": "https://files.pythonhosted.org/packages/3e/9a/60f5fcb889db2ccb92f7cf7038122e6d68aaa54989814466b9d9e808a230/VUnit-helpers-1.0.2.tar.gz",
    "platform": null,
    "description": "# VUnit-helpers\n\nThis package contains project independent tools and helpers to simplify VUnit run scripts.\nUsing this, the run script gets shorter, more readable and easier to maintain. \n\n# Installing VUnit_helpers\nYou can install this package from source or via PyPi\n\n## Installing via PyPi\n\n    python -m pip install vunit_helpers\n\n## Installing from source:\n1. Clone or download the repository\n2. navigate to the directory and run ```python -m pip install .```\n\nOptionally add the ```-e``` flag to install the package in the editable mode.\n\n# Usage Examples\n\n## Get the root path of a git repository\nWorking 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.\n``` Python\nimport vunit_helpers\ngit_repo_path = vunit_helpers.get_git_repo_root_path()\n```\n\n## Add UVVM to VUnit\n\nUse vunit_helpers.add_uvvm_sources() to add all UVVM source files to VUnit. VUnit will compile UVVM in the correct order.  \n\n``` Python\nfrom vunit import VUnit\nimport vunit_helpers\n\nVU = VUnit.from_argv()\n# add all UVVM components\nvunit_helpers.add_uvvm_sources(VU, git_repo_path / \"UVVM\")\n\n# add some specific UVVM components only\nvunit_helpers.add_uvvm_sources(VU, git_repo_path / \"UVVM\", [\"uvvm_util\", \"uvvm_vvc_framework\", \"bitvis_vip_scoreboard\", \"bitvis_vip_uart\"])\n```\n\nIf you have precompiled UVVM using its compile_all.do TCL script, you can use vunit_helpers.add_precompiled_uvvm_libraries():\n``` Python\nVU = VUnit.from_argv()\nvunit_helpers.add_precompiled_uvvm_libraries(VU,[\"uvvm_util\", \"uvvm_vvc_framework\", \"bitvis_vip_scoreboard\", \"bitvis_vip_uart\"],\"path/to/UVVM\")\n```\n\n## Advanced add Source Files\nVunit helpers allows including and excluding wildcard patterns. That way, it's easier to exclude specific files from VUnit. \n``` Python\nfrom vunit import VUnit\nimport vunit_helpers\nfrom vunit_helpers import File_pattern\n\nVU = VUnit.from_argv()\nlib = VU.add_library(\"lib\") \n\ninclude_patterns=[\n    File_pattern(git_repo_path  / \"verification\"/ \"*\" / \"hdl\" / \"*.vhd\"),\n    File_pattern(git_repo_path  / \"units\" / \"unit*\" / \"tb\" / \"*.vhd\"),\n]\n\n# The files that match the exclude patterns won't be added to the lib (these files are excluded from the include_patterns)\nexclude_patterns=[\n    # the SPI testbench uses external_names, that are not supported in GHDL yet\n    File_pattern(git_repo_path  / \"units\" / \"unit*\" / \"tb\" / \"tb_Formal.vhd\", when_simulator_is_not=\"ghdl\"),\n    File_pattern(git_repo_path  / \"units\" / \"unitTop\" / \"tb\" / \"AnyFileIDontWant.vhd),\n    File_pattern(git_repo_path  / \"units\" / \"unitTop\" / \"tb\" / \"VerificationDefinitions-p.vhd\", when_simulator_is=\"modelsim\") \n]\nvunit_helpers.advanced_add_source_files(VU,lib,include_patterns,exclude_patterns)\n```\n\n## UVVM with GHDL\nTo run UVVM with GHDL, some additional compile and sim flags must be set. \n``` Python\nVU = VUnit.from_argv()\nvunit_helpers.set_ghdl_flags_for_UVVM(VU)\n```\n\n## TOML File for RustHDL\nRustHDL 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. \nCall this function after adding the files to VUnit. \n\n``` Python\nVU = VUnit.from_argv()\nvunit_helpers.add_uvvm_sources(VU, \"path/to/UVVM\")\n\nvunit_helpers.generate_rust_hdl_toml(VU, str(git_repo_path / \"vhdl_ls.toml\"), str(git_repo_path))\n```\n\n\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Common tools and helpers to simplify the VUnit run scripts",
    "version": "1.0.2",
    "project_urls": {
        "Bug Tracker": "https://github.com/p2l2/VUnit-helpers/issues",
        "Homepage": "https://github.com/p2l2/VUnit-helpers"
    },
    "split_keywords": [
        "vunit",
        "unit testing"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "29be8932dd90ffba40b37da6a9d9a737067255bd0643a52a2c2591e6f7d02d2e",
                "md5": "804bc931eb846f6e3be7ab6c0e4c3579",
                "sha256": "d225b368d2914e0da45938747d4945d0d97802c22430300031f1a2a6725a21df"
            },
            "downloads": -1,
            "filename": "VUnit_helpers-1.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "804bc931eb846f6e3be7ab6c0e4c3579",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 12246,
            "upload_time": "2024-02-04T13:32:47",
            "upload_time_iso_8601": "2024-02-04T13:32:47.783688Z",
            "url": "https://files.pythonhosted.org/packages/29/be/8932dd90ffba40b37da6a9d9a737067255bd0643a52a2c2591e6f7d02d2e/VUnit_helpers-1.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3e9a60f5fcb889db2ccb92f7cf7038122e6d68aaa54989814466b9d9e808a230",
                "md5": "4617dbbc14149ee42be10d7216f4fefc",
                "sha256": "11657a904bff80367a2cf6351fdb864f84ba8069a3a35d7753597102bc6461cc"
            },
            "downloads": -1,
            "filename": "VUnit-helpers-1.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "4617dbbc14149ee42be10d7216f4fefc",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 11454,
            "upload_time": "2024-02-04T13:32:49",
            "upload_time_iso_8601": "2024-02-04T13:32:49.590966Z",
            "url": "https://files.pythonhosted.org/packages/3e/9a/60f5fcb889db2ccb92f7cf7038122e6d68aaa54989814466b9d9e808a230/VUnit-helpers-1.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-04 13:32:49",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "p2l2",
    "github_project": "VUnit-helpers",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "vunit-helpers"
}
        
Elapsed time: 0.16900s