|  | 
|  |  | 
 |  
|  |  |  |  
|  |  | 
 |  
|  |  | fork-join |  
|  |  | The fork...join construct enables the creation of concurrent processes from each of its parallel statements. SyntemVerilog provides following version's of fork-join. |  
|  |  | 
 |  
|  |  | 
 fork - join (join all) fork - join_none fork - join_any |  
|  |  | 
 |  
|  |  | fork -join is same as one in Verilog. i.e. is join all. fork - join_none, does not wait for any forked process is complete and thus starts execution statements after the join_none statement without waiting for forked process. |  
|  |  | 
 |  
|  |  | fork - join_any, on other hand waits for alteast one process to complete, before it starts executing statements following join_any statement. |  
|  |  | 
 |  
|  |  | below examples will show how this statements works. |  
|  |  | 
 |  
|  |  |  |  
|  |  | 
 |  
|  |  | Example - fork-join all |  
|  |  | 
 |  
|  |  | 
  1 module fork_join_all_process();
  2 
  3 task automatic print_value;
  4   input [7:0] value;
  5   input [7:0] delay;
  6   begin
  7     #(delay) $display("@%g Passed Value %d Delay %d",
  8       $time, value, delay);
  9   end
 10 endtask
 11 
 12 initial begin
 13   fork 
 14      #1  print_value (10,7);
 15      #1  print_value (8,5);
 16      #1  print_value (4,2);
 17   join
 18   $display("@%g Came out of fork-join", $time);
 19    #20  $finish;
 20 end
 21 
 22 endmodule
You could download file fork_join_all_process.sv here |  
|  |  | 
 |  
|  |  | Simulator Output |  
|  |  | 
 |  
|  |  |  @3 Passed Value   4 Delay   2
 @6 Passed Value   8 Delay   5
 @8 Passed Value  10 Delay   7
 @8 Came out of fork-join
 |  
|  |  | 
 |  
|  |  | Example - fork-join any |  
|  |  | 
 |  
|  |  | 
  1 module fork_join_any_process();
  2 
  3 task automatic print_value;
  4   input [7:0] value;
  5   input [7:0] delay;
  6   begin
  7     #(delay) $display("@%g Passed Value %d Delay %d",
  8       $time, value, delay);
  9   end
 10 endtask
 11 
 12 initial begin
 13   fork 
 14      #1  print_value (10,7);
 15      #1  print_value (8,5);
 16      #1  print_value (4,2);
 17   join_any
 18   $display("@%g Came out of fork-join", $time);
 19    #20  $finish;
 20 end
 21 
 22 endmodule
You could download file fork_join_any_process.sv here |  
|  |  | 
 |  
|  |  | Simulator Output |  
|  |  | 
 |  
|  |  |  @3 Passed Value   4 Delay   2
 @3 Came out of fork-join
 @6 Passed Value   8 Delay   5
 @8 Passed Value  10 Delay   7
 |  
|  |  | 
 |  
|  |  | Example - fork-join none |  
|  |  | 
 |  
|  |  | 
  1 module fork_join_none_process();
  2 
  3 task automatic print_value;
  4   input [7:0] value;
  5   input [7:0] delay;
  6   begin
  7     #(delay) $display("@%g Passed Value %d Delay %d",
  8       $time, value, delay);
  9   end
 10 endtask
 11 
 12 initial begin
 13   fork 
 14      #1  print_value (10,7);
 15      #1  print_value (8,5);
 16      #1  print_value (4,2);
 17   join_none
 18   $display("@%g Came out of fork-join", $time);
 19    #20  $finish;
 20 end
 21 
 22 endmodule
You could download file fork_join_none_process.sv here |  
|  |  | 
 |  
|  |  | Simulator Output |  
|  |  | 
 |  
|  |  |  @0 Came out of fork-join
 @3 Passed Value   4 Delay   2
 @6 Passed Value   8 Delay   5
 @8 Passed Value  10 Delay   7
 |  
|  |  | 
 |  
|  |  | 
 |  
|  |  | 
 |  
|  |  |  |  
|  |  | 
 |  |  | 
|  
 |  
 |  
 | 
| 
 | 
|    |  
| Copyright © 1998-2025 |  
| Deepak Kumar Tala - All rights reserved |  
| Do you have any Comment? mail me at:deepak@asic-world.com
 |  |