I am trying to get a ModelSim simulation to stop when a particular event occurs, or after a timeout, whichever comes first.
I have tried a purely software approach, using a while loop and issuing a run 1 ns
command at every iteration and checking if the condition has been met:
set clockCycles 0
set clockCycleLimit 200
while {/some_signal != 1 && $clockCycles < $clockCycleLimit} {
run 1 ns
set clockCycles [expr {$clockCycles + 1}]
}
This works, but is somewhat slow. Therefore, I tried a new approach using a when
command instead.
when {/some_signal == '1'} {
stop
}
run 200 ns
This runs very quickly and is more elegant. The only problem I have with it is that it displays an annoying message in the Transcript window: "Simulation stop requested" every time this code runs.
I am using this code as part of an interactive ModelSim session, and theses messages constantly showing up ruin the user experience. I am trying to find a way to disable them. So far I haven't found anything that works.
Would someone be able to help?
Thanks!