diff --git a/doc/Usage.md b/doc/Usage.md index 377f761d..c84ea753 100644 --- a/doc/Usage.md +++ b/doc/Usage.md @@ -12,7 +12,7 @@ - [Aldec Riviera-PRO](https://www.aldec.com/en/products/functional_verification/riviera-pro) - [Aldec Active-HDL](https://www.aldec.com/en/products/fpga_simulation/active-hdl) -Note the following simulators are not currently supported by VUnit: +The following simulators are not currently supported by VUnit but all tests can be executed manually: - [Cadence Xcelium](https://www.cadence.com/en_US/home/tools/system-design-and-verification/simulation-and-testbench-verification/xcelium-simulator.html) - [Synopsys VCS](https://www.synopsys.com/verification/simulation/vcs.html) - [AMD/Xilinx Vivado Simulator (xsim)](https://www.xilinx.com) @@ -25,7 +25,7 @@ To install the correct version of VUnit, run: pip3 install -r requirements.txt ``` -## Running the Tests +## Running the Tests with VUnit Supported Simulator Since the compliance tests can fail on parsing the source data, the suggested way of running the tests using the system default simulator is to continue even @@ -51,6 +51,17 @@ Since this test suite is based on VUnit, please refer to the [VUnit Documentation](https://vunit.github.io/) for all supported options and configurations. +## Running the Tests with Simulators not Supported by VUnit + +The repository contains a VUnit mock which provides an alternative implementation +for the VUnit subprograms used by the testbenches. This is a minimalistic +implementation that do not mimic true VUnit behavior, but it still enables +the testbenches to execute, pass, and fail as intended. The VUnit mock files can +be found in the `vunit_mock` directory and must be compiled into a library named +`vunit_lib`. The testbenches in the `vhdl_2008` and `vunit_2019` directories can +then be compiled and simulated independently. Please review the log for any +compliance errors that may be detected during the simulation. + ## Interpreting Test Results Currently the tests are focused on parsing and compiler compliance, and it is diff --git a/vhdl_2008/tb_bit_string_literals.vhd b/vhdl_2008/tb_bit_string_literals.vhd index 0be26c6b..bcd90c96 100644 --- a/vhdl_2008/tb_bit_string_literals.vhd +++ b/vhdl_2008/tb_bit_string_literals.vhd @@ -7,7 +7,7 @@ library ieee; use ieee.std_logic_1164.all; entity tb_bit_string_literals is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity tb_bit_string_literals; architecture tb of tb_bit_string_literals is diff --git a/vhdl_2008/tb_condition_operator.vhd b/vhdl_2008/tb_condition_operator.vhd index b2743b30..ca518414 100644 --- a/vhdl_2008/tb_condition_operator.vhd +++ b/vhdl_2008/tb_condition_operator.vhd @@ -4,7 +4,7 @@ context vunit_lib.vunit_context; library ieee; use ieee.std_logic_1164.all; entity tb_condition_operator is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_condition_operator is diff --git a/vhdl_2008/tb_entity_generic_type.vhd b/vhdl_2008/tb_entity_generic_type.vhd index 0b63154d..1c5f4b82 100644 --- a/vhdl_2008/tb_entity_generic_type.vhd +++ b/vhdl_2008/tb_entity_generic_type.vhd @@ -19,7 +19,7 @@ library vunit_lib; context vunit_lib.vunit_context; entity tb_entity_generic_type is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_entity_generic_type is diff --git a/vhdl_2008/tb_external_names.vhd b/vhdl_2008/tb_external_names.vhd index eb29becb..55313cf0 100644 --- a/vhdl_2008/tb_external_names.vhd +++ b/vhdl_2008/tb_external_names.vhd @@ -17,7 +17,7 @@ library vunit_lib ; context vunit_lib.vunit_context; entity tb_external_names is - generic ( runner_cfg : string ) ; + generic ( runner_cfg : string := runner_cfg_default) ; end entity; architecture arch of tb_external_names is diff --git a/vhdl_2008/tb_fixed_generic_pkg.vhd b/vhdl_2008/tb_fixed_generic_pkg.vhd index 8d08f57f..cf9f6f11 100644 --- a/vhdl_2008/tb_fixed_generic_pkg.vhd +++ b/vhdl_2008/tb_fixed_generic_pkg.vhd @@ -5,7 +5,7 @@ library vunit_lib; context vunit_lib.vunit_context; entity tb_fixed_generic_pkg is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_fixed_generic_pkg is diff --git a/vhdl_2008/tb_function_generic_in_package.vhd b/vhdl_2008/tb_function_generic_in_package.vhd index f35fc212..1e40995e 100644 --- a/vhdl_2008/tb_function_generic_in_package.vhd +++ b/vhdl_2008/tb_function_generic_in_package.vhd @@ -46,7 +46,7 @@ library vunit_lib; context vunit_lib.vunit_context; entity tb_function_generic_in_package is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_function_generic_in_package is diff --git a/vhdl_2008/tb_generic_packages_on_entity.vhd b/vhdl_2008/tb_generic_packages_on_entity.vhd index 9c5dd93b..87045800 100644 --- a/vhdl_2008/tb_generic_packages_on_entity.vhd +++ b/vhdl_2008/tb_generic_packages_on_entity.vhd @@ -64,7 +64,7 @@ library vunit_lib; context vunit_lib.vunit_context; entity tb_generic_packages_on_entity is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity ; architecture tb of tb_generic_packages_on_entity is diff --git a/vhdl_2008/tb_generics_in_packages.vhd b/vhdl_2008/tb_generics_in_packages.vhd index 5003081f..848dc6a9 100644 --- a/vhdl_2008/tb_generics_in_packages.vhd +++ b/vhdl_2008/tb_generics_in_packages.vhd @@ -14,7 +14,7 @@ library vunit_lib; context vunit_lib.vunit_context; entity tb_generics_in_packages is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_generics_in_packages is diff --git a/vhdl_2008/tb_matching_case.vhd b/vhdl_2008/tb_matching_case.vhd index 18ba0231..7505f690 100644 --- a/vhdl_2008/tb_matching_case.vhd +++ b/vhdl_2008/tb_matching_case.vhd @@ -4,7 +4,7 @@ library ieee; use ieee.std_logic_1164.all; entity tb_matching_case is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity tb_matching_case; architecture tb of tb_matching_case is diff --git a/vhdl_2008/tb_matching_operator_eq.vhd b/vhdl_2008/tb_matching_operator_eq.vhd index d67b9f71..e6c3f56f 100644 --- a/vhdl_2008/tb_matching_operator_eq.vhd +++ b/vhdl_2008/tb_matching_operator_eq.vhd @@ -4,7 +4,7 @@ library ieee; use ieee.std_logic_1164.all; entity tb_matching_operators_eq is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity tb_matching_operators_eq; architecture tb of tb_matching_operators_eq is diff --git a/vhdl_2008/tb_matching_operator_ge.vhd b/vhdl_2008/tb_matching_operator_ge.vhd index 42c918fb..ceb5a9e7 100644 --- a/vhdl_2008/tb_matching_operator_ge.vhd +++ b/vhdl_2008/tb_matching_operator_ge.vhd @@ -4,7 +4,7 @@ library ieee; use ieee.std_logic_1164.all; entity tb_matching_operators_ge is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity tb_matching_operators_ge; architecture tb of tb_matching_operators_ge is diff --git a/vhdl_2008/tb_matching_operator_gt.vhd b/vhdl_2008/tb_matching_operator_gt.vhd index b3352470..074de6b0 100644 --- a/vhdl_2008/tb_matching_operator_gt.vhd +++ b/vhdl_2008/tb_matching_operator_gt.vhd @@ -4,7 +4,7 @@ library ieee; use ieee.std_logic_1164.all; entity tb_matching_operators_gt is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity tb_matching_operators_gt; architecture tb of tb_matching_operators_gt is diff --git a/vhdl_2008/tb_matching_operator_le.vhd b/vhdl_2008/tb_matching_operator_le.vhd index 51f441cd..2dc88fc5 100644 --- a/vhdl_2008/tb_matching_operator_le.vhd +++ b/vhdl_2008/tb_matching_operator_le.vhd @@ -4,7 +4,7 @@ library ieee; use ieee.std_logic_1164.all; entity tb_matching_operators_le is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity tb_matching_operators_le; architecture tb of tb_matching_operators_le is diff --git a/vhdl_2008/tb_matching_operator_lt.vhd b/vhdl_2008/tb_matching_operator_lt.vhd index 10278a0f..c9f4d6e5 100644 --- a/vhdl_2008/tb_matching_operator_lt.vhd +++ b/vhdl_2008/tb_matching_operator_lt.vhd @@ -4,7 +4,7 @@ library ieee; use ieee.std_logic_1164.all; entity tb_matching_operators_lt is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity tb_matching_operators_lt; architecture tb of tb_matching_operators_lt is diff --git a/vhdl_2008/tb_matching_operator_ne.vhd b/vhdl_2008/tb_matching_operator_ne.vhd index 77060c70..3eea3fdf 100644 --- a/vhdl_2008/tb_matching_operator_ne.vhd +++ b/vhdl_2008/tb_matching_operator_ne.vhd @@ -4,7 +4,7 @@ library ieee; use ieee.std_logic_1164.all; entity tb_matching_operators_ne is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity tb_matching_operators_ne; architecture tb of tb_matching_operators_ne is diff --git a/vhdl_2008/tb_numeric_std_unsigned.vhd b/vhdl_2008/tb_numeric_std_unsigned.vhd index 8ab69ef2..0a40809f 100644 --- a/vhdl_2008/tb_numeric_std_unsigned.vhd +++ b/vhdl_2008/tb_numeric_std_unsigned.vhd @@ -7,7 +7,7 @@ use ieee.numeric_std.to_unsigned; use ieee.numeric_std_unsigned.all; entity tb_numeric_std_unsigned is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_numeric_std_unsigned is diff --git a/vhdl_2008/tb_psl.vhd b/vhdl_2008/tb_psl.vhd index f83f526e..a9d911e2 100644 --- a/vhdl_2008/tb_psl.vhd +++ b/vhdl_2008/tb_psl.vhd @@ -5,7 +5,7 @@ library ieee; use ieee.std_logic_1164.all; entity tb_psl is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity tb_psl; architecture tb of tb_psl is diff --git a/vhdl_2008/tb_top_generic_subtype.vhd b/vhdl_2008/tb_top_generic_subtype.vhd index ca3bb4b9..86f441be 100644 --- a/vhdl_2008/tb_top_generic_subtype.vhd +++ b/vhdl_2008/tb_top_generic_subtype.vhd @@ -2,7 +2,7 @@ library vunit_lib; context vunit_lib.vunit_context; entity tb_top_generic_subtype is - generic ( runner_cfg : runner_cfg_t ); + generic ( runner_cfg : runner_cfg_t := runner_cfg_default); end entity tb_top_generic_subtype; architecture tb of tb_top_generic_subtype is diff --git a/vhdl_2008/tb_type_generics_in_packages.vhd b/vhdl_2008/tb_type_generics_in_packages.vhd index fd041a18..4a4b0557 100644 --- a/vhdl_2008/tb_type_generics_in_packages.vhd +++ b/vhdl_2008/tb_type_generics_in_packages.vhd @@ -27,7 +27,7 @@ library vunit_lib; context vunit_lib.vunit_context; entity tb_type_generics_in_packages is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_type_generics_in_packages is diff --git a/vhdl_2019/tb_001.vhd b/vhdl_2019/tb_001.vhd index 60f4ec01..22d42770 100644 --- a/vhdl_2019/tb_001.vhd +++ b/vhdl_2019/tb_001.vhd @@ -27,7 +27,7 @@ library vunit_lib; context vunit_lib.vunit_context; entity tb_partially_connected_vectors_on_port_map is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_partially_connected_vectors_on_port_map is diff --git a/vhdl_2019/tb_002.vhd b/vhdl_2019/tb_002.vhd index a10a5b56..5dd876dd 100644 --- a/vhdl_2019/tb_002.vhd +++ b/vhdl_2019/tb_002.vhd @@ -41,7 +41,7 @@ context vunit_lib.vunit_context; use work.pack002.all ; entity tb_allow_access_and_protected_type_params_on_func_interfaces is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_allow_access_and_protected_type_params_on_func_interfaces is diff --git a/vhdl_2019/tb_004.vhd b/vhdl_2019/tb_004.vhd index c28a168f..b9987ae5 100644 --- a/vhdl_2019/tb_004.vhd +++ b/vhdl_2019/tb_004.vhd @@ -29,7 +29,7 @@ context vunit_lib.vunit_context; use work.pack004.all ; entity tb_allow_protected_type_method_params_to_be_access_protected_file is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_allow_protected_type_method_params_to_be_access_protected_file is diff --git a/vhdl_2019/tb_006a.vhd b/vhdl_2019/tb_006a.vhd index 8fadd643..e2c5f7d5 100644 --- a/vhdl_2019/tb_006a.vhd +++ b/vhdl_2019/tb_006a.vhd @@ -66,7 +66,7 @@ library vunit_lib; context vunit_lib.vunit_context; entity tb_fileio_textio_updates is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_fileio_textio_updates is diff --git a/vhdl_2019/tb_006e.vhd b/vhdl_2019/tb_006e.vhd index eca5706b..31db638a 100644 --- a/vhdl_2019/tb_006e.vhd +++ b/vhdl_2019/tb_006e.vhd @@ -42,7 +42,7 @@ library vunit_lib; context vunit_lib.vunit_context; entity tb_access_system_environment_variables is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_access_system_environment_variables is diff --git a/vhdl_2019/tb_006f.vhd b/vhdl_2019/tb_006f.vhd index cf1d36ab..25391a5a 100644 --- a/vhdl_2019/tb_006f.vhd +++ b/vhdl_2019/tb_006f.vhd @@ -28,7 +28,7 @@ library vunit_lib; context vunit_lib.vunit_context; entity tb_standard_conditional_analysis_identifiers is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_standard_conditional_analysis_identifiers is diff --git a/vhdl_2019/tb_007.vhd b/vhdl_2019/tb_007.vhd index 2f401f03..5dee9651 100644 --- a/vhdl_2019/tb_007.vhd +++ b/vhdl_2019/tb_007.vhd @@ -47,7 +47,7 @@ library vunit_lib; context vunit_lib.vunit_context; entity tb_sequential_declaration_regions is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_sequential_declaration_regions is diff --git a/vhdl_2019/tb_011.vhd b/vhdl_2019/tb_011.vhd index b67f9d2a..fd55f816 100644 --- a/vhdl_2019/tb_011.vhd +++ b/vhdl_2019/tb_011.vhd @@ -40,7 +40,7 @@ library vunit_lib; context vunit_lib.vunit_context; entity tb_date_time_functions is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_date_time_functions is diff --git a/vhdl_2019/tb_012.vhd b/vhdl_2019/tb_012.vhd index e6641b06..09bc560a 100644 --- a/vhdl_2019/tb_012.vhd +++ b/vhdl_2019/tb_012.vhd @@ -31,7 +31,7 @@ library vunit_lib; context vunit_lib.vunit_context; entity tb_image_and_to_string_for_composite_types is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_image_and_to_string_for_composite_types is diff --git a/vhdl_2019/tb_014.vhd b/vhdl_2019/tb_014.vhd index 71510cce..d0a0dce5 100644 --- a/vhdl_2019/tb_014.vhd +++ b/vhdl_2019/tb_014.vhd @@ -8,7 +8,7 @@ library vunit_lib; context vunit_lib.vunit_context; entity tb_composites_of_protected_types is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_composites_of_protected_types is diff --git a/vhdl_2019/tb_014a.vhd b/vhdl_2019/tb_014a.vhd index f5c88d38..4beac302 100644 --- a/vhdl_2019/tb_014a.vhd +++ b/vhdl_2019/tb_014a.vhd @@ -8,7 +8,7 @@ library vunit_lib; context vunit_lib.vunit_context; entity tb_access_types_to_protected_types_and_composites_of_protected_types is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_access_types_to_protected_types_and_composites_of_protected_types is diff --git a/vhdl_2019/tb_015.vhd b/vhdl_2019/tb_015.vhd index 81e6c5cb..88a015a9 100644 --- a/vhdl_2019/tb_015.vhd +++ b/vhdl_2019/tb_015.vhd @@ -32,7 +32,7 @@ library vunit_lib; context vunit_lib.vunit_context; entity tb_report_calling_path is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_report_calling_path is diff --git a/vhdl_2019/tb_015a.vhd b/vhdl_2019/tb_015a.vhd index c27ca94f..2aa165d6 100644 --- a/vhdl_2019/tb_015a.vhd +++ b/vhdl_2019/tb_015a.vhd @@ -25,7 +25,7 @@ library vunit_lib; context vunit_lib.vunit_context; entity tb_report_current_file_name_line_path is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_report_current_file_name_line_path is diff --git a/vhdl_2019/tb_016.vhd b/vhdl_2019/tb_016.vhd index 0df6a690..f974108e 100644 --- a/vhdl_2019/tb_016.vhd +++ b/vhdl_2019/tb_016.vhd @@ -29,7 +29,7 @@ library vunit_lib; context vunit_lib.vunit_context; entity tb_anonymous_types is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_anonymous_types is diff --git a/vhdl_2019/tb_018.vhd b/vhdl_2019/tb_018.vhd index 919a2f8c..f18c152f 100644 --- a/vhdl_2019/tb_018.vhd +++ b/vhdl_2019/tb_018.vhd @@ -31,7 +31,7 @@ context vunit_lib.vunit_context; use work.pack018.all ; entity tb_enumerated_type_attributes is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_enumerated_type_attributes is diff --git a/vhdl_2019/tb_018a.vhd b/vhdl_2019/tb_018a.vhd index 0dda8d84..bad35d44 100644 --- a/vhdl_2019/tb_018a.vhd +++ b/vhdl_2019/tb_018a.vhd @@ -18,7 +18,7 @@ context vunit_lib.vunit_context; use work.pack018a.all ; entity tb_new_attribute_index is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_new_attribute_index is diff --git a/vhdl_2019/tb_018d.vhd b/vhdl_2019/tb_018d.vhd index 150c822c..56f29aa5 100644 --- a/vhdl_2019/tb_018d.vhd +++ b/vhdl_2019/tb_018d.vhd @@ -15,7 +15,7 @@ context vunit_lib.vunit_context; use work.pack018d.all ; entity tb_new_attribute_designated_type is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_new_attribute_designated_type is diff --git a/vhdl_2019/tb_019.vhd b/vhdl_2019/tb_019.vhd index 471bf81d..ea484ce6 100644 --- a/vhdl_2019/tb_019.vhd +++ b/vhdl_2019/tb_019.vhd @@ -29,7 +29,7 @@ library vunit_lib; context vunit_lib.vunit_context; entity tb_inferring_constraints_from_initial_values_for_signals_and_variables is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_inferring_constraints_from_initial_values_for_signals_and_variables is diff --git a/vhdl_2019/tb_023.vhd b/vhdl_2019/tb_023.vhd index 29477277..467b7e60 100644 --- a/vhdl_2019/tb_023.vhd +++ b/vhdl_2019/tb_023.vhd @@ -8,7 +8,7 @@ library vunit_lib; context vunit_lib.vunit_context; entity tb_relax_library_requirement_on_configurations is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_relax_library_requirement_on_configurations is diff --git a/vhdl_2019/tb_026c.vhd b/vhdl_2019/tb_026c.vhd index dfb8d769..7f47a206 100644 --- a/vhdl_2019/tb_026c.vhd +++ b/vhdl_2019/tb_026c.vhd @@ -18,7 +18,7 @@ context vunit_lib.vunit_context; use work.pack026c.all ; entity tb_long_integers is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_long_integers is diff --git a/vhdl_2019/tb_030.vhd b/vhdl_2019/tb_030.vhd index 00c8f2d6..a17211ae 100644 --- a/vhdl_2019/tb_030.vhd +++ b/vhdl_2019/tb_030.vhd @@ -30,7 +30,7 @@ library vunit_lib; context vunit_lib.vunit_context; entity tb_garbage_collection is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_garbage_collection is diff --git a/vhdl_2019/tb_032.vhd b/vhdl_2019/tb_032.vhd index 9ba10b08..d172cf03 100644 --- a/vhdl_2019/tb_032.vhd +++ b/vhdl_2019/tb_032.vhd @@ -47,7 +47,7 @@ library vunit_lib; context vunit_lib.vunit_context; entity tb_path_name_and_shared_variables_and_subprograms is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_path_name_and_shared_variables_and_subprograms is diff --git a/vhdl_2019/tb_033.vhd b/vhdl_2019/tb_033.vhd index de10a7f4..d37da9a8 100644 --- a/vhdl_2019/tb_033.vhd +++ b/vhdl_2019/tb_033.vhd @@ -21,7 +21,7 @@ context vunit_lib.vunit_context; use work.pack033.all ; entity tb_composition_with_protected_types is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_composition_with_protected_types is diff --git a/vhdl_2019/tb_034.vhd b/vhdl_2019/tb_034.vhd index d91b7661..f2c08dac 100644 --- a/vhdl_2019/tb_034.vhd +++ b/vhdl_2019/tb_034.vhd @@ -27,7 +27,7 @@ context vunit_lib.vunit_context; use work.pack034.all ; entity tb_protected_types_with_generic_clause is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_protected_types_with_generic_clause is diff --git a/vhdl_2019/tb_036a.vhd b/vhdl_2019/tb_036a.vhd index 85ee6f84..4754c222 100644 --- a/vhdl_2019/tb_036a.vhd +++ b/vhdl_2019/tb_036a.vhd @@ -18,7 +18,7 @@ context vunit_lib.vunit_context; entity tb_conditional_expressions_in_a_declaration is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_conditional_expressions_in_a_declaration is diff --git a/vhdl_2019/tb_041.vhd b/vhdl_2019/tb_041.vhd index 5c534cf4..4b3ab5b3 100644 --- a/vhdl_2019/tb_041.vhd +++ b/vhdl_2019/tb_041.vhd @@ -141,7 +141,7 @@ context vunit_lib.vunit_context; use work.pack041.all ; entity tb_record_introspection_type_reflection is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_record_introspection_type_reflection is diff --git a/vhdl_2019/tb_043.vhd b/vhdl_2019/tb_043.vhd index eda8677b..c3200b9c 100644 --- a/vhdl_2019/tb_043.vhd +++ b/vhdl_2019/tb_043.vhd @@ -112,7 +112,7 @@ library vunit_lib; context vunit_lib.vunit_context; entity tb_api_and_attributes_for_psl is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_api_and_attributes_for_psl is diff --git a/vhdl_2019/tb_045a.vhd b/vhdl_2019/tb_045a.vhd index 543b469b..7a1e9d17 100644 --- a/vhdl_2019/tb_045a.vhd +++ b/vhdl_2019/tb_045a.vhd @@ -26,7 +26,7 @@ context vunit_lib.vunit_context; use work.pack045a.all ; entity tb_interface_mode_view is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_interface_mode_view is diff --git a/vhdl_2019/tb_045c.vhd b/vhdl_2019/tb_045c.vhd index 57d9daeb..3fa79a47 100644 --- a/vhdl_2019/tb_045c.vhd +++ b/vhdl_2019/tb_045c.vhd @@ -28,7 +28,7 @@ context vunit_lib.vunit_context; use work.pack045c.all ; entity tb_interface_converse is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_interface_converse is diff --git a/vhdl_2019/tb_047.vhd b/vhdl_2019/tb_047.vhd index 421b686d..d720bf65 100644 --- a/vhdl_2019/tb_047.vhd +++ b/vhdl_2019/tb_047.vhd @@ -77,7 +77,7 @@ library vunit_lib; context vunit_lib.vunit_context; entity tb_protected_type_shared_variables_on_entity_interface is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_protected_type_shared_variables_on_entity_interface is diff --git a/vhdl_2019/tb_049.vhd b/vhdl_2019/tb_049.vhd index ecdfdc26..c69c32e1 100644 --- a/vhdl_2019/tb_049.vhd +++ b/vhdl_2019/tb_049.vhd @@ -74,7 +74,7 @@ library vunit_lib; context vunit_lib.vunit_context; entity tb_map_generics_on_subprogram_call is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_map_generics_on_subprogram_call is diff --git a/vhdl_2019/tb_050.vhd b/vhdl_2019/tb_050.vhd index beb0dd4b..42ad6a93 100644 --- a/vhdl_2019/tb_050.vhd +++ b/vhdl_2019/tb_050.vhd @@ -38,7 +38,7 @@ library vunit_lib; context vunit_lib.vunit_context; entity tb_api_for_assert is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_api_for_assert is diff --git a/vhdl_2019/tb_055a.vhd b/vhdl_2019/tb_055a.vhd index ff28f1c8..f2411385 100644 --- a/vhdl_2019/tb_055a.vhd +++ b/vhdl_2019/tb_055a.vhd @@ -19,7 +19,7 @@ context vunit_lib.vunit_context; use work.pack055a.all ; entity tb_syntax_regularization_components is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_syntax_regularization_components is diff --git a/vhdl_2019/tb_059.vhd b/vhdl_2019/tb_059.vhd index 2eba654c..c74fb069 100644 --- a/vhdl_2019/tb_059.vhd +++ b/vhdl_2019/tb_059.vhd @@ -116,7 +116,7 @@ library vunit_lib; context vunit_lib.vunit_context; entity tb_array_type_generics is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_array_type_generics is diff --git a/vhdl_2019/tb_061.vhd b/vhdl_2019/tb_061.vhd index 0da75159..4ed0e9c1 100644 --- a/vhdl_2019/tb_061.vhd +++ b/vhdl_2019/tb_061.vhd @@ -19,7 +19,7 @@ context vunit_lib.vunit_context; use work.pack061.all ; entity tb_conditional_compilation is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_conditional_compilation is diff --git a/vhdl_2019/tb_071a.vhd b/vhdl_2019/tb_071a.vhd index b008a6a7..0156bcca 100644 --- a/vhdl_2019/tb_071a.vhd +++ b/vhdl_2019/tb_071a.vhd @@ -13,7 +13,7 @@ library vunit_lib; context vunit_lib.vunit_context; entity tb_extra_optional_semicolon_on_interface_list is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_extra_optional_semicolon_on_interface_list is diff --git a/vhdl_2019/tb_072b.vhd b/vhdl_2019/tb_072b.vhd index 812f8344..21ff7471 100644 --- a/vhdl_2019/tb_072b.vhd +++ b/vhdl_2019/tb_072b.vhd @@ -34,7 +34,7 @@ context vunit_lib.vunit_context; use work.pack072b.all ; entity tb_function_knows_return_vector_size is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_function_knows_return_vector_size is diff --git a/vhdl_2019/tb_075.vhd b/vhdl_2019/tb_075.vhd index b451663b..827f0810 100644 --- a/vhdl_2019/tb_075.vhd +++ b/vhdl_2019/tb_075.vhd @@ -51,7 +51,7 @@ library vunit_lib; context vunit_lib.vunit_context; entity tb_closely_related_record_types is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_closely_related_record_types is diff --git a/vhdl_2019/tb_082.vhd b/vhdl_2019/tb_082.vhd index bfceaa48..748642ba 100644 --- a/vhdl_2019/tb_082.vhd +++ b/vhdl_2019/tb_082.vhd @@ -16,7 +16,7 @@ context vunit_lib.vunit_context; use work.pack082.all ; entity tb_empty_record is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_empty_record is diff --git a/vhdl_2019/tb_086.vhd b/vhdl_2019/tb_086.vhd index c9ad150a..ffe0cb13 100644 --- a/vhdl_2019/tb_086.vhd +++ b/vhdl_2019/tb_086.vhd @@ -13,7 +13,7 @@ library vunit_lib; context vunit_lib.vunit_context; entity tb_all_interface_lists_can_be_ordered is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_all_interface_lists_can_be_ordered is diff --git a/vhdl_2019/tb_094a.vhd b/vhdl_2019/tb_094a.vhd index 6b83a551..4fd9644d 100644 --- a/vhdl_2019/tb_094a.vhd +++ b/vhdl_2019/tb_094a.vhd @@ -23,7 +23,7 @@ context vunit_lib.vunit_context; use work.pack094a.all ; entity tb_conditional_return_statement is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_conditional_return_statement is diff --git a/vhdl_2019/tb_099.vhd b/vhdl_2019/tb_099.vhd index 80782711..743f4df5 100644 --- a/vhdl_2019/tb_099.vhd +++ b/vhdl_2019/tb_099.vhd @@ -36,7 +36,7 @@ library vunit_lib; context vunit_lib.vunit_context; entity tb_extended_ranges is - generic ( runner_cfg : string ); + generic ( runner_cfg : string := runner_cfg_default); end entity; architecture tb of tb_extended_ranges is diff --git a/vunit_mock/check_equal_pkg.vhd b/vunit_mock/check_equal_pkg.vhd new file mode 100644 index 00000000..014710f8 --- /dev/null +++ b/vunit_mock/check_equal_pkg.vhd @@ -0,0 +1,205 @@ +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; +use ieee.numeric_std_unsigned.all; + +package check_equal_pkg is + procedure check_equal( + constant got : in unsigned; + constant expected : in unsigned; + constant msg : in string := ""); + + procedure check_equal( + constant got : in unsigned; + constant expected : in natural; + constant msg : in string := ""); + + procedure check_equal( + constant got : in natural; + constant expected : in unsigned; + constant msg : in string := ""); + + procedure check_equal( + constant got : in std_logic_vector; + constant expected : in std_logic_vector; + constant msg : in string := ""); + + procedure check_equal( + constant got : in std_logic_vector; + constant expected : in natural; + constant msg : in string := ""); + + procedure check_equal( + constant got : in natural; + constant expected : in std_logic_vector; + constant msg : in string := ""); + + procedure check_equal( + constant got : in signed; + constant expected : in signed; + constant msg : in string := ""); + + procedure check_equal( + constant got : in signed; + constant expected : in integer; + constant msg : in string := ""); + + procedure check_equal( + constant got : in integer; + constant expected : in signed; + constant msg : in string := ""); + + procedure check_equal( + constant got : in integer; + constant expected : in integer; + constant msg : in string := ""); + + procedure check_equal( + constant got : in std_logic; + constant expected : in std_logic; + constant msg : in string := ""); + + procedure check_equal( + constant got : in boolean; + constant expected : in boolean; + constant msg : in string := ""); + + procedure check_equal( + constant got : in string; + constant expected : in string; + constant msg : in string := ""); + + procedure check_equal( + constant got : in character; + constant expected : in character; + constant msg : in string := ""); + + procedure check_equal( + constant got : in time; + constant expected : in time; + constant msg : in string := ""); + +end package; + +package body check_equal_pkg is + procedure check_equal( + constant got : in unsigned; + constant expected : in unsigned; + constant msg : in string := "") is + begin + assert got = expected report msg; + end; + + procedure check_equal( + constant got : in unsigned; + constant expected : in natural; + constant msg : in string := "") is + begin + assert got = expected report msg; + end; + + procedure check_equal( + constant got : in natural; + constant expected : in unsigned; + constant msg : in string := "") is + begin + assert got = expected report msg; + end; + + procedure check_equal( + constant got : in std_logic_vector; + constant expected : in std_logic_vector; + constant msg : in string := "") is + begin + assert got = expected report msg; + end; + + procedure check_equal( + constant got : in std_logic_vector; + constant expected : in natural; + constant msg : in string := "") is + begin + assert got = expected report msg; + end; + + procedure check_equal( + constant got : in natural; + constant expected : in std_logic_vector; + constant msg : in string := "") is + begin + assert got = expected report msg; + end; + + procedure check_equal( + constant got : in signed; + constant expected : in signed; + constant msg : in string := "") is + begin + assert got = expected report msg; + end; + + procedure check_equal( + constant got : in signed; + constant expected : in integer; + constant msg : in string := "") is + begin + assert got = expected report msg; + end; + + procedure check_equal( + constant got : in integer; + constant expected : in signed; + constant msg : in string := "") is + begin + assert got = expected report msg; + end; + + procedure check_equal( + constant got : in integer; + constant expected : in integer; + constant msg : in string := "") is + begin + assert got = expected report msg; + end; + + procedure check_equal( + constant got : in std_logic; + constant expected : in std_logic; + constant msg : in string := "") is + begin + assert got = expected report msg; + end; + + procedure check_equal( + constant got : in boolean; + constant expected : in boolean; + constant msg : in string := "") is + begin + assert got = expected report msg; + end; + + procedure check_equal( + constant got : in string; + constant expected : in string; + constant msg : in string := "") is + begin + assert got = expected report msg; + end; + + procedure check_equal( + constant got : in character; + constant expected : in character; + constant msg : in string := "") is + begin + assert got = expected report msg; + end; + + procedure check_equal( + constant got : in time; + constant expected : in time; + constant msg : in string := "") is + begin + assert got = expected report msg; + end; + +end package body; diff --git a/vunit_mock/generate_check_equal_mocks.py b/vunit_mock/generate_check_equal_mocks.py new file mode 100644 index 00000000..ef77042c --- /dev/null +++ b/vunit_mock/generate_check_equal_mocks.py @@ -0,0 +1,129 @@ +from pathlib import Path +from string import Template + +api_template = """ procedure check_equal( + constant got : in $got_type; + constant expected : in $expected_type; + constant msg : in string := ""); + +""" + +impl_template = """ procedure check_equal( + constant got : in $got_type; + constant expected : in $expected_type; + constant msg : in string := "") is + begin + assert got = expected report msg; + end; + +""" + +combinations = [ + ( + "unsigned", + "unsigned", + ), + ( + "unsigned", + "natural", + ), + ( + "natural", + "unsigned", + ), + ( + "std_logic_vector", + "std_logic_vector", + ), + ( + "std_logic_vector", + "natural", + ), + ( + "natural", + "std_logic_vector", + ), + ( + "signed", + "signed", + ), + ( + "signed", + "integer", + ), + ( + "integer", + "signed", + ), + ( + "integer", + "integer", + ), + ( + "std_logic", + "std_logic", + ), + ( + "boolean", + "boolean", + ), + ( + "string", + "string", + ), + ( + "character", + "character", + ), + ( + "time", + "time", + ), +] + + +def generate_api(): + api = "" + for c in combinations: + t = Template(api_template) + api += t.substitute(got_type=c[0], expected_type=c[1]) + return api + + +def generate_impl(): + impl = "" + for c in combinations: + t = Template(impl_template) + impl += t.substitute(got_type=c[0], expected_type=c[1]) + return impl + + +def generate_package(): + package = """\ +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; +use ieee.numeric_std_unsigned.all; + +package check_equal_pkg is +""" + package += generate_api() + package += """\ +end package; + +package body check_equal_pkg is +""" + package += generate_impl() + package += """\ +end package body; +""" + return package + + +def main(): + check_equal_pkg = Path(__file__).parent / "check_equal_pkg.vhd" + check_equal_pkg.write_text(generate_package()) + + +if __name__ == "__main__": + main() diff --git a/vunit_mock/mock_context.vhd b/vunit_mock/mock_context.vhd new file mode 100644 index 00000000..e1293a57 --- /dev/null +++ b/vunit_mock/mock_context.vhd @@ -0,0 +1,5 @@ +context vunit_context is + library vunit_lib; + use vunit_lib.mock_pkg.all; + use vunit_lib.check_equal_pkg.all; +end context; diff --git a/vunit_mock/mock_pkg.vhd b/vunit_mock/mock_pkg.vhd new file mode 100644 index 00000000..4a68d92b --- /dev/null +++ b/vunit_mock/mock_pkg.vhd @@ -0,0 +1,238 @@ +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +package mock_pkg is + signal runner : std_logic; + subtype runner_cfg_t is string; + constant runner_cfg_default : string := ""; + + procedure test_runner_setup( + signal runner : inout std_logic; + constant runner_cfg : in string); + + impure function test_suite return boolean; + + impure function run(constant name : string) return boolean; + + procedure test_runner_cleanup( + signal runner : inout std_logic; + external_failure : boolean := false; + allow_disabled_errors : boolean := false; + allow_disabled_failures : boolean := false; + fail_on_warning : boolean := false); + + procedure test_runner_watchdog( + signal runner : inout std_logic; + constant timeout : in time; + constant do_runner_cleanup : boolean := true); + + procedure check( + constant expr : in boolean; + constant msg : in string := ""); + alias check_true is check[boolean, string]; + + procedure check_false( + constant expr : in boolean; + constant msg : in string := ""); + + procedure check_passed(constant msg : in string := ""); + procedure check_failed(constant msg : in string := ""); + + procedure check_equal( + constant got : in unsigned; + constant expected : in std_logic_vector; + constant msg : in string := ""); + + procedure check_equal( + constant got : in std_logic_vector; + constant expected : in unsigned; + constant msg : in string := ""); + + procedure check_equal( + constant got : in std_logic; + constant expected : in boolean; + constant msg : in string := ""); + + procedure check_equal( + constant got : in boolean; + constant expected : in std_logic; + constant msg : in string := ""); + + procedure info(constant msg : in string); + + function result(msg : string) return string; + + type mock_state_t is protected + procedure completed_test_case(name : string); + impure function has_completed(name : string) return boolean; + procedure set_test_suite_done(value : boolean); + impure function get_test_suite_done return boolean; + end protected; + +end package; + +package body mock_pkg is + type mock_state_t is protected body + variable signatures : integer_vector(0 to 100); + variable n_signatures : natural := 0; + variable test_suite_done : boolean := false; + + procedure set_test_suite_done(value : boolean) is + begin + test_suite_done := value; + end; + + impure function get_test_suite_done return boolean is + begin + return test_suite_done; + end; + + -- DJB2 hash + impure function hash ( + str : string + ) return natural is + variable value : natural := 5381; + begin + for i in str'range loop + value := (33*value + character'pos(str(i))) mod 2**(31-6); + end loop; + return value; + end; + + procedure completed_test_case(name : string) is + begin + signatures(n_signatures) := hash(name); + n_signatures := n_signatures + 1; + end; + + impure function has_completed(name : string) return boolean is + constant name_hash : natural := hash(name); + begin + for idx in 0 to n_signatures - 1 loop + if signatures(idx) = name_hash then + return true; + end if; + end loop; + + return false; + end; + end protected body; + + shared variable mock_state : mock_state_t; + + procedure test_runner_setup( + signal runner : inout std_logic; + constant runner_cfg : in string) is + begin + report "You're using a mock of VUnit that does not represent true VUnit behavior." severity warning; + end; + + impure function test_suite return boolean is + begin + if mock_state.get_test_suite_done then + return false; + end if; + + mock_state.set_test_suite_done(true); + return true; + end; + + impure function run(constant name : string) return boolean is + begin + if mock_state.has_completed(name) then + return false; + end if; + + report "Running test case: " & name; + mock_state.completed_test_case(name); + mock_state.set_test_suite_done(false); + return true; + end; + + procedure test_runner_cleanup( + signal runner : inout std_logic; + external_failure : boolean := false; + allow_disabled_errors : boolean := false; + allow_disabled_failures : boolean := false; + fail_on_warning : boolean := false) is + begin + report "Simulation ended. Inspect the log for any errors."; + std.env.stop(0); + end; + + procedure test_runner_watchdog( + signal runner : inout std_logic; + constant timeout : in time; + constant do_runner_cleanup : boolean := true) is + begin + wait; + end; + + procedure check( + constant expr : in boolean; + constant msg : in string := "") is + begin + assert expr report msg; + end; + + procedure check_false( + constant expr : in boolean; + constant msg : in string := "") is + begin + assert not expr report msg; + end; + + procedure check_passed(constant msg : in string := "") is + begin + end; + + procedure check_failed(constant msg : in string := "") is + begin + assert false report msg; + end; + + procedure check_equal( + constant got : in unsigned; + constant expected : in std_logic_vector; + constant msg : in string := "") is + begin + assert std_logic_vector(got) = expected report msg; + end; + + procedure check_equal( + constant got : in std_logic_vector; + constant expected : in unsigned; + constant msg : in string := "") is + begin + assert got = std_logic_vector(expected) report msg; + end; + + procedure check_equal( + constant got : in std_logic; + constant expected : in boolean; + constant msg : in string := "") is + begin + assert (got = '1') = expected report msg; + end; + + procedure check_equal( + constant got : in boolean; + constant expected : in std_logic; + constant msg : in string := "") is + begin + assert got = (expected = '1') report msg; + end; + + procedure info(constant msg : in string) is + begin + report msg; + end; + + function result(msg : string) return string is + begin + return msg; + end; + + +end package body; \ No newline at end of file