Problem with assignment Schedule in Modelsim?

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;
 
C

Colin Paul Gloster

In timestamped Fri, 10 Aug 2007 08:24:44 -0700,
Tricky <[email protected]> posted:
|-------------------------------------------------------------------------------|
|"[..] |
| |
|-------------------------------------------------------------------------------|
|----------------- |
| --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 warn|
|ing; |
| 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?" |
|-------------------------------------------------------------------------------|

I could be mistaken, but I believe that KILLSIM <= KILLSIM; should
have the effect you tried to achieve with it.

|-------------------------------------------------------------------------------|
|"The same thing" |
|-------------------------------------------------------------------------------|

The same thing as what?

Regards,
Colin Paul Gloster

|-------------------------------------------------------------------------------|
|" happens if I assign |
|KILLSIM <= false; |
| |
|if not KILLSIM then KILLSIM <= false; end if;" |
|-------------------------------------------------------------------------------|
 
T

Tricky

I could be mistaken, but I believe that KILLSIM <= KILLSIM; should
have the effect you tried to achieve with it.

Thats what I thought, but Modelsim seems to be changing the assignment
value (ie, its now always false) but not removing the schedule, so it
just continues running until the given timeout. I guess I just found a
quirk with this version of modelsim.
|-------------------------------------------------------------------------------|
|"The same thing" |
|-------------------------------------------------------------------------------|

The same thing as what?

Assigning it to false instead of itself did the same thing as I stated
in the first place - the simulator didnt stop, but KILLSIM held the
false value.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top