Fork_join inside main_phase of UVM

Hi all,

I have a fork join_none inside an UVM main phase.

task main_phase(uvm_phase phase);
   phase.raise_objection(this);
   fork
      begin
         $display("Fork 1");
         // some code
      end
      begin
        $display("Fork 2");
        // some code
      end

   join_none

  phase.drop_objection(this);

endtask

I see that the threads start(as I can see $displays printing), however they do not complete and hence terminates the simulation.

What could be going wrong? I have another testbench that is non-UVM and has the same fork join_none. This tells me that, the code inside fork join_none is not causing this. Then what else could it be?

Please advise. Thank you.

Swetha. C

If you want the main_phase to wait for the two threads to complete, use join instead of join_none. That prevents the objection from being dropped too soon.

@dave_59 Thank you for your reply.

Using fork join [all] I can see that the second thread is not being called correctly. So I decided to go with fork join_none (which gives the behaviours of 2 independent always blocks).

As you can see below:


Thread 2 is hardly being called using fork join [all]

Instead, I would like something like below:

Swetha. C