Skip to content

Commit 45eae77

Browse files
committed
feat: Add minimum simulation time warnings to testbenches
1 parent 088f905 commit 45eae77

4 files changed

Lines changed: 28 additions & 4 deletions

File tree

ip/ff_synchroniser/tb/tb_ff_synchroniser.vhd

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ architecture tb of tb_ff_synchroniser is
3535
-------------------------------------------------------------
3636
-- Internal tb signals/constants
3737
-------------------------------------------------------------
38-
constant SIMULATION_TIMEOUT_TIME: time := real'value(SIMULATION_TIMEOUT_IN_MS) * 1 ms;
38+
constant MINIMUM_SIMULATION_TIME_IN_MS: real := 3.7; -- Minimum time needed for synchronizer test
39+
constant REQUESTED_SIMULATION_TIMEOUT_TIME: time := real'value(SIMULATION_TIMEOUT_IN_MS) * 1 ms;
40+
constant SIMULATION_TIMEOUT_TIME: time := maximum(REQUESTED_SIMULATION_TIMEOUT_TIME, MINIMUM_SIMULATION_TIME_IN_MS * 1 ms);
3941
constant ENABLE_DEBUG_PRINT: boolean := false;
4042

4143
constant SOURCE_CLK_FREQUENCY: real := real(100e6);
@@ -77,6 +79,10 @@ begin
7779
test_runner_setup(runner, runner_cfg);
7880
info("Starting tb_ff_synchroniser");
7981

82+
if REQUESTED_SIMULATION_TIMEOUT_TIME < MINIMUM_SIMULATION_TIME_IN_MS * 1 ms then
83+
warning("Simulation timeout (" & SIMULATION_TIMEOUT_IN_MS & " ms) is less than minimum required (" & real'image(MINIMUM_SIMULATION_TIME_IN_MS) & " ms). Using minimum timeout instead.");
84+
end if;
85+
8086
if ENABLE_DEBUG_PRINT then
8187
show(display_handler, debug);
8288
end if;

ip/memories/ram/single_port/tb/tb_single_port_ram.vhd

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ architecture tb of tb_single_port_ram is
3333
-- Internal tb signals/constants
3434
-------------------------------------------------------------
3535
constant PROPAGATION_TIME: time := 1 ns;
36-
constant SIMULATION_TIMEOUT_TIME: time := real'value(SIMULATION_TIMEOUT_IN_MS) * 1 ms;
36+
constant MINIMUM_SIMULATION_TIME_IN_MS: real := 1.2; -- Minimum time needed for all tests
37+
constant REQUESTED_SIMULATION_TIMEOUT_TIME: time := real'value(SIMULATION_TIMEOUT_IN_MS) * 1 ms;
38+
constant SIMULATION_TIMEOUT_TIME: time := maximum(REQUESTED_SIMULATION_TIMEOUT_TIME, MINIMUM_SIMULATION_TIME_IN_MS * 1 ms);
3739
constant ENABLE_DEBUG_PRINT: boolean := false;
3840
constant RANDOM_REPETITIONS: natural := 10;
3941

@@ -75,6 +77,10 @@ begin
7577
test_runner_setup(runner, runner_cfg);
7678
info("Starting tb_single_port_ram");
7779

80+
if REQUESTED_SIMULATION_TIMEOUT_TIME < MINIMUM_SIMULATION_TIME_IN_MS * 1 ms then
81+
warning("Simulation timeout (" & SIMULATION_TIMEOUT_IN_MS & " ms) is less than minimum required (" & real'image(MINIMUM_SIMULATION_TIME_IN_MS) & " ms). Using minimum timeout instead.");
82+
end if;
83+
7884
if ENABLE_DEBUG_PRINT then
7985
show(display_handler, debug);
8086
end if;

ip/memories/rom/tb/tb_rom.vhd

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ architecture tb of tb_rom is
3535
-- Internal tb signals/constants
3636
-------------------------------------------------------------
3737
constant PROPAGATION_TIME: time := 1 ns;
38-
constant SIMULATION_TIMEOUT_TIME: time := real'value(SIMULATION_TIMEOUT_IN_MS) * 1 ms;
38+
constant MINIMUM_SIMULATION_TIME_IN_MS: real := 1.5; -- Minimum time needed for test_full_rom (2^16 iterations)
39+
constant REQUESTED_SIMULATION_TIMEOUT_TIME: time := real'value(SIMULATION_TIMEOUT_IN_MS) * 1 ms;
40+
constant SIMULATION_TIMEOUT_TIME: time := maximum(REQUESTED_SIMULATION_TIMEOUT_TIME, MINIMUM_SIMULATION_TIME_IN_MS * 1 ms);
3941
constant ENABLE_DEBUG_PRINT: boolean := false;
4042

4143
constant SYS_CLK_FREQUENCY: real := real(100e6);
@@ -73,6 +75,10 @@ begin
7375
test_runner_setup(runner, runner_cfg);
7476
info("Starting tb_rom");
7577

78+
if REQUESTED_SIMULATION_TIMEOUT_TIME < MINIMUM_SIMULATION_TIME_IN_MS * 1 ms then
79+
warning("Simulation timeout (" & SIMULATION_TIMEOUT_IN_MS & " ms) is less than minimum required (" & real'image(MINIMUM_SIMULATION_TIME_IN_MS) & " ms). Using minimum timeout instead.");
80+
end if;
81+
7682
if ENABLE_DEBUG_PRINT then
7783
show(display_handler, debug);
7884
end if;

ip/reset_on_startup/tb/tb_reset_on_startup.vhd

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ architecture tb of tb_reset_on_startup is
3131
-------------------------------------------------------------
3232
-- Internal tb signals/constants
3333
-------------------------------------------------------------
34-
constant SIMULATION_TIMEOUT_TIME: time := real'value(SIMULATION_TIMEOUT_IN_MS) * 1 ms;
34+
constant MINIMUM_SIMULATION_TIME_IN_MS: real := 3.0; -- Minimum time needed for reset startup test
35+
constant REQUESTED_SIMULATION_TIMEOUT_TIME: time := real'value(SIMULATION_TIMEOUT_IN_MS) * 1 ms;
36+
constant SIMULATION_TIMEOUT_TIME: time := maximum(REQUESTED_SIMULATION_TIMEOUT_TIME, MINIMUM_SIMULATION_TIME_IN_MS * 1 ms);
3537
constant ENABLE_DEBUG_PRINT: boolean := false;
3638

3739
constant SYS_CLK_FREQUENCY: real := real(100e6);
@@ -73,6 +75,10 @@ begin
7375
test_runner_setup(runner, runner_cfg);
7476
info("Starting tb_lcd_controller");
7577

78+
if REQUESTED_SIMULATION_TIMEOUT_TIME < MINIMUM_SIMULATION_TIME_IN_MS * 1 ms then
79+
warning("Simulation timeout (" & SIMULATION_TIMEOUT_IN_MS & " ms) is less than minimum required (" & real'image(MINIMUM_SIMULATION_TIME_IN_MS) & " ms). Using minimum timeout instead.");
80+
end if;
81+
7682
if ENABLE_DEBUG_PRINT then
7783
show(display_handler, debug);
7884
end if;

0 commit comments

Comments
 (0)