Hi,
Can i use fork…join / fork…join_any inside of function?
Example:1 → Getting compilation error.
module top;
initial begin
$display("Before calling of function t1() is %t", $time);
t1();
$display("After calling of function t1() is %t", $time);
end
function void t1();
fork
begin : a1
$display("a1: %t",$time); // **this thread is executing at zero simulation time.**
end
begin : a2
$display("a2: %t",$time); // **this thread is executing at zero simulation time.**
end
begin: a3
$display("a3: %t",$time); // **this thread is executing at zero simulation time.**
end
join
endfunction
endmodule
Example:2 → Getting compilation error
module top;
initial begin
$display("Before calling of function t1() is %t", $time);
t1();
$display("After calling of function t1() is %t", $time);
end
function void t1();
fork
begin : a1
$display("a1: %t",$time); // **this thread is executing at zero simulation time.**
end
begin : a2
#1;
$display("a2: %t",$time);
end
begin: a3
#2;
$display("a3: %t",$time);
end
join_any
endfunction
endmodule
May i know what is the reason for compilation error even though function with zero simulation of time?
Thanks and Regards,
koti