Fork_join_any to fork_join_none Conversion

Is it possible to convert one controller to another controller Here my question is.“How to convert fork_join_any to fork_join_none?”.If it possible then pls let me know.

thanks,
VIKRAM

In reply to vikram babu:

fork
begin
process 1
end
begin
process 2
end
.
.
.
begin
process n
end
begin
any display statement/ #0;
end
join_any

this will work like fork join_none

I think its not possible.

But you can covert fork-join_any (or) fork-join_none to fork-join by adding “wait fork” after fork-join block;

In reply to Akhil Mangu:

I think its not possible.
But you can covert fork-join_any (or) fork-join_none to fork-join by adding “wait fork” after fork-join block;

Why not?


fork 
begin
  // statement1
end
begin
  // statement2
end
join_none

It is equivalent to:


fork 
begin
  // statement1
end
begin
  // statement2
end
begin
  // do nothing, exit the fork immediately.
end
join_any

It’s not nice, but it works.

In reply to cuonghle:

Hello cuonghle,

I am agree with your explanation. I tried practical example on this (presented down).Its gave output as you Said.



program main;
initial begin
#(10);
$display(" BEFORE fork time =%d ",$time );
fork
begin             ////////////////1st process
# (20);
$display(" process 1:time =%d # 20 ",$time );
end
begin             ////////////////2nd process
#(10);
$display(" process 2:time =%d # 10 ",$time );
end
begin            ////////////////3rd process
#(0);
$display(" process 3:time =%d # 0 ",$time );
end
join_none                    ////////////////////////////////join_none
$display(" time =%d Outside the main fork ",$time );
end
endprogram

OUTPUT: BEFORE fork time = 10

time = 10 Outside the main fork



program main;
initial begin
#(10);
$display(" BEFORE fork time =%d ",$time );
fork
begin             ////////////////1st process
# (20);
$display(" process 1:time =%d # 20 ",$time );
end
begin             ////////////////2nd process
#(10);
$display(" process 2:time =%d # 10 ",$time );
end
begin            ////////////////3rd process
#(0);
$display(" process 3:time =%d # 0 ",$time );
end

join_any //////////////////////////////////////////////join_any
$display(" time =%d Outside the main fork ",$time );
end
endprogram

OUTPUT: BEFORE fork time = 10

process 3:time = 10 # 0

time = 10 Outside the main fork

thank you cuonghle and naresh_sambhnani.

In reply to priyadarshee:

These questions make little sense. It’s like asking “how do you convert addition to subtraction?” Answer: “you change the + operator to a “-” operator”. But then you get different behavior. But if you want the same behavior, then why do you need to do the conversion?