@@ -23,7 +23,7 @@ A (close to) minimal VUnit testbench looks like this
2323 context vunit_lib.vunit_context;
2424
2525 entity tb_minimal is
26- generic (runner_cfg : string := runner_cfg_default );
26+ generic (runner_cfg : string);
2727 end entity;
2828
2929 architecture tb of tb_minimal is
@@ -40,8 +40,7 @@ It has the following important properties
4040
4141- The VUnit functionality is located in the ``vunit_lib `` library and is included with the library and context
4242 statements in the first two lines.
43- - The ``runner_cfg `` generic is used to control the testbench from PR. If the testbench is used standalone you will
44- need a default value, ``runner_cfg_default ``, for the generic. Note that the generic **must ** be named
43+ - The ``runner_cfg `` generic is used to control the testbench from PR. Note that the generic **must ** be named
4544 ``runner_cfg `` for the testbench to be recognized by PR (there is an exception which we'll get to later).
4645- Every VUnit testbench has a main controlling process. It's labelled ``test_runner `` in this example but the name
4746 is not important. The process starts by setting up VUnit using the ``test_runner_setup `` procedure with
@@ -637,6 +636,43 @@ the ability to read error counters based on assert statements. Failures like div
637636operations are other examples that won't be handle gracefully in this mode and not something that VHDL-2017 will
638637solve.
639638
639+ Testbenches with VHDL Configurations
640+ ------------------------------------
641+
642+ If there are VHDL configurations defined for the testbench entity, each configuration, and not the testbench
643+ entity, defines a top-level for the simulation. VUnit automatically detects these VHDL configurations and treat
644+ them as a special case of the larger testbench configuration concept provided by VUnit, see
645+ :ref: `configurations <configurations >`.
646+
647+ VHDL doesn't allow setting generics when the top-level is a VHDL configuration which prevents the `runner_cfg `
648+ generic to be set by PR. To work around this limitation PR provides a `runner.cfg ` file containing the same
649+ information. This file is read by `test_runner_setup ` whenever its `runner_cfg ` parameter is set to
650+ `null_runner_cfg `. An example is shown below.
651+
652+ .. code-block :: vhdl
653+
654+ library vunit_lib;
655+ context vunit_lib.vunit_context;
656+
657+ entity tb_minimal is
658+ generic (runner_cfg : string := null_runner_cfg);
659+ end entity;
660+
661+ architecture tb of tb_minimal is
662+ begin
663+ test_runner : process
664+ begin
665+ test_runner_setup(runner, runner_cfg);
666+
667+ ...
668+
669+ test_runner_cleanup(runner);
670+ end process;
671+ end architecture;
672+
673+ Note that the `runner_cfg ` generic must remain present since this is the token used by VUnit test scanning
674+ to distinguish testbench entities from other entities.
675+
640676Special Paths
641677-------------
642678
0 commit comments