Jump to content

Adding a run-time phase example


Recommended Posts

Figured this out myself.  In case anyone is interested, here's what I did.

 

 

My goal was to add a run-time phase that I could use for configuring default sequences on sequencers.

 

///////////////////////////////////////////////////////

 

Here's the definition of the new phase

 

class uvm_foo_phase extends uvm_task_phase;

   virtual task exec_task(uvm_component comp, uvm_phase phase);

      my_uvm_sequencer seqr;

      if ($cast(seqr, comp))

        seqr.foo_phase(phase);

   endtask

   local static uvm_foo_phase m_inst;

   static const string type_name = "uvm_foo_phase";

 

   // Function: get

   // Returns the singleton phase handle

   static function uvm_foo_phase get();

      if(m_inst == null)

         m_inst = new;

      return m_inst;

   endfunction

   protected function new(string name="foo");

      super.new(name);

   endfunction

   virtual function string get_type_name();

      return type_name;

   endfunction

endclass

 

///////////////////////////////////////////////////////

 

Here's what I added to the build phase of my test component to add it to the run time schedule.

 

         uvm_phase sched = uvm_domain::get_uvm_schedule();

         sched.add(uvm_foo_phase::get(),

                   .after_phase(sched.find_by_name("pre_configure")),

                   .before_phase(sched.find_by_name("configure")));

 

///////////////////////////////////////////////////////

 

Here's what I added to my my_uvm_sequencer class

 

  virtual function void foo_phase(uvm_phase phase);

      start_phase_sequence(phase);

  endfunction     

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...