diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 61bd6c2e6..424c36664 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -103,14 +103,14 @@ jobs: if: endsWith( matrix.task, '-ghdl' ) shell: bash run: | - curl -fsSL -o ghdl.zip https://github.com/ghdl/ghdl/releases/download/v0.36/ghdl-0.36-mingw32-mcode.zip + curl -fsSL -o ghdl.zip https://github.com/ghdl/ghdl/releases/download/v0.37/ghdl-0.37-mingw32-mcode.zip 7z x ghdl.zip "-o../ghdl" -y - mv ../ghdl/GHDL/0.36-mingw32-mcode/ ../ghdl-v0.36 + mv ../ghdl/GHDL/0.37-mingw32-mcode/ ../ghdl-v0.37 rm -rf ../ghdl ghdl.zip - name: run job shell: bash run: | - export PATH=$PATH:$(pwd)/../ghdl-v0.36/bin + export PATH=$PATH:$(pwd)/../ghdl-v0.37/bin tox -e py${{ matrix.task }} -- --color=yes deploy: diff --git a/vunit/sim_if/ghdl.py b/vunit/sim_if/ghdl.py index c733f7033..0e70e9f88 100644 --- a/vunit/sim_if/ghdl.py +++ b/vunit/sim_if/ghdl.py @@ -14,6 +14,7 @@ import logging import subprocess import shlex +import re from json import dump from sys import stdout # To avoid output catched in non-verbose mode from warnings import warn @@ -115,6 +116,15 @@ def has_valid_exit_code(self): """ return self._vhdl_standard >= VHDL.STD_2008 + @classmethod + def _get_version_output(cls, prefix): + """ + Get the output of 'ghdl --version' + """ + return subprocess.check_output( + [join(prefix, cls.executable), "--version"] + ).decode() + @classmethod def determine_backend(cls, prefix): """ @@ -125,9 +135,7 @@ def determine_backend(cls, prefix): "llvm code generator": "llvm", "GCC back-end code generator": "gcc", } - output = subprocess.check_output( - [join(prefix, cls.executable), "--version"] - ).decode() + output = cls._get_version_output(prefix) for name, backend in mapping.items(): if name in output: LOGGER.debug("Detected GHDL %s", name) @@ -142,12 +150,26 @@ def determine_backend(cls, prefix): "No known GHDL back-end could be detected from running 'ghdl --version'" ) + @classmethod + def determine_version(cls, prefix): + """ + Determine the GHDL version + """ + return float( + re.match( + r"GHDL ([0-9]*\.[0-9]*).*\(.*\) \[Dunoon edition\]", + cls._get_version_output(prefix), + ).group(1) + ) + @classmethod def supports_vhpi(cls): """ Return if the simulator supports VHPI """ - return cls.determine_backend(cls.find_prefix_from_path()) != "mcode" + return (cls.determine_backend(cls.find_prefix_from_path()) != "mcode") or ( + cls.determine_version(cls.find_prefix_from_path()) > 0.36 + ) def _has_output_flag(self): """