Hello Suraj,
See my comments below.
Suraj Kurapati wrote:
On 8/7/07, Suraj N. Kurapati <[EMAIL PROTECTED]> wrote:
Also, there is something to be said about the concurrency model.
During each time step, all threads are executed until they either
(1) finish executing and exit normally or (2) invoke the "wait" or
"advance_time" method -- which causes them to be re-executed at a
future time step.
There is one downside to this implementation:
Since the scheduler waits for *all* threads to either (1) terminate or
(2) invoke the "wait" or "advance_time" method, we cannot have
non-verification-related threads running in the background. For
example, if you wanted to create a watchdog timer thread that stops
the simulation after a certain amount of time has passed, it would not
be possible because the scheduler will wait for the watchdog timer
before proceeding to the next time step.
Yes ... I am currently encountering this.
I created two clocks and am driving the clocks in verilog.
I created two threads and had each of them wait for a posedge
of their particular clock and print out the simulation time.
t1 = Thread.new do
5.times do |i|
wait until Test.clk0.posedge?
puts "@#{simuilation_time} clk0 seen"
end
end
t2 = Thread.new do
5.times do |i|
wait until Test.clk1.posedge?
puts "@#{simulation_time} clk1 seen"
end
end
t1.join
t2.join
Adding the t1.join and the t2.join causes the simulation to lock up.
If I remove t1 and t2, then the simulation proceeds but in a single
thread fashion. Meaning ... t1 runs first, with a lot of delay in between,
then t2 runs.
This brings up the need for excluding certain threads from the
scheduler's control. So I'm thinking of having a "process" method
(inspired by the "process" statement from VHDL) that creates a thread
which the scheduler will monitor. Threads created through other means
will not be monitored by the scheduler.
Since I'm not too experienced with Verilog, I want to ask you: is
there a better Verilog-related name for the creation of a
verification-related thread than "process"? How would you like to
name this method?
I want to stay away from the word "initial" because it doesn't really
suit the creation of a verification-related thread. However, I plan
to add an "always" method which simply injects an infinite loop around
the "process" method:
always do
...
end
is the same as:
process do
loop do
...
end
end
Thanks for your consideration.
In my previous projects, we have a C++ verification based environment and
we used the following terminology for running many processes in parallel.
c_fork
// Process A
c_fork_begin
for (i=0;i<10;i++) atPosedge("top.clk0");
c_fork_end
// Process B
c_fork_begin
for (i=0;i<10;i++) atPosedge("top.clk1");
c_fork_end
c_join_all // could also be c_join_any or c_join_none
c_join_all indicates that all processes needs to be completed
prior to exiting the fork block. c_join_any needs only one process
to complete prior to exiting, and c_join_none immediately
exits the block and allows them to run in the background.
Calvin