module tb_top;
...
virtual DebugVif debug_vif_i;
initial begin
uvm_config_db #(virtual DebugVif)::set(null,"","debug_vif",debug_vif_i);
end
...
endmodule
we can get the debug_vif in the tests.
class test_name extends uvm_test;
virtual DebugVif debug_vif_h;
...
function void build_phase(uvm_phase phase);
super.build_phase(phase);
if(!uvm_config_db#(virtual DebugVif)::get(null,"","debug_vif",debug_vif_h))begin
`uvm_fatal(get_type_name(),"cannot get debug interface")
end
...
endclass : test_name
为什么要用factory方式来create sequence?
用factory创建的sequence能应用override方式来将class type切换成derived class type.
用create还可以实现parent,child结构,具体实现方式可参考uvm_component::new();
build_phase的TOP_DOWN执行方式在uvm_topdown_phase.svh的traverse() function中实现。
uvm_component里面有set_report_severity_id_verbosity_hier等function,应该可以用来对不同的模块设置不同的打印级别。
用for循环的方式create多个object。
sting s;
for(int i=0; i<10;i++)begin
s.itoa(i);
test_agent_h[i] = test_agent::type_id::create({"test_agent_h_",s},this);
end