禾雨

导航

sequence启动方式

1、在某个component(例如my_sequencer、my_env)的main_phase中手工启动sequence:

     task  my_sequencer::main_phase(uvm_phase phase);

          my_sequence  seq;

          phase.raise_objection(this);

          seq=my_sequence::type_id::create("seq");

          seq.start(this);

          phase.drop_objection(this);

     endtask

 

task  my_env::main_phase(uvm_phase phase);

      my_sequence seq;

      phase.raise_objection(this);

      seq=my_sequence::type_id::create("seq");

      seq.start(i_agt.sqr);

       phase.drop_objection(this);

endtask

2、在某个component的build_phase中设置如下代码即可:

例如my_env中:

virtual function void  build_phase(uvm_phase phase);

    super.build_phase(phase);

……

     uvm_config_db#(uvm_object_wrapper)::set(this,"i_agt.sqr.main_phase","default_sequence",my_sequence::type_id::get());

endfunction

例如top_tb中:

module  top_tb;

    ……

     initial begin

          uvm_config_db#(uvm_object_wrapper)::set(null,"uvm_test_top.i_agt.sqr.main_phase","default_sequence",my_sequence::type_id::get());

     end

endmodule

例如my_agent中:

function void my_agent::build_phase(uvm_phase phase);

     super.build_phase(phase);

……

      uvm_config_db#(uvm_object_wrapper)::set(this,"sqr.main_phase","default_sequence",my_sequence::type_id::get());

endfunction

 

以上两种方式原理相同:

      在uvm_sequence这个基类中,有一个变量名为starting_phase,它的类型是uvm_phase。

      sequencer在启动default_sequence时,会自动做如下相关操作:

task my_sequencer::main_phase(uvm_phase phase);

    .......

     seq.starting_phase=phase;

     seq.start(this);

    ......

endtask

       

posted on 2019-12-12 16:32  禾雨  阅读(1667)  评论(0编辑  收藏  举报