Skip to content

Commit

Permalink
Fix NVC version detection
Browse files Browse the repository at this point in the history
I bumped the version on the master branch to 1.10-devel but the
comparison here is using floating point so 1.10 >= 1.9 is false.
Changed determine_version to return a (major, minor) tuple instead.
  • Loading branch information
nickg committed Apr 14, 2023
1 parent 1bc4d06 commit e556a9a
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions vunit/sim_if/nvc.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,14 @@ def __init__( # pylint: disable=too-many-arguments
if gui and (not self.find_executable("gtkwave")):
raise RuntimeError("Cannot find the gtkwave executable in the PATH environment variable. GUI not possible")

(major, minor) = self.determine_version(prefix)
if not (major >= 1 and minor >= 9):
raise RuntimeError(f"Minimum supported NVC version is 1.9 (have {major}.{minor})")

self._gui = gui
self._gtkwave_args = gtkwave_args
self._vhdl_standard = None
self._coverage_test_dirs = set()
self._supports_jit = self.determine_version(prefix) >= 1.9

if self.use_color:
environ["NVC_COLORS"] = "always"
Expand All @@ -105,12 +108,12 @@ def determine_version(cls, prefix):
"""
Determine the NVC version
"""
return float(
re.match(
r"nvc ([0-9]*\.[0-9]*).*\(.*\)",
cls._get_version_output(prefix),
).group(1)
)
raw = cls._get_version_output(prefix)
m = re.match(r"nvc ([0-9]+)\.([0-9]+).*", raw)
if not m:
raise RuntimeError("Cannot determine NVC version: " + raw)

return (int(m.group(1)), int(m.group(2)))

@classmethod
def supports_vhpi(cls):
Expand Down Expand Up @@ -261,8 +264,7 @@ def simulate(self, output_path, test_suite_name, config, elaborate_only):

if not elaborate_only:
cmd += ["--no-save"]
if self._supports_jit:
cmd += ["--jit"]
cmd += ["--jit"]
cmd += ["-r"]
cmd += config.sim_options.get("nvc.sim_flags", [])
cmd += [f"--exit-severity={config.vhdl_assert_stop_level}"]
Expand Down

0 comments on commit e556a9a

Please sign in to comment.