vunit_nvc_sim

Rules

vunit_nvc_sim

load("@rules_vunit//vunit:vunit_nvc_sim.bzl", "vunit_nvc_sim")

vunit_nvc_sim(name, env, nvc, nvc_libpath, vhdl_libs)

A simulator configuration for running NVC (open-source VHDL simulator) under VUnit.

Status

Working against the BCR nvc module from version 1.21.0 onward.

Notes

NVC only supports VHDL (VhdlInfo); pair it with vhdl_library targets in the libraries map of vunit_test. VUnit drives nvc directly via its vu.main() at test time using sources surfaced through runfiles.

vhdl_libs accepts a list of per-library TreeArtifact targets — typically ["@nvc//:vhdl_libs"], the BCR nvc module's filegroup of per-library directories laid out exactly like a system install under <prefix>/lib/nvc/<library>/. The rule's implementation stages those TreeArtifacts side-by-side under a single root and points NVC_LIBPATH at it so nvc finds every shipped library (STD, IEEE, NVC, plus the SYNOPSYS / VITAL extras inside IEEE) at simulation time.

Coverage

VUnit has no NVC coverage integration upstream — vu.set_sim_option exposes nvc.elab_flags/nvc.sim_flags/nvc.a_flags, but there's no shipped recipe for routing NVC's --cover instrumentation through those, and nvc --cover-export only emits Cobertura. Rather than invent a sim-side path here, this rule omits coverage. The generic VUnitSimInfo.coverage field stays available for the commercial simulators (Mentor UCDB, Aldec ACDB) where a real bridge exists.

ATTRIBUTES

NameDescriptionTypeMandatoryDefault
nameA unique name for this target.Namerequired
envEnvironment variables to set when the vunit runner invokes this simulator at test time (license-server pointers, install root vars, …). Precedence: toolchain env < sim env < rule-level vunit_test(env = ...).Dictionary: String -> Stringoptional{}
nvcThe nvc simulator binary.Labelrequired
nvc_libpathLiteral value to set as NVC_LIBPATH at simulation time. Use this for nvc installs where the prefix is a stable absolute path on disk — typically a system / .deb / Homebrew install (e.g. "/usr/local/lib/nvc").

When unset (default), NVC_LIBPATH is auto-derived from vhdl_libs if it's populated (per-library TreeArtifacts staged into one root by this rule), otherwise left unset so nvc falls back to its own compiled-in search paths.
Stringoptional""
vhdl_libsPer-library TreeArtifact targets to stage side-by-side under a single NVC_LIBPATH root. Typically ["@nvc//:vhdl_libs"] — the BCR nvc module's filegroup of per-library directories. Empty (the default) leaves NVC_LIBPATH unset.List of labelsoptional[]