Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Fork-join clarification

6 views
Skip to first unread message

mrfirmware

unread,
Sep 3, 2008, 10:17:41 AM9/3/08
to
I'm using fork-joins in my testbench and I just want to be sure that
the more succinct version is functionally identical to the long
version (shown below).

// Succinct
fork
run_test(instance_1);
run_test(instance_2);
join

// Long
fork
begin
run_test(instance_1);
end

begin
run_test(instance_2);
end
join

I'm using SystemVerilog but I don't think this would be different in
Verilog.

Thanks,

- Mark

Jonathan Bromley

unread,
Sep 3, 2008, 10:49:41 AM9/3/08
to

You're fine. It's the same. A fork...join block wraps a bunch of
procedural statements (such as your run_test() calls) which are
executed in parallel; a begin...end wraps a bunch of procedural
statements which are then executed sequentially. A complete
fork...join, or a complete begin...end, has precisely the same
(syntactic) status as a single procedural statement and can be
used as one of the statements in another fork...join or
begin...end.

SystemVerilog changes the rules in two ways,
neither of which affects your issue:

1) Subprogram bodies:
In standard Verilog the body of a task or function
must be a single procedural statement. Of course,
almost any practical task or function needs multiple
statements, and therefore needs a begin...end to
enclose them. You could instead have a fork...join
as the body of your subprogram, but that's unusual.
In SystemVerilog, the usual begin...end is optional
so that you can now have multiple sequential statements
as the body of your subprogram.

2) Dynamic processes:
fork...join_none and fork...join_any. These have the
same "bracketing" effect as fork...join, but launch
their sub-threads in a rather different way.
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services

Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
jonathan...@MYCOMPANY.com
http://www.MYCOMPANY.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.

mrfirmware

unread,
Sep 3, 2008, 1:25:38 PM9/3/08
to
On Sep 3, 10:49 am, Jonathan Bromley <jonathan.brom...@MYCOMPANY.com>
wrote:

Thanks. That's the confirmation I was hoping for.

Regards,

- Mark

0 new messages