quick.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

   

space.gif

   

space.gif

  ../images/main/bulllet_4dots_orange.gif 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.

   

space.gif

  • fork - join (join all)
  • fork - join_none
  • fork - join_any
   

space.gif

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.

   

space.gif

fork - join_any, on other hand waits for alteast one process to complete, before it starts executing statements following join_any statement.

   

space.gif

below examples will show how this statements works.

   

space.gif

   

space.gif

  ../images/main/bullet_star_pink.gif Example - fork-join all
   

space.gif


  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
   

space.gif

Simulator Output

   

space.gif

 @3 Passed Value   4 Delay   2
 @6 Passed Value   8 Delay   5
 @8 Passed Value  10 Delay   7
 @8 Came out of fork-join
   

space.gif

  ../images/main/bullet_star_pink.gif Example - fork-join any
   

space.gif


  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
   

space.gif

Simulator Output

   

space.gif

 @3 Passed Value   4 Delay   2
 @3 Came out of fork-join
 @6 Passed Value   8 Delay   5
 @8 Passed Value  10 Delay   7
   

space.gif

  ../images/main/bullet_star_pink.gif Example - fork-join none
   

space.gif


  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
   

space.gif

Simulator Output

   

space.gif

 @0 Came out of fork-join
 @3 Passed Value   4 Delay   2
 @6 Passed Value   8 Delay   5
 @8 Passed Value  10 Delay   7
   

space.gif

   

space.gif

   

space.gif

   

space.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

  

Copyright © 1998-2014

Deepak Kumar Tala - All rights reserved

Do you have any Comment? mail me at:deepak@asic-world.com