Skip to content

Commit dffd807

Browse files
committed
Enabled VHDL-2019 for GHDL >= 6.0.0.
Note that VUnit log location support based on call_path is deactivated as this is yet to be supported by GHDL.
1 parent ae8ba6e commit dffd807

2 files changed

Lines changed: 23 additions & 15 deletions

File tree

vunit/builtins.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -448,11 +448,10 @@ def _add_osvvm(self):
448448

449449
library.add_source_files(file_name, preprocessors=[])
450450

451-
def _add_vhdl_logging(self):
451+
def _add_vhdl_logging(self, use_external_log):
452452
"""
453453
Add logging functionality
454454
"""
455-
456455
use_call_paths = self._simulator_class.supports_vhdl_call_paths() and (
457456
self._vhdl_standard in VHDL.STD_2019.and_later
458457
)
@@ -467,6 +466,10 @@ def _add_vhdl_logging(self):
467466
if base_file_name.startswith("location_pkg-body"):
468467
continue
469468

469+
if (base_file_name == "common_log_pkg-body.vhd") and use_external_log:
470+
self._add_files(Path(use_external_log))
471+
continue
472+
470473
standards = set()
471474
for standard in VHDL.STANDARDS:
472475
standard_name = str(standard)
@@ -504,7 +507,7 @@ def add_vhdl_builtins(self, external=None, use_external_log=None):
504507
})
505508
"""
506509
self._add_data_types(external=external)
507-
self._add_vhdl_logging()
510+
self._add_vhdl_logging(use_external_log)
508511
self._add_files(VHDL_PATH / "*.vhd")
509512
for path in (
510513
"core",
@@ -516,14 +519,6 @@ def add_vhdl_builtins(self, external=None, use_external_log=None):
516519
):
517520
self._add_files(VHDL_PATH / path / "src" / "*.vhd")
518521

519-
logging_files = glob(str(VHDL_PATH / "logging" / "src" / "*.vhd"))
520-
for logging_file in logging_files:
521-
if logging_file.endswith("common_log_pkg-body.vhd") and use_external_log:
522-
self._add_files(Path(use_external_log))
523-
continue
524-
525-
self._add_files(Path(logging_file))
526-
527522

528523
def osvvm_is_installed():
529524
"""

vunit/sim_if/ghdl.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ def __init__( # pylint: disable=too-many-arguments
119119
self._vhdl_standard = None
120120
self._coverage_test_dirs = set() # For gcov
121121
self._coverage_files = set() # For --coverage
122+
self._version = self.determine_version(self.find_prefix())
122123

123124
def has_valid_exit_code(self): # pylint: disable=arguments-differ
124125
"""
@@ -184,6 +185,13 @@ def determine_version(cls, prefix):
184185
).group(1)
185186
)
186187

188+
@classmethod
189+
def supports_vhdl_call_paths(cls):
190+
"""
191+
Returns True when this simulator supports VHDL-2019 call paths
192+
"""
193+
return False
194+
187195
@classmethod
188196
def supports_vhdl_package_generics(cls):
189197
"""
@@ -246,17 +254,22 @@ def compile_source_file_command(self, source_file):
246254
LOGGER.error("Unknown file type: %s", source_file.file_type)
247255
raise CompileError
248256

249-
@staticmethod
250-
def _std_str(vhdl_standard):
257+
def _std_str(self, vhdl_standard):
251258
"""
252259
Convert standard to format of GHDL command line flag
253260
"""
254-
if vhdl_standard == VHDL.STD_2002:
255-
return "02"
261+
if vhdl_standard == VHDL.STD_2019:
262+
if self._version >= 6.0:
263+
return "19"
264+
else:
265+
raise ValueError("VHDL-2019 requires GHDL >=6.0.0.")
256266

257267
if vhdl_standard == VHDL.STD_2008:
258268
return "08"
259269

270+
if vhdl_standard == VHDL.STD_2002:
271+
return "02"
272+
260273
if vhdl_standard == VHDL.STD_1993:
261274
return "93"
262275

0 commit comments

Comments
 (0)