Verilog fork-join

M

Melvin

Guest
Hi,

I have a small query regarding Verilog fork-join statement:

Suppose I have 2 parallel threads;

In 1 thread I am doing some programming
In thread 2: I am waiting for one signal wait (reset) (say, which will
never happen)

I wanted to know how this fork-join will be executed:
Is it like each full line will be executed from each thread (in which case once it encounters 2nd thread it will wait till reset happens indefinitely
OR
Is it like separate CPU time is allotted for each thread in which case once it encounters Thread2, it will come out of that once the allotted time is over for that in which case there wont be infinite loop (atleast till first thread gets over fully)
Pls let me know how it functions

THANKS
Verilog Baby
 
Melvin wrote:
Hi,

I have a small query regarding Verilog fork-join statement:

Suppose I have 2 parallel threads;

In 1 thread I am doing some programming
In thread 2: I am waiting for one signal wait (reset) (say, which will
never happen)

I wanted to know how this fork-join will be executed:
A simple search would have easily found the answer and should be your
first choice, but to be complete fork spawns the parallel threads and
join waits for them all to finish executing. If you want independent
treads then try individual initial/always blocks as appropriate.

Cary
 
On 2010-06-14 08:20:54 -0700, Cary R. said:

Melvin wrote:
Hi,

I have a small query regarding Verilog fork-join statement:

Suppose I have 2 parallel threads;

In 1 thread I am doing some programming
In thread 2: I am waiting for one signal wait (reset) (say, which will
never happen)

I wanted to know how this fork-join will be executed:

A simple search would have easily found the answer and should be your
first choice, but to be complete fork spawns the parallel threads and
join waits for them all to finish executing. If you want independent
treads then try individual initial/always blocks as appropriate.
There's also the new, handy join_any and join_none in SystemVerilog.
 
On Jun 14, 8:20 pm, "Cary R." <no-s...@host.spam> wrote:
Melvin wrote:
Hi,

I have a small query regarding Verilog fork-join statement:

Suppose I have 2 parallel threads;

In 1 thread I am doing some programming
In thread 2: I am waiting for one signal wait (reset) (say, which will
never happen)

I wanted to know how this fork-join will be executed:

A simple search would have easily found the answer and should be your
first choice, but to be complete fork spawns the parallel threads and
join waits for them all to finish executing. If you want independent
treads then try individual initial/always blocks as appropriate.

Cary
Thanks!!!

So that means once it sees the 2nd parallel thread "wait" it would
hang.
Instead can I try the following code?

-----second thread---
while(1) begin
if (reset)
break
else
repeat (5)@(posedge systemclock)
end
--------------------

So that during the repeat time in background, the first thread can be
executed, insted of the "wait" statement which indefinitely holds the
fork-join.

If that is the case, this would mean I cannot use "wait" with fork-
join, right? because if it goes to the wait statement it would stay
there without allowing the first thread which would trigger the wait
signal to execute.

Can you please confirm if what I am assuming [wait cannot be used with
fork-join] is correct?

Thanks
Verilog Baby
 
David Rogoff wrote:

There's also the new, handy join_any and join_none in SystemVerilog.
Thanks for the reminder! I spend so much time focusing on 1364 that I
occasionally forget 1800 is the new Verilog.

Cary
 

Welcome to EDABoard.com

Sponsor

Back
Top