Skip to content

Commit

Permalink
WIP: Blog
Browse files Browse the repository at this point in the history
  • Loading branch information
LarsAsplund committed Mar 15, 2022
1 parent 35e8438 commit 6d0c9b1
Show file tree
Hide file tree
Showing 8 changed files with 510 additions and 29 deletions.
429 changes: 429 additions & 0 deletions docs/blog/vhdl_configurations.rst

Large diffs are not rendered by default.

20 changes: 0 additions & 20 deletions examples/vhdl/vhdl_configuration/dff.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,6 @@ begin
end process;
end;

configuration dff_rtl of tb_selecting_dut_with_vhdl_configuration is
for tb
for test_fixture
for dut : dff
use entity work.dff(rtl);
end for;
end for;
end for;
end;

architecture behavioral of dff is
begin
process
Expand All @@ -50,13 +40,3 @@ begin
q <= (others => '0') when reset else d;
end process;
end;

configuration dff_behavioral of tb_selecting_dut_with_vhdl_configuration is
for tb
for test_fixture
for dut : dff
use entity work.dff(behavioral);
end for;
end for;
end for;
end;
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ entity tb_selecting_dut_with_generate_statement is
generic(
runner_cfg : string;
width : positive;
dff_arch : string
dut_arch : string
);
end entity;

Expand Down Expand Up @@ -64,7 +64,7 @@ begin
begin
clk <= not clk after clk_period / 2;

dut_selection : if dff_arch = "rtl" generate
dut_selection : if dut_arch = "rtl" generate
dut : entity work.dff(rtl)
generic map(
width => width
Expand All @@ -76,7 +76,7 @@ begin
q => q
);

elsif dff_arch = "behavioral" generate
elsif dut_arch = "behavioral" generate
dut : entity work.dff(behavioral)
generic map(
width => width
Expand All @@ -89,7 +89,7 @@ begin
);

else generate
error("Unknown DFF architecture");
error("Unknown DUT architecture");
end generate;
end block;
end architecture;
2 changes: 1 addition & 1 deletion examples/vhdl/vhdl_configuration/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def hook(output_path):
tb = lib.test_bench("tb_selecting_dut_with_generate_statement")
for width in [8, 32]:
for arch in ["rtl", "behavioral"]:
tb.add_config(name=f"dff_{arch}_width={width}", generics=dict(dff_arch=arch, width=width))
tb.add_config(name=f"dut_{arch}_width={width}", generics=dict(dut_arch=arch, width=width))

# Instead of having a testbench containing a shared test fixture
# and then use VHDL configurations to select different test runners implementing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ begin
begin
clk <= not clk after clk_period / 2;

dut : dff
dut : component dff
generic map(
width => width
)
Expand All @@ -90,3 +90,23 @@ begin
);
end block;
end architecture;

configuration rtl of tb_selecting_dut_with_vhdl_configuration is
for tb
for test_fixture
for dut : dff
use entity work.dff(rtl);
end for;
end for;
end for;
end;

configuration behavioral of tb_selecting_dut_with_vhdl_configuration is
for tb
for test_fixture
for dut : dff
use entity work.dff(behavioral);
end for;
end for;
end for;
end;
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@ architecture tb of tb_selecting_test_runner_with_vhdl_configuration is
);
end component;

component dff is
generic(
width : positive := width
);
port(
clk : in std_logic;
reset : in std_logic;
d : in std_logic_vector(width - 1 downto 0);
q : out std_logic_vector(width - 1 downto 0)
);
end component;

begin
test_runner_inst : test_runner
generic map(
Expand All @@ -64,7 +76,7 @@ begin
begin
clk <= not clk after clk_period / 2;

dut : entity work.dff(rtl)
dut : component dff
generic map(
width => width
)
Expand Down
22 changes: 21 additions & 1 deletion examples/vhdl/vhdl_configuration/test_reset.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,30 @@ begin
test_runner_watchdog(runner, 10 * clk_period);
end;

configuration test_reset of tb_selecting_test_runner_with_vhdl_configuration is
configuration test_reset_behavioral of tb_selecting_test_runner_with_vhdl_configuration is
for tb
for test_runner_inst : test_runner
use entity work.test_runner(test_reset_a);
end for;

for test_fixture
for dut : dff
use entity work.dff(behavioral);
end for;
end for;
end for;
end;

configuration test_reset_rtl of tb_selecting_test_runner_with_vhdl_configuration is
for tb
for test_runner_inst : test_runner
use entity work.test_runner(test_reset_a);
end for;

for test_fixture
for dut : dff
use entity work.dff(rtl);
end for;
end for;
end for;
end;
22 changes: 21 additions & 1 deletion examples/vhdl/vhdl_configuration/test_state_change.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,30 @@ begin
test_runner_watchdog(runner, 10 * clk_period);
end;

configuration test_state_change of tb_selecting_test_runner_with_vhdl_configuration is
configuration test_state_change_behavioral of tb_selecting_test_runner_with_vhdl_configuration is
for tb
for test_runner_inst : test_runner
use entity work.test_runner(test_state_change_a);
end for;

for test_fixture
for dut : dff
use entity work.dff(behavioral);
end for;
end for;
end for;
end;

configuration test_state_change_rtl of tb_selecting_test_runner_with_vhdl_configuration is
for tb
for test_runner_inst : test_runner
use entity work.test_runner(test_state_change_a);
end for;

for test_fixture
for dut : dff
use entity work.dff(rtl);
end for;
end for;
end for;
end;

0 comments on commit 6d0c9b1

Please sign in to comment.