Skip to content

Commit

Permalink
ci: update GHDL to v0.37
Browse files Browse the repository at this point in the history
  • Loading branch information
eine committed Mar 2, 2020
1 parent 2654e27 commit 0fab3c8
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
30 changes: 26 additions & 4 deletions vunit/sim_if/ghdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"]

This comment has been minimized.

Copy link
@LarsAsplund

LarsAsplund Mar 2, 2020

Remove use of join?

This comment has been minimized.

Copy link
@eine

eine Mar 2, 2020

Author Owner

Yes, but not in this commit/PR. That's wip in VUnit#626. (see https://github.com/VUnit/vunit/pull/626/files#diff-2d4a56f7b7c79d9df2c628aabbe64e43). When this is merged, I will rebase and update VUnit#626 accordingly.

This comment has been minimized.

Copy link
@LarsAsplund

LarsAsplund Mar 3, 2020

Ack.

).decode()

@classmethod
def determine_backend(cls, prefix):
"""
Expand All @@ -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)
Expand All @@ -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):
"""
Expand Down

0 comments on commit 0fab3c8

Please sign in to comment.