diff --git a/docs/check/user_guide.rst b/docs/check/user_guide.rst index d391c1f6e..1c1fce526 100644 --- a/docs/check/user_guide.rst +++ b/docs/check/user_guide.rst @@ -703,6 +703,7 @@ preprocessor in your VUnit run script. .. code-block:: python ui = VUnit.from_argv() + ui.add_vhdl_builtins() ui.enable_check_preprocessing() The check preprocessor scans your code for calls to ``check_relation`` diff --git a/docs/com/user_guide.rst b/docs/com/user_guide.rst index 590b52e8a..cf18b7fd2 100644 --- a/docs/com/user_guide.rst +++ b/docs/com/user_guide.rst @@ -35,6 +35,7 @@ is provided as an optional add-on to VUnit. It is compiled to the .. code-block:: python prj = VUnit.from_argv() + prj.add_vhdl_builtins() prj.add_com() The VHDL functionality is provided to your testbench with the diff --git a/docs/logging/user_guide.rst b/docs/logging/user_guide.rst index 61f555f67..b8b40e3cc 100644 --- a/docs/logging/user_guide.rst +++ b/docs/logging/user_guide.rst @@ -301,6 +301,7 @@ the ``run.py`` file like this: .. code-block:: python ui = VUnit.from_argv() + ui.add_vhdl_builtins() ui.enable_location_preprocessing() Regardless of method the location information is appended to the end of the log entry: diff --git a/docs/user_guide.rst b/docs/user_guide.rst index ffbc30884..3583b5224 100644 --- a/docs/user_guide.rst +++ b/docs/user_guide.rst @@ -43,6 +43,12 @@ bench or test for many different combinations of generic values. # Create VUnit instance by parsing command line arguments vu = VUnit.from_argv() + # Optionally add VUnit's builtin HDL utilities for checking, logging, communication... + # See http://vunit.github.io/hdl_libraries.html. + vu.add_vhdl_builtins() + # or + # vu.add_verilog_builtins() + # Create library 'lib' lib = vu.add_library("lib") diff --git a/examples/vhdl/array/run.py b/examples/vhdl/array/run.py index eab436a15..501db145b 100644 --- a/examples/vhdl/array/run.py +++ b/examples/vhdl/array/run.py @@ -19,6 +19,7 @@ from vunit import VUnit VU = VUnit.from_argv() +VU.add_vhdl_builtins() VU.add_osvvm() SRC_PATH = Path(__file__).parent / "src" diff --git a/examples/vhdl/array_axis_vcs/run.py b/examples/vhdl/array_axis_vcs/run.py index 3124ac446..049261e75 100644 --- a/examples/vhdl/array_axis_vcs/run.py +++ b/examples/vhdl/array_axis_vcs/run.py @@ -22,6 +22,7 @@ from vunit import VUnit VU = VUnit.from_argv() +VU.add_vhdl_builtins() VU.add_verification_components() SRC_PATH = Path(__file__).parent / "src" diff --git a/examples/vhdl/axi_dma/run.py b/examples/vhdl/axi_dma/run.py index af01e7fcd..f76d7abe1 100644 --- a/examples/vhdl/axi_dma/run.py +++ b/examples/vhdl/axi_dma/run.py @@ -21,6 +21,7 @@ from vunit import VUnit VU = VUnit.from_argv() +VU.add_vhdl_builtins() VU.add_osvvm() VU.add_verification_components() diff --git a/examples/vhdl/check/run.py b/examples/vhdl/check/run.py index 5e041455e..3445c9740 100644 --- a/examples/vhdl/check/run.py +++ b/examples/vhdl/check/run.py @@ -17,6 +17,7 @@ from vunit import VUnit VU = VUnit.from_argv() +VU.add_vhdl_builtins() # Enable location preprocessing but exclude all but check_false to make the example less bloated VU.enable_location_preprocessing( diff --git a/examples/vhdl/com/run.py b/examples/vhdl/com/run.py index 8e257837e..ccdfae2a7 100644 --- a/examples/vhdl/com/run.py +++ b/examples/vhdl/com/run.py @@ -19,6 +19,7 @@ from vunit import VUnit VU = VUnit.from_argv() +VU.add_vhdl_builtins() VU.add_com() VU.add_verification_components() VU.add_osvvm() diff --git a/examples/vhdl/composite_generics/run.py b/examples/vhdl/composite_generics/run.py index ad7e34b56..9399db101 100644 --- a/examples/vhdl/composite_generics/run.py +++ b/examples/vhdl/composite_generics/run.py @@ -22,6 +22,7 @@ def encode(tb_cfg): VU = VUnit.from_argv() +VU.add_vhdl_builtins() TB_LIB = VU.add_library("tb_lib") TB_LIB.add_source_files(Path(__file__).parent / "test" / "*.vhd") diff --git a/examples/vhdl/coverage/run.py b/examples/vhdl/coverage/run.py index 72b5d9442..954f1380b 100644 --- a/examples/vhdl/coverage/run.py +++ b/examples/vhdl/coverage/run.py @@ -18,6 +18,7 @@ def post_run(results): VU = VUnit.from_argv() +VU.add_vhdl_builtins() LIB = VU.add_library("lib") LIB.add_source_files(Path(__file__).parent / "*.vhd") diff --git a/examples/vhdl/generate_tests/run.py b/examples/vhdl/generate_tests/run.py index e9d657df2..cca37fde3 100644 --- a/examples/vhdl/generate_tests/run.py +++ b/examples/vhdl/generate_tests/run.py @@ -63,6 +63,8 @@ def generate_tests(obj, signs, data_widths): VU = VUnit.from_argv() +VU.add_vhdl_builtins() + LIB = VU.add_library("lib") LIB.add_source_files(Path(__file__).parent / "test" / "*.vhd") diff --git a/examples/vhdl/json4vhdl/run.py b/examples/vhdl/json4vhdl/run.py index 8fac1338d..be2c836c8 100644 --- a/examples/vhdl/json4vhdl/run.py +++ b/examples/vhdl/json4vhdl/run.py @@ -22,6 +22,7 @@ TEST_PATH = Path(__file__).parent / "src" / "test" VU = VUnit.from_argv() +VU.add_vhdl_builtins() VU.add_json4vhdl() LIB = VU.add_library("test") diff --git a/examples/vhdl/logging/run.py b/examples/vhdl/logging/run.py index c15d69577..9872321f5 100644 --- a/examples/vhdl/logging/run.py +++ b/examples/vhdl/logging/run.py @@ -17,6 +17,8 @@ from vunit import VUnit VU = VUnit.from_argv() +VU.add_vhdl_builtins() + VU.add_library("lib").add_source_files(Path(__file__).parent / "*.vhd") VU.main() diff --git a/examples/vhdl/run/run.py b/examples/vhdl/run/run.py index a60db509c..e1742c40d 100644 --- a/examples/vhdl/run/run.py +++ b/examples/vhdl/run/run.py @@ -19,6 +19,7 @@ ROOT = Path(__file__).parent VU = VUnit.from_argv() +VU.add_vhdl_builtins() LIB = VU.add_library("lib") LIB.add_source_files(ROOT / "*.vhd") diff --git a/examples/vhdl/third_party_integration/run.py b/examples/vhdl/third_party_integration/run.py index bc1fb078d..06ca603e0 100644 --- a/examples/vhdl/third_party_integration/run.py +++ b/examples/vhdl/third_party_integration/run.py @@ -10,5 +10,8 @@ from vunit import VUnit VU = VUnit.from_argv() +VU.add_vhdl_builtins() + VU.add_library("lib").add_source_files(Path(__file__).parent / "test" / "*.vhd") + VU.main() diff --git a/examples/vhdl/uart/run.py b/examples/vhdl/uart/run.py index ce7b868fe..43601989e 100644 --- a/examples/vhdl/uart/run.py +++ b/examples/vhdl/uart/run.py @@ -18,6 +18,7 @@ from vunit import VUnit VU = VUnit.from_argv() +VU.add_vhdl_builtins() VU.add_osvvm() VU.add_verification_components() diff --git a/examples/vhdl/user_guide/run.py b/examples/vhdl/user_guide/run.py index 81c95f2ef..128dabedd 100644 --- a/examples/vhdl/user_guide/run.py +++ b/examples/vhdl/user_guide/run.py @@ -18,5 +18,8 @@ from vunit import VUnit VU = VUnit.from_argv() +VU.add_vhdl_builtins() + VU.add_library("lib").add_source_files(Path(__file__).parent / "*.vhd") + VU.main() diff --git a/examples/vhdl/user_guide/vhdl1993/run.py b/examples/vhdl/user_guide/vhdl1993/run.py index 755ffa1e2..a37c3f37b 100644 --- a/examples/vhdl/user_guide/vhdl1993/run.py +++ b/examples/vhdl/user_guide/vhdl1993/run.py @@ -18,5 +18,8 @@ from vunit import VUnit VU = VUnit.from_argv(vhdl_standard="93") +VU.add_vhdl_builtins() + VU.add_library("lib").add_source_files(Path(__file__).parent / "*.vhd") + VU.main() diff --git a/examples/vhdl/vivado/run.py b/examples/vhdl/vivado/run.py index e3834bff7..0957cec43 100644 --- a/examples/vhdl/vivado/run.py +++ b/examples/vhdl/vivado/run.py @@ -20,6 +20,7 @@ SRC_PATH = ROOT / "src" VU = VUnit.from_argv() +VU.add_vhdl_builtins() VU.add_library("lib").add_source_files(SRC_PATH / "*.vhd") VU.add_library("tb_lib").add_source_files(SRC_PATH / "test" / "*.vhd") diff --git a/tests/acceptance/artificial/vhdl/run.py b/tests/acceptance/artificial/vhdl/run.py index 36dc8b7b2..8d5ef4930 100644 --- a/tests/acceptance/artificial/vhdl/run.py +++ b/tests/acceptance/artificial/vhdl/run.py @@ -11,10 +11,12 @@ root = Path(__file__).parent vu = VUnit.from_argv() +VU.add_vhdl_builtins() + lib = vu.add_library("lib") lib2 = vu.add_library("lib2") -files = glob(str(root / "*.vhd")) -for file in files: + +for file in glob(str(root / "*.vhd")): if "tb_set_generic" in file: lib2.add_source_files(file) else: diff --git a/tests/acceptance/test_dependencies.py b/tests/acceptance/test_dependencies.py index 62ebec340..233e27ba2 100644 --- a/tests/acceptance/test_dependencies.py +++ b/tests/acceptance/test_dependencies.py @@ -49,6 +49,7 @@ def run(value): argv.append("--clean") ui = VUnit.from_argv(argv=argv) + ui.add_vhdl_builtins() lib = ui.add_library("lib") lib.add_source_files(tb_pkg_file_name) lib.add_source_files(pkg_file_name) diff --git a/tests/unit/test_ui.py b/tests/unit/test_ui.py index 047f82e43..90b255a72 100644 --- a/tests/unit/test_ui.py +++ b/tests/unit/test_ui.py @@ -1243,7 +1243,6 @@ def _create_ui_real_sim(self, *args): """Create an instance of the VUnit public interface class""" return VUnit.from_argv( argv=["--output-path=%s" % self._output_path, "--clean"] + list(args), - compile_builtins=False, ) def _run_main(self, ui, code=0, post_run=None): diff --git a/vunit/ui/__init__.py b/vunit/ui/__init__.py index 121a02abc..985c8b971 100644 --- a/vunit/ui/__init__.py +++ b/vunit/ui/__init__.py @@ -59,14 +59,12 @@ class VUnit(object): # pylint: disable=too-many-instance-attributes, too-many-p def from_argv( cls, argv=None, - compile_builtins: Optional[bool] = True, vhdl_standard: Optional[str] = None, ): """ Create VUnit instance from command line arguments. :param argv: Use explicit argv instead of actual command line argument - :param compile_builtins: Do not compile builtins. Used for VUnit internal testing. :param vhdl_standard: The VHDL standard used to compile files, if None the VUNIT_VHDL_STANDARD environment variable is used :returns: A :class:`.VUnit` object instance @@ -77,28 +75,21 @@ def from_argv( from vunit import VUnit prj = VUnit.from_argv() + prj.add_vhdl_builtins() .. IMPORTANT:: - Option ``compile_builtins`` is deprecated and it will be removed in an upcoming release. - VHDL users will need to call method :meth:`add_vhdl_builtins` explicitly in order to preserve the + As of VUnit v5, option ``compile_builtins`` is removed. + VHDL users need to call method :meth:`add_vhdl_builtins` explicitly in order to preserve the functionality. See :vunit_issue:`777`. - It is therefore recommended to now use the following procedure: - - .. code-block:: python - - from vunit import VUnit - prj = VUnit.from_argv(compile_builtins=False) - prj.add_vhdl_builtins() """ args = VUnitCLI().parse_args(argv=argv) - return cls.from_args(args, compile_builtins=compile_builtins, vhdl_standard=vhdl_standard) + return cls.from_args(args, vhdl_standard=vhdl_standard) @classmethod def from_args( cls, args, - compile_builtins: Optional[bool] = True, vhdl_standard: Optional[str] = None, ): """ @@ -108,23 +99,21 @@ def from_args( adding custom command line options. :param args: The parsed argument namespace object - :param compile_builtins: Do not compile builtins. Used for VUnit internal testing. :param vhdl_standard: The VHDL standard used to compile files, if None the VUNIT_VHDL_STANDARD environment variable is used :returns: A :class:`.VUnit` object instance .. IMPORTANT:: - Option ``compile_builtins`` is deprecated and it will be removed in an upcoming release. - VHDL users will need to call method :meth:`add_vhdl_builtins` explicitly in order to preserve the + As of VUnit v5, option ``compile_builtins`` is removed. + VHDL users need to call method :meth:`add_vhdl_builtins` explicitly in order to preserve the functionality. See :vunit_issue:`777`. """ - return cls(args, compile_builtins=compile_builtins, vhdl_standard=vhdl_standard) + return cls(args, vhdl_standard=vhdl_standard) def __init__( self, args, - compile_builtins: Optional[bool] = True, vhdl_standard: Optional[str] = None, ): self._args = args @@ -179,13 +168,8 @@ def test_filter(name, attribute_names): hline = "=" * 75 print(hline) LOGGER.warning( - """Option 'compile_builtins' of methods 'from_args' and 'from_argv' is deprecated. -In future releases, it will be removed and builtins will need to be added explicitly. -To prepare for upcoming changes, it is recommended to apply the following modifications in the run script now: - -* Use `from_argv(compile_builtins=False)` or `from_args(compile_builtins=False)`. -* Add an explicit call to 'add_vhdl_builtins'. - + """As of VUnit v5, option ``compile_builtins`` of methods 'from_args' and 'from_argv' is removed. +HDL builtins need to be added explicitly. See https://github.com/VUnit/vunit/issues/777. """ ) @@ -1008,9 +992,8 @@ def add_vhdl_builtins(self, external=None): ) .. IMPORTANT:: - Option ``compile_builtins`` of methods :meth:`from_argv` and :meth:`from_args` is deprecated and it will be - removed in an upcoming release. - VHDL users will need to call this method explicitly in order to preserve the functionality. + As of VUnit v5, option ``compile_builtins`` of methods :meth:`from_argv` and :meth:`from_args` is removed. + VHDL users need to call this method explicitly in order to preserve the functionality. See :vunit_issue:`777`. """ self._builtins.add_vhdl_builtins(external=external) diff --git a/vunit/vhdl/array/run.py b/vunit/vhdl/array/run.py index 0e4f840e8..00657bfdd 100644 --- a/vunit/vhdl/array/run.py +++ b/vunit/vhdl/array/run.py @@ -11,6 +11,7 @@ ROOT = Path(__file__).parent VU = VUnit.from_argv() +VU.add_vhdl_builtins() VU.add_array_util() VU.library("vunit_lib").add_source_files(ROOT / "test" / "*.vhd") diff --git a/vunit/vhdl/check/run.py b/vunit/vhdl/check/run.py index 4e52bb4d2..6629fe1b4 100644 --- a/vunit/vhdl/check/run.py +++ b/vunit/vhdl/check/run.py @@ -16,6 +16,7 @@ generate_check_match.main() VU = VUnit.from_argv() +VU.add_vhdl_builtins() LIB = VU.add_library("lib") LIB.add_source_files(Path(ROOT) / "vunit" / "vhdl" / "check" / "test" / "test_support.vhd") diff --git a/vunit/vhdl/com/run.py b/vunit/vhdl/com/run.py index c0af16fba..717d5b39a 100644 --- a/vunit/vhdl/com/run.py +++ b/vunit/vhdl/com/run.py @@ -10,7 +10,9 @@ ROOT = Path(__file__).parent UI = VUnit.from_argv() +UI.add_vhdl_builtins() UI.add_com() + TB_COM_LIB = UI.add_library("tb_com_lib") TB_COM_LIB.add_source_files(ROOT / "test" / "*.vhd") TB_COM_LIB.package("custom_types_pkg").generate_codecs( diff --git a/vunit/vhdl/data_types/run.py b/vunit/vhdl/data_types/run.py index a7e4d6d1e..cfcc4c4c6 100644 --- a/vunit/vhdl/data_types/run.py +++ b/vunit/vhdl/data_types/run.py @@ -11,6 +11,8 @@ ROOT = Path(__file__).parent VU = VUnit.from_argv() +VU.add_vhdl_builtins() + LIB = VU.library("vunit_lib") LIB.add_source_files(ROOT / ".." / "logging" / "test" / "test_support_pkg.vhd") for fname in glob(str(ROOT / "test" / "*.vhd")): diff --git a/vunit/vhdl/dictionary/run.py b/vunit/vhdl/dictionary/run.py index bd08d3c48..b8f109c21 100644 --- a/vunit/vhdl/dictionary/run.py +++ b/vunit/vhdl/dictionary/run.py @@ -10,6 +10,8 @@ ROOT = Path(__file__).parent UI = VUnit.from_argv() +UI.add_vhdl_builtins() + UI.add_library("lib").add_source_files(ROOT / "test" / "*.vhd") UI.main() diff --git a/vunit/vhdl/logging/run.py b/vunit/vhdl/logging/run.py index 0751b02db..97e500a1e 100644 --- a/vunit/vhdl/logging/run.py +++ b/vunit/vhdl/logging/run.py @@ -15,6 +15,7 @@ def main(): root = Path(__file__).parent ui = VUnit.from_argv() + ui.add_vhdl_builtins() vunit_lib = ui.library("vunit_lib") files = glob.glob(str(root / "test" / "*.vhd")) diff --git a/vunit/vhdl/path/run.py b/vunit/vhdl/path/run.py index bd08d3c48..b8f109c21 100644 --- a/vunit/vhdl/path/run.py +++ b/vunit/vhdl/path/run.py @@ -10,6 +10,8 @@ ROOT = Path(__file__).parent UI = VUnit.from_argv() +UI.add_vhdl_builtins() + UI.add_library("lib").add_source_files(ROOT / "test" / "*.vhd") UI.main() diff --git a/vunit/vhdl/random/run.py b/vunit/vhdl/random/run.py index 29c2d4d98..bc206bbdb 100644 --- a/vunit/vhdl/random/run.py +++ b/vunit/vhdl/random/run.py @@ -10,7 +10,9 @@ ROOT = Path(__file__).parent UI = VUnit.from_argv() +UI.add_vhdl_builtins() UI.add_random() + UI.library("vunit_lib").add_source_files(ROOT / "test" / "*.vhd") UI.main() diff --git a/vunit/vhdl/run/run.py b/vunit/vhdl/run/run.py index 8da063d5c..f9d06923b 100644 --- a/vunit/vhdl/run/run.py +++ b/vunit/vhdl/run/run.py @@ -10,6 +10,8 @@ ROOT = Path(__file__).parent UI = VUnit.from_argv() +UI.add_vhdl_builtins() + UI.add_library("tb_run_lib").add_source_files(ROOT / "test" / "*.vhd") UI.main() diff --git a/vunit/vhdl/string_ops/run.py b/vunit/vhdl/string_ops/run.py index bd08d3c48..b8f109c21 100644 --- a/vunit/vhdl/string_ops/run.py +++ b/vunit/vhdl/string_ops/run.py @@ -10,6 +10,8 @@ ROOT = Path(__file__).parent UI = VUnit.from_argv() +UI.add_vhdl_builtins() + UI.add_library("lib").add_source_files(ROOT / "test" / "*.vhd") UI.main() diff --git a/vunit/vhdl/verification_components/run.py b/vunit/vhdl/verification_components/run.py index 4033e484f..3886526a6 100644 --- a/vunit/vhdl/verification_components/run.py +++ b/vunit/vhdl/verification_components/run.py @@ -11,8 +11,10 @@ ROOT = Path(__file__).parent UI = VUnit.from_argv() +UI.add_vhdl_builtins() UI.add_random() UI.add_verification_components() + LIB = UI.library("vunit_lib") LIB.add_source_files(ROOT / "test" / "*.vhd")