@@ -21,16 +21,19 @@ entity strobe_tb is
21
21
end entity ;
22
22
23
23
architecture tb of strobe_tb is
24
- constant TB_TICKS : positive := 10 ;
24
+ constant CLK_PER : time := 8 ns ;
25
+ constant TB_TICKS : positive := 10 ;
25
26
begin
26
27
27
28
th : entity work .strobe_th
28
29
generic map (
29
- TICKS => TB_TICKS
30
+ CLK_PER => CLK_PER,
31
+ TICKS => TB_TICKS
30
32
);
31
33
32
34
bench : process
33
35
alias reset is << signal th.reset : std_logic >> ;
36
+ alias enable is << signal th.dut_enable : std_logic >> ;
34
37
alias strobe is << signal th.dut_strobe : std_logic >> ;
35
38
begin
36
39
-- Always the first thing in the process, set up things for the VUnit test runner
@@ -41,11 +44,18 @@ begin
41
44
42
45
while test_suite loop
43
46
if run(" test_strobe" ) then
47
+ enable <= '1' ;
44
48
check_equal(strobe, '0' , " Strobe should be low after reset" );
45
- wait for 72 ns ; -- CLK_PER_NS * (TB_TICKS - 1) ns
49
+ wait for CLK_PER * (TB_TICKS - 1 );
46
50
check_equal(strobe, '0' , " Strobe should be low after TB_TICKS-1" );
47
- wait for 8 ns ; -- wait one more period, bringing us to TB_TICKs
51
+ wait for CLK_PER;
48
52
check_equal(strobe, '1' , " Strobe should be high once the TICKS count is reached" );
53
+ elsif run(" test_strobe_enable" ) then
54
+ wait for CLK_PER * TB_TICKS;
55
+ check_equal(strobe, '0' , " Strobe should be low after TB_TICKS when not enabled" );
56
+ enable <= '1' ;
57
+ wait for CLK_PER * TB_TICKS;
58
+ check_equal(strobe, '1' , " Strobe should be high after TICKs when enabled" );
49
59
end if ;
50
60
end loop ;
51
61
0 commit comments