Jump to content
Sign in to follow this  
ljepson74

When a phase completes, are any lingering processes terminated?

Recommended Posts

Q1) If I use a fork-join_none to spawn a process in a phase, and then that phase ends (b/c objection is dropped), is the process terminated or allowed to complete?

 

 

I seem to be seeing that the process is terminated (but was expecting that it would be allowed to complete) and wanted to confirm that this is the expected behavior.  

Q2) Where is this behavior best documented?

 

 

(Context: I was moving my timeout-timer from main_phase to pre_reset_phase, so that its time begins at time==0.  If processes are killed when a phase ends, I suppose I should move it to run_phase to align it with time==0, ..... or start using the heartbeat component, which I have not gotten around to doing yet, but have been thinking a lot about.)

 

Share this post


Link to post
Share on other sites

hi,

 

the answer is "it depends".

 

- threads started inside or as a child-thread of  xyz_phase() are terminated before phase progression

 

- threads started inside phase_started() are NOT terminated automatically and continue to run until normal end or explicit termination.

 

/uwe

Share this post


Link to post
Share on other sites
Thanks a lot, /uwe.  That was very helpful.

 

My notes, for when I encounter this again:

 

1) from uvm_component.svh    (note: "Any threads spawned in this callback are not affected when the phase ends.")



  // Function: phase_started
  //
  // Invoked at the start of each phase. The ~phase~ argument specifies
  // the phase being started. Any threads spawned in this callback are
  // not affected when the phase ends.


  extern virtual function void phase_started (uvm_phase phase);


// phase_started
// -------------
// phase_started() and phase_ended() are extra callbacks called at the
// beginning and end of each phase, respectively.  Since they are
// called for all phases the phase is passed in as an argument so the
// extender can decide what to do, if anything, for each phase.


function void uvm_component::phase_started(uvm_phase phase);
endfunction


 

2) from uvm_task_phase.svh  (note:  "Once the phase completes, any remaining forked ...

threads are forcibly and immediately killed.")



//------------------------------------------------------------------------------
//
// Class: uvm_task_phase
//
//------------------------------------------------------------------------------
// Base class for all task phases.
// It forks a call to <uvm_phase::exec_task()>
// for each component in the hierarchy.
//
// The completion of the task does not imply, nor is it required for,
// the end of phase. Once the phase completes, any remaining forked
// <uvm_phase::exec_task()> threads are forcibly and immediately killed.
//
// By default, the way for a task phase to extend over time is if there is

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×