Simulation Time and task questions in Verilog

G

Giuseppe Marullo

Guest
Hi,
I would like to know if there is a way for a testbench to know how much
time is taking the simulation, I mean the time it takes to complete the
testbench.

Another question, is it possible within a task to know if another task
is running or not, and is it possible to "kill" a task within another task?

Thanks in advance.

Giuseppe Marullo
 
Mark,
thanks for your answer.

What do you mean by time? Simulation time? Use the $realtime
system function.
No, I mean the time it takes to run the simulation.

I am using two laptops, one is "slow" and the other is fast(X7200).

I would like to have a variable that would return me the
"elapsed/real/whatever" time it is taking.

I would expect one will finish much sooner than the other. I want that
time, possibly within the testbench.


in the verilog scheduler. This is expert territory. Back up and tell
us what you're trying to do more generally.
I was testing a UART, so I implemented a FSM to send stuff, and a FSM to
receive stuff.

Then I created a FSM that would send a fixed amount of chars, and would
wait for the DUT to answer using the other two FSM to tx and rx.

I implemented all using 3 tasks, but when I am done with the sending of
the chars, I would like the 3rd task to end the simulation.
It does not work, and I am wondering how to implement it without
additional signals, $finish for some reason does not work in this case.
Are there any function that will tell me if a specific task is running,
and possibly a function that would allow me to kiil it?

Giuseppe Marullo
 
In article <jp2uap$9i7$1@speranza.aioe.org>,
Giuseppe Marullo <giuseppe.marullonospam@iname.com> wrote:
Hi,
I would like to know if there is a way for a testbench to know how much
time is taking the simulation, I mean the time it takes to complete the
testbench.
What do you mean by time? Simulation time? Use the $realtime
system function.

Another question, is it possible within a task to know if another task
is running or not, and is it possible to "kill" a task within another task?
This is a more complicated question than I think you realize. And it's
probably not what you want to do - or there's probably better ways of
doing what you want. There's all sorts of details/controls/pitfalls
in the verilog scheduler. This is expert territory. Back up and tell
us what you're trying to do more generally.

--Mark
 
In article <jp39jp$b0b$1@speranza.aioe.org>,
Giuseppe Marullo <giuseppe.marullonospam@iname.com> wrote:
Mark,
thanks for your answer.

What do you mean by time? Simulation time? Use the $realtime
system function.
No, I mean the time it takes to run the simulation.

I am using two laptops, one is "slow" and the other is fast(X7200).

I would like to have a variable that would return me the
"elapsed/real/whatever" time it is taking.

I would expect one will finish much sooner than the other. I want that
time, possibly within the testbench.
There's nothing in verilog reporting any form of "walltime" - only simtime.
Some simulators may have profiling options.
Think modelsim does, but not sure.

Me, I'd just use a linux shell 'time' command:
% time run_sim.sh
14.161u 0.111s 0:17.45 81.7% 0+0k 0+2976io 0pf+0w

in the verilog scheduler. This is expert territory. Back up and tell
us what you're trying to do more generally.
I was testing a UART, so I implemented a FSM to send stuff, and a FSM to
receive stuff.

Then I created a FSM that would send a fixed amount of chars, and would
wait for the DUT to answer using the other two FSM to tx and rx.

I implemented all using 3 tasks, but when I am done with the sending of
the chars, I would like the 3rd task to end the simulation.
It does not work, and I am wondering how to implement it without
additional signals, $finish for some reason does not work in this case.
Are there any function that will tell me if a specific task is running,
and possibly a function that would allow me to kiil it?
These task aren't 'running' like you think they are.

There's no reason $finish shouldn't work. I'd guess you're
not actually doing a $finish; i.e. something's preventing
whatever procedural block from getting to the $finish statement.

Or you have a zero-time infinite loop somewhere else (in the same,
or different procedural block ) - not allowing the scheduler to
run anything else (i.e. the $finish statement).

Either case there's no magic "fix". If there was a "kill task"
command, it, like the $finish, wouldn't run for the same reasons.
You'll need to go in a debug. Try the single-step/breakpoint/stop
functions in your simulator.

--Mark
 

Welcome to EDABoard.com

Sponsor

Back
Top