-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathtb_tb_vu_bus_accumulator.vhd
62 lines (53 loc) · 1.48 KB
/
tb_tb_vu_bus_accumulator.vhd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
LIBRARY IEEE, common_pkg_lib, vunit_lib;
USE IEEE.std_logic_1164.ALL;
USE IEEE.numeric_std.ALL;
USE common_pkg_lib.common_pkg.ALL;
context vunit_lib.vunit_context;
ENTITY tb_tb_vu_bus_accumulator IS
GENERIC(
g_bus_constituent_widths : t_nat_natural_arr := (6, 4, 8);
g_bus_constituent_expansion_widths : t_nat_natural_arr := (8, 8, 8);
g_accumulations_to_test : natural := 10;
runner_cfg : string
);
END tb_tb_vu_bus_accumulator;
ARCHITECTURE tb OF tb_tb_vu_bus_accumulator IS
SIGNAL rst : STD_LOGIC;
SIGNAL clk : STD_LOGIC;
SIGNAL tb_end : STD_LOGIC;
SIGNAL test_msg : STRING(1 to 80);
SIGNAL test_pass : BOOLEAN;
SIGNAL s_test_count : natural := 0;
BEGIN
tb_ut : ENTITY work.tb_bus_accumulator
GENERIC MAP(
g_bus_constituent_widths => g_bus_constituent_widths,
g_bus_constituent_expansion_widths=> g_bus_constituent_expansion_widths,
g_accumulations_to_test => g_accumulations_to_test
)
PORT MAP(
o_clk => clk,
o_tb_end => tb_end,
o_test_msg => test_msg,
o_test_pass => test_pass
);
p_vunit : PROCESS
BEGIN
test_runner_setup(runner, runner_cfg);
wait until tb_end = '1';
test_runner_cleanup(runner);
wait;
END PROCESS;
p_verify : PROCESS(rst, clk)
BEGIN
IF rst = '0' THEN
IF rising_edge(clk) THEN
check(test_pass, "Test Failed: " & test_msg);
IF tb_end THEN
report "Tests completed: " & integer'image(s_test_count+1);
END IF;
s_test_count <= 1;
END IF;
END IF;
END PROCESS;
END tb;