|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
seq中设置config_db b 在my_case0 get
seq
class my_rst_seq extends rst_seq_api;
`uvm_object_utils(my_rst_seq)
rst_agent_cfg my_rst_config;
int a;
// `uvm_declare_p_sequencer(my_sequencer)
function new(string name="my_rst_seq");
super.new(name);
endfunction
virtual task body();
// if(starting_phase != null)
// starting_phase.raise_objection(this);
`uvm_info("my_rst_seq","in body",UVM_MEDIUM)
if(!uvm_config_db #(int)::get(null, get_full_name(), "a", a))
begin
`uvm_error("CONFIG", $sformatf("reg_seq_lib: global_pkt_config not found"));
end
else
begin
$display("get_full_name = %d",a);
end
//rst_ctrl("RST_PULSE_CYCLES",3,10);
`uvm_info("my_rst_seq","start.....",UVM_MEDIUM)
rst_ctrl("RST_ASSERT",3,10);
#100;
rst_ctrl("RST_DEASSERT",3,10);
`uvm_info("my_rst_seq","set b !!!!....",UVM_MEDIUM)
uvm_config_db#(int)::set(uvm_root::get(),"uvm_test_top","b",1);
uvm_config_db#(int)::set(null,"uvm_test_top","b",1);
`uvm_info("my_rst_seq","end.....",UVM_MEDIUM) //#100;
`uvm_info("my_rst_seq","out body",UVM_MEDIUM)
// if(starting_phase != null)
// starting_phase.drop_objection(this);
endtask
endclass : my_rst_seq
my_caso0.sv
class my_case0 extends base_test;
`uvm_component_utils(my_case0)
rst_agent_cfg my_rst_config;
int b;
function new(string name = "my_case0", uvm_component parent = null);
//function new(string name, uvm_component parent);
super.new(name,parent);
endfunction
extern virtual function void build_phase(uvm_phase phase);
extern virtual function void connect_phase(uvm_phase phase);
task run_phase(uvm_phase phase);
begin
my_rst_seq my_seq= my_rst_seq::type_id::create("my_seq",this);
phase.raise_objection(this,"rst_ctrl_seq active");
`uvm_info("my_case0","in run_phase",UVM_MEDIUM)
my_seq.start(env.i_agt.m_sqr);
$display("my_case0 get_full_name = %s",get_full_name());
fork
while(1) begin
uvm_config_db#(int)::wait_modified(this,"","b");
// void`(uvm_config_db #(bit)::get(this,"","b",b));
void'(uvm_config_db#(int)::get(this, "", "b", b));
$display("get_b1 = %d",b);
end
$display("get_b2 = %d",b);
join
$display("get_b3 = %d",b);
`uvm_info("my_case0","out run_phase",UVM_MEDIUM)
phase.drop_objection(this,"rst_ctrl_seq finished");
end
endtask : run_phase
endclass
|
|