Skip to content

Commit

Permalink
ui: remove 'compile_builtins'; preserve previous behaviour using 'add…
Browse files Browse the repository at this point in the history
…_vhdl_builtins' (VUnit#559)
  • Loading branch information
umarcor committed Oct 22, 2021
1 parent 57ccace commit 2e43c13
Show file tree
Hide file tree
Showing 30 changed files with 53 additions and 17 deletions.
1 change: 1 addition & 0 deletions examples/vhdl/array/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions examples/vhdl/array_axis_vcs/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions examples/vhdl/axi_dma/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from vunit import VUnit

VU = VUnit.from_argv()
VU.add_vhdl_builtins()
VU.add_osvvm()
VU.add_verification_components()

Expand Down
1 change: 1 addition & 0 deletions examples/vhdl/check/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions examples/vhdl/com/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions examples/vhdl/composite_generics/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions examples/vhdl/coverage/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 2 additions & 0 deletions examples/vhdl/generate_tests/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
1 change: 1 addition & 0 deletions examples/vhdl/json4vhdl/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 2 additions & 0 deletions examples/vhdl/logging/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
1 change: 1 addition & 0 deletions examples/vhdl/run/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
3 changes: 3 additions & 0 deletions examples/vhdl/third_party_integration/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
1 change: 1 addition & 0 deletions examples/vhdl/uart/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from vunit import VUnit

VU = VUnit.from_argv()
VU.add_vhdl_builtins()
VU.add_osvvm()
VU.add_verification_components()

Expand Down
3 changes: 3 additions & 0 deletions examples/vhdl/user_guide/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
3 changes: 3 additions & 0 deletions examples/vhdl/user_guide/vhdl1993/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
1 change: 1 addition & 0 deletions examples/vhdl/vivado/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 2 additions & 0 deletions tests/acceptance/artificial/vhdl/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
ROOT = Path(__file__).parent

VU = VUnit.from_argv()
VU.add_vhdl_builtins()

LIB = VU.add_library("lib")
LIB.add_source_files(ROOT / "*.vhd")

Expand Down
1 change: 1 addition & 0 deletions tests/acceptance/test_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion tests/unit/test_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -1155,7 +1155,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):
Expand Down
24 changes: 8 additions & 16 deletions vunit/ui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,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
Expand All @@ -81,13 +79,12 @@ def from_argv(
"""
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,
):
"""
Expand All @@ -97,18 +94,16 @@ 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
"""
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
Expand Down Expand Up @@ -158,15 +153,12 @@ def test_filter(name, attribute_names):
self._test_bench_list = TestBenchList(database=database)

self._builtins = Builtins(self, self._vhdl_standard, simulator_class)
if compile_builtins:
self.add_vhdl_builtins()
builtins_deprecation_note = (
"'compile_builtins' (which defaults to 'True') is deprecated "
"and it will be removed in future releases; "
"preserve the functionality using "
"'compile_builtins=False' and 'VU.add_vhdl_builtins'"
)
warn(builtins_deprecation_note, Warning)

builtins_deprecation_note = (
"'compile_builtins' ('True' by default) was removed; "
"preserve the functionality using 'VU.add_vhdl_builtins'"
)
warn(builtins_deprecation_note, Warning)

def _create_database(self):
"""
Expand Down
1 change: 1 addition & 0 deletions vunit/vhdl/check/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 2 additions & 0 deletions vunit/vhdl/com/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 2 additions & 0 deletions vunit/vhdl/data_types/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
ROOT = Path(__file__).parent

VU = VUnit.from_argv()
VU.add_vhdl_builtins()

LIB = VU.library("vunit_lib")
for fname in glob(str(ROOT / "test" / "*.vhd")):
if Path(fname).name.endswith("2008p.vhd") and VU.vhdl_standard not in [
Expand Down
2 changes: 2 additions & 0 deletions vunit/vhdl/dictionary/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
1 change: 1 addition & 0 deletions vunit/vhdl/logging/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
2 changes: 2 additions & 0 deletions vunit/vhdl/path/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
2 changes: 2 additions & 0 deletions vunit/vhdl/random/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
2 changes: 2 additions & 0 deletions vunit/vhdl/run/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
2 changes: 2 additions & 0 deletions vunit/vhdl/string_ops/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
2 changes: 2 additions & 0 deletions vunit/vhdl/verification_components/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down

0 comments on commit 2e43c13

Please sign in to comment.