Jump to content
DV-E

get_starting_phase() vs starting seq with uvm_config_db

Recommended Posts

HI All. 

    I am not sure if we already had this discussion or not. In uvm1.2, it seems get_starting_phase() can only be inside of default tasks (pre/post/body/start) of sequence with  uvm_config_db#(....)::set(this,"sqr.main_phase", "default_phase", seq) flow.  In below test case,  line 10 locked the phase while line 30 try to set_starting_phase(),  or anyway document that  line 10 is not right usage ? 

 it is not a case in seq.start(..) flow. 

Thanks

AM

 

[/code]

import uvm_pkg::*;
`include "uvm_macros.svh"

class seq extends uvm_sequence;
  `uvm_object_utils(seq)
 line 10:   uvm_phase phase_ = get_starting_phase();    // not ok.  this will lock the phase
                                             
   function new(string name ="seq");
     super.new(name);
   endfunction


  task pre_body();
  // uvm_phase phase_ = get_starting_phase();    //ok
   if( phase_ != null)
    phase_.raise_objection(this);
  endtask
   task body;
      #10;
     `uvm_info("whatever", "whatever", UVM_LOW);
   endtask


  task post_body();
  // uvm_phase phase_ = get_starting_phase();  //ok
   if( phase_ != null)
    phase_.drop_objection(this);
  endtask
endclass

class seqr extends uvm_sequencer;
  `uvm_component_utils(seqr);
  function new(string name = "seqr", uvm_component p = null);
   super.new(name, p);
  endfunction
endclass

class test extends uvm_test;
  `uvm_component_utils(test)
   seqr sqr;
   seq sq;


  function new(string  name ="test", uvm_component p = null);
   super.new(name, p);
  endfunction


  function void build_phase(uvm_phase phase);
    sqr = seqr::type_id::create("sqr",this);
   // sq = seq::type_id::create("sq");
  line 30   uvm_config_db#(uvm_object_wrapper)::set(this,"sqr.run_phase", "default_sequence", seq::type_id::get());  // not ok, it tries to set_starting_phase() but phase is locked. 
  endfunction


   task run_phase(uvm_phase phase);
   //phase.raise_objection(this);       // this flow is ok 
   //sq.start(this.sqr);
   //phase.drop_objection(this);
   endtask


endclass

module top;
  test t=new();
  initial 
    run_test();
endmodule
 

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

×