class test1_fork_join;
initial begin
int i = 0;
fork
begin
do1();
i++;
end
begin
do2();
i++;
end
begin
do3();
i++;
end
if(i)
$display "done";
disable fork;
join
end
endclass
class test2_fork_join_any;
initial begin
fork
begin
do1();
end
begin
do2();
end
begin
do3();
end
/*
fork
do1();
do2();
do3();
join_any
*/
join_any
$display "done";
disable fork;
end
endclass
class test3_fork_join_none;
initial begin
fork
fork
do1();
do2();
do3();
join_any
$display "done";
disable fork;
join_none
wait fork;
end
---------------------------------------------
小白尝试着来写一下,还请交流指正。