Skip to main content

vunit-yavs

The yavs simulator for VUnit, as a VUnit package. Add it in the run script before anything else, then select yavs with VUNIT_SIMULATOR=yavs:

from vunit import VUnit

vu = VUnit.from_argv()
vu.add_package("vunit-yavs", allow_setup=True)  # first: it provides the simulator
vu.add_vhdl_builtins()
vu.add_library("lib").add_source_files("*.vhd")
vu.main()
pip install vunit-yavs
VUNIT_SIMULATOR=yavs python run.py

The guide goes from installing to running, debugging and coverage, and the debugger tutorial debugs a failing test with --yavs-debug, --yavs-surfer and --yavs-interactive. yavs is found on PATH, or in the directory named by VUNIT_YAVS_PATH. It needs VUnit 5.0.0.dev16 or later (pip install vunit-yavs installs it, a pre-release) and yavs 0.21.2 or later.

Options

Sim or compile option Passed to
yavs.global_flags yavs analyze, run and elab
yavs.a_flags yavs analyze
yavs.elab_flags yavs run and elab
yavs.sim_flags yavs run, such as --assert-summary, --activity, --hang-report, --wave-include: they pass through to the run
yavs.max_threads (integer, at least 1, or "auto") yavs run --threads=N, the most threads of one simulation; "auto" is --threads=auto, more threads only while they make the run faster
yavs.tier_compile ("wait" or "background") yavs run --tier-compile=MODE: wait (yavs's default) makes a simulation wait while a function compiles, background compiles alongside it on a thread at the lowest system priority
yavs.cycle ("off", "on" or "strict") yavs run --cycle for "on", --cycle-strict for "strict" (cycle mode, below); default "off". Not passed to elab
enable_coverage (VUnit's option) yavs run --cov-file=<test output>/yavs/coverage.ycov --cov-test=<test name> with the kinds below (coverage, below)
yavs.cov_kind (list of strings) yavs run --cov-kind=LIST: statement, branch, toggle, condition, assert, expression, combination, fsm. No kind is on by default
yavs.init_files.after_load Console command files sourced after each vunit_load
yavs.init_files.before_run Console command files sourced before each vunit_run
yavs.init_file.gui A console command file sourced by vunit_user_init and at the start of --yavs-interactive
Command line What it does
--yavs-debug[=PORT] Runs the selected test under yavs run --dap=PORT (default 4711, 0 picks a free port) and prints where to attach; write the port as --yavs-debug=PORT
--yavs-interactive Runs the selected test at the yavs console: a yavs> prompt at time 0 (below). Not with --yavs-debug: one of them drives the run
--yavs-surfer[=HOST:PORT] Shows the waves of the one selected test in Surfer 0.6.0 or later while it runs (yavs run --surfer); strictly opt-in. Combines with --yavs-debug and --yavs-interactive, where the cursor follows the stops
-j N, --jobs N Compiles with up to N yavs analyze calls at once, into different libraries (below); a bare -j is one per CPU (put test names before it). Without it, one call at a time. Independent of -p
--yavs-max-threads N yavs.max_threads (a number or auto) for every test that does not set it (environment variable VUNIT_YAVS_MAX_THREADS for run scripts with a command line of their own)
--yavs-lint After compiling, runs yavs lint on every library of the project that is not external; a finding of severity error fails the compile step. To leave out VUnit's own libraries, put exclude: ['**/vunit/vhdl/**'] in yavs-lint.yaml. file_list in that file is not read: the project says which files a library has. An unknown key, rule or rule group in that file or in the waiver file is error E0134 (told once, before any library is checked) and fails the compile step
--yavs-cov=LETTERS Collects coverage in every simulation, as enable_coverage does for the tests it is set for, of the kinds the letters name: s statement, b branch, c condition, e expression, t toggle, f fsm, a assert, m combination (--yavs-cov=sbt). No kind is on by default; coverage without a kind fails the simulation, naming this flag, --yavs-cov-kind and yavs.cov_kind. Write the letters with =
--yavs-cov-directives MODE apply or ignore: what yavs analyze, elab and run do with the -- yavs coverage exclude comments in the sources (--coverage-directives); without it yavs's default, apply, which checks them when compiling
--yavs-cov-html DIR results.merge_coverage() also writes the HTML coverage report into DIR
--yavs-cov-fail-under PCT results.merge_coverage() prints the coverage report and the run exits with status 1 when the total is below PCT percent; per kind with statement:90,branch:80
--yavs-cov-cobertura FILE, --yavs-cov-json FILE, --yavs-cov-lcov FILE, --yavs-cov-sonarqube FILE results.merge_coverage() also writes that export; in a script merge_coverage("coverage", args=["--lcov", "c.info"]) and so on
--yavs-cov-embed-sources Passes --cov-embed-sources, as the sim option yavs.cov_embed_sources does for the tests it is set for: the HTML report then needs no checkout, and the source text travels with the database
--yavs-cov-below PCT The report of results.merge_coverage() limits its table of instances to those below PCT percent, worst first
--yavs-cov-detailed That report also lists what never ran, under each instance. In a script both go through merge_coverage("coverage", args=["--below=100", "--detailed"])
--yavs-cov-exclude FILE results.merge_coverage() reports without the items this exclusion file lists (yavs cov report --exclude); repeatable. A run script passes the same in merge_coverage("coverage", args=["--exclude", file])
--yavs-cov-config FILE results.merge_coverage() reads exclusion files, root and kinds from this file (yavs cov report --config). A run script passes args=["--config", file]
--yavs-no-jobserver Runs without the token server (below), which is on by default (environment variable VUNIT_YAVS_JOBSERVER=off for run scripts with a command line of their own)
--yavs-jobserver The token server, the default; accepted for scripts written when it was not

Compiling (the dependency-graph batching and -j need a release newer than 0.19.1): files go to yavs analyze in the project's dependency order, the out-of-date ones only. A call takes a ready file and the later files of its library, standard and flags whose dependencies are done or in the call (always on); a failing call is repeated file by file to name the failing file, and what depends on it is skipped, as in VUnit. With -j N up to N calls run at once, never two into one library (yavs locks a library for a whole call), nor, with yavs 0.19.1 or older, into libraries that read each other (they could wait for each other's lock, yavs #1150), so a project of many libraries gains most. Output is printed per finished call. With a VUnit that has --batch-compile and --parallel-compile (5.0.0.dev16 does not have them), those flags hand the compile to VUnit instead, and -j has no effect.

With the token server (the default) every simulation runs with --threads=auto unless yavs.max_threads or --yavs-max-threads gives a number. Without the server and without those, no thread count is passed, and yavs runs with its default, one thread. An explicit --threads in yavs.sim_flags comes after the cap and wins.

Cycle mode

Cycle mode is experimental: the option, its values and what yavs gives up under it may change in a later release.

vu.set_sim_option("yavs.cycle", "on")                                       # every test
vu.library("lib").test_bench("tb_counter").set_sim_option("yavs.cycle", "strict")  # one testbench; also per test or configuration

"on" runs the clocked and combinational processes that fit cycle mode on a static schedule and leaves the rest to the event kernel; the test output shows cycle mode: N of M processes run cycle-based (VUnit prints a passing test's output with -v). "strict" makes a process below the top-level unit that does not fit an error. A wrong value is refused at setup, naming the three values.

  • Cycle-based processes drop their report and assert statements, and library warnings.
  • They are two-state: metavalues read as '0'. Outside processes keep full semantics.
  • There are no waves, and none of coverage, --yavs-debug, --yavs-interactive or --yavs-surfer in the same test (the test fails before yavs starts, error E4102 of yavs).

All the rules are in the --cycle entry of the yavs command line reference. To see what would join, set yavs.sim_flags to ["--cycle-report"] for one test with yavs.cycle "off": yavs prints the report and does not simulate, so that test fails. yavs.sim_flags ["--cycle-exact-meta"] with yavs.cycle "on" or "strict" keeps the exact metavalue rules for a test, and the values in the message of a failed check.

Coverage

vu.set_sim_option("enable_coverage", True)      # or run with --yavs-cov=sb
vu.set_sim_option("yavs.cov_kind", ["statement", "branch"])   # the kinds; none is on by default
vu.main(post_run=lambda results: results.merge_coverage("coverage"))

Each simulation writes a yavs coverage database named after its test (yavs run --cov-file). The kinds come from the yavs.cov_kind sim option, else --yavs-cov-kind, else the letters of --yavs-cov=LETTERS; the letters and --yavs-cov-kind are not given together. results.merge_coverage("coverage") merges them into coverage.ycov (yavs cov merge); with --yavs-cov-html DIR or --yavs-cov-fail-under PCT, or arguments in merge_coverage("coverage", args=["--cobertura", "c.xml"]), it then runs yavs cov report on the merged database. A total below the threshold makes the run exit with status 1 after VUnit has written its reports (a JUnit file included). For a CI gate:

VUNIT_SIMULATOR=yavs python run.py --yavs-cov=sbt --yavs-cov-html cov-html --yavs-cov-fail-under 85

Coverage cannot be combined with --yavs-debug. Reports, exclusions and the numbers are in the yavs documentation page on coverage. The coverage options need the yavs release that has yavs cov report --fail-under.

Native libraries of VUnit packages

A VUnit package that loads a native library can ask the simulator interface how: YavsInterface has foreign_language_interface = "VHPIDIRECT" (the VHDL calls the library through foreign subprograms with a "VHPIDIRECT ..." attribute) and native_library_hooks(library_file), which returns the simulator hooks that pass --load=<library_file> to every yavs elab and yavs run (so --elaborate works for a design that calls the library while it is elaborated); native_library_hooks(library_file, args="fat-pointer") selects that argument layout for the library (a run.py without a package gives --load=LIB:args=fat-pointer in yavs.elab_flags). A package registers them with context.register_simulator_hooks("yavs", **YavsInterface.native_library_hooks(library)). The repository's tests/project_foreign is a package that builds a C library, with Python embedded where the host allows it, and a testbench that calls Python from VHDL. A VHDL string reaches the library as one byte per character, and yavs reads a UTF-8 source file as Latin-1 characters: give --encoding=latin1 to yavs.a_flags and (as a sim option) to yavs.global_flags when the library needs the UTF-8 bytes of an accented literal.

Debugging one test

VUNIT_SIMULATOR=yavs python run.py lib.tb.test_name --yavs-debug

yavs waits for a Debug Adapter Protocol client on 127.0.0.1:4711 before the simulation starts; press F5 or run "yavs: Attach" in VS Code with the yavs extension: no launch configuration is needed. Set breakpoints in your own files: with location or check preprocessing on, the debugger maps the rewritten copies to them. When the session ends, the test is reported as usual.

--yavs-debug runs one simulation. A second simulation of the run (a second test, or the same test in another configuration) is an error before yavs starts, naming both tests. --yavs-debug together with --elaborate or -p above 1 is an error at the start. A bare --yavs-debug reads a following test name as its port: put test names first, or write --yavs-debug=4711.

Every simulation (not --yavs-interactive) is started with --exit-on-stdin-close: it ends when the pipe the runner keeps to its standard input closes, so killing only python run.py, even with SIGKILL, does not leave yavs waiting for a debugger on the port. The waves and coverage files of such a run are not finished.

Token server

By default (Linux and Windows), at any -p, the run script starts a token server on 127.0.0.1 with one slot for each CPU the run may use (its CPU affinity, so taskset counts; none with one CPU, nor under --yavs-debug or --yavs-interactive). Every simulation runs with --threads=auto (unless yavs.max_threads or --yavs-max-threads says otherwise) and gets YAVS_TOKENS=<port>:<secret>, a secret of its own; yavs runs its extra threads only on tokens the server lends, and asks for them only while it has work for them (a group of processes worth sharing, or a cycle region to compile). Each running test keeps one slot, and so does each of the -p N workers for GRACE (1 second) after its test ends, and all N until the first test starts. Measured under the test runner (2026-11-17, 336 test starts of -p 4), a worker started its next test 2 ms after its last one ended in the median and 0.33 s at most; the grace is three times that. The other slots are lent: breadth first (every test gets one extra before any gets a second) and newest test first within a round, at most yavs.max_threads - 1 per test (min(C, 8) - 1 with auto, for C slots); yavs.max_threads set to 1 takes none. So a worker's next test finds its slot free, and in the tail of a regression the slots of the workers out of tests are lent a second after they ran out. With auto a simulation whose threads do not make it faster asks for no tokens after its first fraction of a second. A token in use is never taken back: a worker that idles past the grace and then starts a test again shares its slot until a simulation lowers its want. A simulation gives its tokens back when it stops using them and when it ends in any way, also when it is killed. If the server cannot start (a blocked local socket) the run warns and every simulation uses one thread.

--yavs-no-jobserver (or VUNIT_YAVS_JOBSERVER=off) runs without it: then --yavs-max-threads N gives every simulation N threads of its own, whatever the others use. Under the server the threads of --yavs-max-threads N past the first run only on lent tokens.

The console

VUNIT_SIMULATOR=yavs python run.py lib.tb.test_name --yavs-interactive

The test stops at time 0 at a yavs> prompt. All commands of the yavs console work (run, step, examine, force, break, restart, source, help, quit), and this package adds VUnit's own, which behave as in VUnit's other simulator interfaces. They are also in the Debug Console under --yavs-debug.

Command What it does Fails (an error at the console, the end of a script) when
vunit_help Lists these commands
vunit_load [flags] Loads the test at time 0, with extra yavs run flags if given, and sources yavs.init_files.after_load The design does not elaborate, a flag is unknown or an init file fails
vunit_user_init Sources yavs.init_file.gui The file fails
vunit_run Sources yavs.init_files.before_run, runs, and prints Test Run Passed! The test suite did not finish, also when a breakpoint stops the run: Test Run Failed!
vunit_compile Runs run.py --compile with your arguments, without --clean The compile fails
vunit_restart vunit_compile, and if that worked: the new design at time 0, breakpoints kept, and vunit_run As vunit_compile, then vunit_run

The yavs restart goes back to time 0 with the design as loaded; vunit_restart compiles first. Init files are files of console commands; $vunit_tb_path and $vunit_tb_name are replaced as VUnit defines them. When you quit, the test is reported as usual. A session that compiled at vunit_compile and failed keeps the old design loaded.

Licence

Mozilla Public License 2.0 (https://mozilla.org/MPL/2.0/), see the header of each file.

Metadata

Release files for vunit-yavs 0.21.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vunit-yavs 0.21.2
File Size Uploaded Provenance Actions
vunit_yavs-0.21.2.tar.gz 72.4 kB With provenance Details for vunit_yavs-0.21.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for vunit-yavs 0.21.2
File Interpreter ABI Platform Actions
vunit_yavs-0.21.2-py3-none-any.whl Python 3 none any Details for vunit_yavs-0.21.2-py3-none-any.whl

Total release size: 102.2 kB

Release files / vunit_yavs-0.21.2.tar.gz

Download URL vunit_yavs-0.21.2.tar.gz
Size 72.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9b98be3150dff84b942edc1d42ce804c0f632aee28030511c01372eb2e5fd86c
BLAKE2b-256 checksum
How to use checksums
08d8fa98f209f87600cd3a34ed8f2fb4f917093001a31b1619a501b838df012d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Release files / vunit_yavs-0.21.2-py3-none-any.whl

Download URL vunit_yavs-0.21.2-py3-none-any.whl
Size 29.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6c2d3f4a910cfff121dcbf8f90ed5e9ba03f132f6a3adfd9886aa23d9444b823
BLAKE2b-256 checksum
How to use checksums
0dea2576dcf88a839a25f806e6baee5c039e74d3c14b9bb54d13a0bbdde6855e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Security for vunit-yavs 0.21.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for vunit_yavs-0.21.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page