diff --git a/vunit/ghdl_interface.py b/vunit/ghdl_interface.py index ff9183e16..6e76ea9c6 100644 --- a/vunit/ghdl_interface.py +++ b/vunit/ghdl_interface.py @@ -124,6 +124,13 @@ def determine_backend(cls, prefix): print("=============================" + ("=" * 60)) raise AssertionError("No known GHDL back-end could be detected from running 'ghdl --version'") + @classmethod + def supports_vhpi(cls): + """ + Return if the simulator supports VHPI + """ + return cls.determine_backend(cls.find_prefix_from_path()) != "mcode" + def _has_output_flag(self): """ Returns if backend supports output flag diff --git a/vunit/simulator_interface.py b/vunit/simulator_interface.py index 0ca303955..b456490cd 100644 --- a/vunit/simulator_interface.py +++ b/vunit/simulator_interface.py @@ -17,7 +17,7 @@ from vunit.color_printer import NO_COLOR_PRINTER -class SimulatorInterface(object): +class SimulatorInterface(object): # pylint: disable=too-many-public-methods """ Generic simulator interface """ @@ -145,6 +145,13 @@ def has_valid_exit_code(): """ return False + @staticmethod + def supports_vhpi(): + """ + Return if the simulator supports VHPI + """ + return False + def merge_coverage(self, file_name, args): # pylint: disable=unused-argument, no-self-use """ Hook for simulator interface to creating coverage reports diff --git a/vunit/test/common.py b/vunit/test/common.py index 5d626856a..c96584b84 100644 --- a/vunit/test/common.py +++ b/vunit/test/common.py @@ -32,6 +32,16 @@ def simulator_is(*names): return SIMULATOR_FACTORY.select_simulator().name in names +def simulator_check(func): + """ + Check some method of the selected simulator + """ + simif = SIMULATOR_FACTORY.select_simulator() + if simif is None: + return False + return func(simif) + + def check_report(report_file, tests=None): """ Check an XML report_file for the exact occurrence of specific test results