How to achieve fork-join_none and fork join_any functionality using fork-join

//fork join_none functionality using fork join

module top;

initial 
  begin
      fork
          begin : b1
            #5 $display($time, " from block b1");   
          end : b1

          begin : b2
            #10 $display($time, " from block b2");
          end : b2
      join

    $display($time, " from outside fork-join block");
  end

endmodule

how to make it work like fork join_none and fork join_any

In reply to MadhavSrikantam:

Although it’s possible to make this contrived example work like join_none or join_any

module top;

event ev_any, ev_none;
 
initial 
  begin
      fork
          begin : b1
            -> ev_none;
            #5 $display($time, " from block b1");
            -> ev_any;
          end : b1
 
          begin : b2
            -> ev_none;
            #10 $display($time, " from block b2");
            -> ev_any;
          end : b2
          
          begin
          @(ev_none) // replace with @(ev_any) to get join_any functionality 
          $display($time, " from outside fork-join block");
          end
      join
 
  end
 
endmodule


It would be very difficult to get this functionality was embedded inside a task or loop.

In reply to dave_59:

module top;
 
initial 
  begin
      fork
          begin : b1
            #5 $display($time, " from block b1");   
          end : b1
 
          begin : b2
            #10 $display($time, " from block b2");
          end : b2
      join
 
    $display($time, " from outside fork-join block");
  end
 
endmodule



#                    5 from block b1
#                   10 from block b2
#                   10 from outside fork-join block

this is the output which i get for the above code using fork-join_none

//************************************************************************************




module top;
 
initial 
  begin
      fork
          begin : b1
            #5 $display($time, " from block b1");   
          end : b1
 
          begin : b2
            #10 $display($time, " from block b2");
          end : b2
      join_none
 
    $display($time, " from outside fork-join block");
  end
 
endmodule

#                    0 from outside fork-join block
#                    5 from block b1
#                   10 from block b2

this is the output for the code with fork-join_none

my doubt is what should be done to the first code so that i get the output as the second one

In reply to MadhavSrikantam:

Your question is lacking a purpose. The code I showed you above produce the same results as the fork/join_none. Here is another example

module top;
  initial 
          begin : b1
            #5 $display($time, " from block b1");
          end : b1
 initial
          begin : b2
            #10 $display($time, " from block b2");
          end : b2
 initial
          begin
          $display($time, " from outside fork-join block");
          end
endmodule

There are many ways to get the same output results. but there is no way to spawn a process in the background without join_none or join_any.

In reply to dave_59:

Understood,
Thank you for your reply