T
Tricky
Ive used the following code in my testbench.
KILLSIM is a boolean used as a timeout incase the testbench isnt
working (and therefore wont run foreever). This should always be set
so that it can only go true after all input and output has completed
(effectively ending the testbench)
ENDSIM is set when all input and output has finished (from whatever
stimulus).
------------------------------------------------------------------------------------------------
--clk_proc : process to generate the clock
------------------------------------------------------------------------------------------------
clk_proc : process
begin
KILLSIM <= false, true after TIMEOUT*CLK_PERIOD;
while not ENDSIM loop
if clk /= '0' then
clk <= '0';
else
clk <= '1';
end if;
wait for CLK_PERIOD/2;
end loop;
--remove KILLSIM assignment schedule
KILLSIM <= KILLSIM;
--give 1 more clock cycle
clk <= not clk;
wait for CLK_PERIOD/2;
clk <= not clk;
if KILLSIM then
report "Simulation ended after KILLSIM timeout" severity warning;
end if;
wait;
end process;
reset <= '1', '0' after RESET_PERIOD*CLK_PERIOD;
ENDSIM <= (endsim_ip and endsim_op) or KILLSIM;
When running a testbench in modelsim using this code, ENDSIM occurs
correctly after all stimulus and expected results are finished, but
the simulation still runs until timout. If I remove the line:
KILLSIM <= false, true after TIMEOUT*CLK_PERIOD;
then the simulation ends as expected.
Im sure Ive used this code in ActiveHDL before and IIRC it ran
correctly. Is there any reason why KILLSIM <= KILLSIM is not removing
the previous assignment scheduled?
The same thing happens if I assign
KILLSIM <= false;
if not KILLSIM then KILLSIM <= false; end if;
KILLSIM is a boolean used as a timeout incase the testbench isnt
working (and therefore wont run foreever). This should always be set
so that it can only go true after all input and output has completed
(effectively ending the testbench)
ENDSIM is set when all input and output has finished (from whatever
stimulus).
------------------------------------------------------------------------------------------------
--clk_proc : process to generate the clock
------------------------------------------------------------------------------------------------
clk_proc : process
begin
KILLSIM <= false, true after TIMEOUT*CLK_PERIOD;
while not ENDSIM loop
if clk /= '0' then
clk <= '0';
else
clk <= '1';
end if;
wait for CLK_PERIOD/2;
end loop;
--remove KILLSIM assignment schedule
KILLSIM <= KILLSIM;
--give 1 more clock cycle
clk <= not clk;
wait for CLK_PERIOD/2;
clk <= not clk;
if KILLSIM then
report "Simulation ended after KILLSIM timeout" severity warning;
end if;
wait;
end process;
reset <= '1', '0' after RESET_PERIOD*CLK_PERIOD;
ENDSIM <= (endsim_ip and endsim_op) or KILLSIM;
When running a testbench in modelsim using this code, ENDSIM occurs
correctly after all stimulus and expected results are finished, but
the simulation still runs until timout. If I remove the line:
KILLSIM <= false, true after TIMEOUT*CLK_PERIOD;
then the simulation ends as expected.
Im sure Ive used this code in ActiveHDL before and IIRC it ran
correctly. Is there any reason why KILLSIM <= KILLSIM is not removing
the previous assignment scheduled?
The same thing happens if I assign
KILLSIM <= false;
if not KILLSIM then KILLSIM <= false; end if;