Question

My question is about fork...join_none construct in SV.

According to the LRM section 9.3.2 Parallel blocks, Table 9-1—fork-join control options:

The parent process continues to execute concurrently with all the processes spawned by the fork. The spawned processes do not start executing until the parent thread executes a blocking statement.

Using the join_none doesn't wait for the any of the forked process to complete and proceeds executing the non-blocking statements. I am trying to think of a scenario where one would use join_none during design / verification.

Thanks!!

Was it helpful?

Solution

The most common use of fork/join_none in SystemVerilog is when you want to spawn a dynamic number of parallel threads. In a testbench, each thread could represent a single device on a bus.

initial
  begin 
    N = $urandom_range(1,10);
    for( int j = 1; j <= N; ++j )
      fork
         automatic int k = j; // local copy, k, for each value of j
         start_a_thread(k);
      join_none
   end

OTHER TIPS

join_none is widely used in verification methodologies, such as UVM. It is used to spawn off multiple threads in parallel in the testbench. For example, it can be used to start an interrupt monitor in parallel with a data bus driver.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top