Why use fork...join_none in SystemVerilog?

D

Davy

Guest
Hi all,

I found in most SystemVerilog example, people like to use
fork...join_none pair (not the traditional fork...join pair). Is there
some advantage to fork...join_none pair? Thanks!

Best regards,
Davy
 
Davy,

fork...join_none is non-blocking, so all processes in the
fork...join_none start at the same time as the code following the
fork......join_none and the following code continues on.

the fork...join is blocking so all the processes in the fork....join
must complete before the code following even starts.

this is one of the very powerful features of SV. hence why its used
alot!

Macgyver

Davy wrote:
Hi all,

I found in most SystemVerilog example, people like to use
fork...join_none pair (not the traditional fork...join pair). Is there
some advantage to fork...join_none pair? Thanks!

Best regards,
Davy
 
Hi Macgyver,

Thanks a lot!

And I am curious about the fork...join_any(join the thread when thread
that used least time is finished). I cannot image when
"fork...join_any" is used?

Best regards,
Davy

macgyver wrote:
Davy,

fork...join_none is non-blocking, so all processes in the
fork...join_none start at the same time as the code following the
fork......join_none and the following code continues on.

the fork...join is blocking so all the processes in the fork....join
must complete before the code following even starts.

this is one of the very powerful features of SV. hence why its used
alot!

Macgyver

Davy wrote:
Hi all,

I found in most SystemVerilog example, people like to use
fork...join_none pair (not the traditional fork...join pair). Is there
some advantage to fork...join_none pair? Thanks!

Best regards,
Davy
 
As a simple example, join_any is useful for implementing timeouts in
testbenches

fork
task_that_may_lock_up;

begin
repeat(10000)
begin
@(posedge clk);
end

$display("Error: Possible lock-up in task_that_may_lock_up");
end
join_any

// Finish will be called even if task_that_may_lock_up never completes
$finish;




Davy wrote:

Hi Macgyver,

Thanks a lot!

And I am curious about the fork...join_any(join the thread when thread
that used least time is finished). I cannot image when
"fork...join_any" is used?

Best regards,
Davy

macgyver wrote:
Davy,

fork...join_none is non-blocking, so all processes in the
fork...join_none start at the same time as the code following the
fork......join_none and the following code continues on.

the fork...join is blocking so all the processes in the fork....join
must complete before the code following even starts.

this is one of the very powerful features of SV. hence why its used
alot!

Macgyver

Davy wrote:
Hi all,

I found in most SystemVerilog example, people like to use
fork...join_none pair (not the traditional fork...join pair). Is there
some advantage to fork...join_none pair? Thanks!

Best regards,
Davy
 
and fork....join_any is again blocking just like the old fork.....join
but all processes are killed once the any one of them completes

Macgyver

On Nov 29, 6:08 am, "mjl...@hotmail.com" <mjl...@hotmail.com> wrote:
As a simple example, join_any is useful for implementing timeouts in
testbenches

fork
task_that_may_lock_up;

begin
repeat(10000)
begin
@(posedge clk);
end

$display("Error: Possible lock-up in task_that_may_lock_up");
end
join_any

// Finish will be called even if task_that_may_lock_up never completes
$finish;

Davy wrote:
Hi Macgyver,

Thanks a lot!

And I am curious about the fork...join_any(join the thread when thread
that used least time is finished). I cannot image when
"fork...join_any" is used?

Best regards,
Davy

macgyver wrote:
Davy,

fork...join_none is non-blocking, so all processes in the
fork...join_none start at the same time as the code following the
fork......join_none and the following code continues on.

the fork...join is blocking so all the processes in the fork....join
must complete before the code following even starts.

this is one of the very powerful features of SV. hence why its used
alot!

Macgyver

Davy wrote:
Hi all,

I found in most SystemVerilog example, people like to use
fork...join_none pair (not the traditional fork...join pair). Is there
some advantage to fork...join_none pair? Thanks!

Best regards,
Davy
 
macgyver wrote:
and fork....join_any is again blocking just like the old fork.....join
but all processes are killed once the any one of them completes
Fork..join_any does not automatically kill the other processes when any
of them completes. You can get that effect by following it with a
"disable fork" statement. In fact, that is the only way I have ever
seen fork..join_any used. It might have been better if there had been
a fork..join_disable statement instead, that did what you describe.
 

Welcome to EDABoard.com

Sponsor

Back
Top