EDAboard.com | EDAboard.eu | EDAboard.de | EDAboard.co.uk | RTV forum PL | NewsGroups PL

Verilog fork-join

elektroda.net NewsGroups Forum Index - Verilog Language - Verilog fork-join

Melvin
Guest

Mon Jun 14, 2010 1:16 pm   



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:
Quote:
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

Cary R.
Guest

Mon Jun 14, 2010 4:20 pm   



Melvin wrote:
Quote:
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

David Rogoff
Guest

Mon Jun 14, 2010 8:15 pm   



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

Quote:
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.

Melvin
Guest

Tue Jun 15, 2010 11:35 am   



On Jun 14, 8:20 pm, "Cary R." <no-s...@host.spam> wrote:
Quote:
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

Cary R.
Guest

Wed Jun 16, 2010 6:02 pm   



David Rogoff wrote:

Quote:
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

elektroda.net NewsGroups Forum Index - Verilog Language - Verilog fork-join

Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
RTV map EDAboard.com map News map EDAboard.eu map EDAboard.de map EDAboard.co.uk map Opony