1、指定组件指定等级日志记录到日志文件
class base_test extends uvm_test;
dut_env env;
UVM_FILE info_log;//记录日志文件
`uvm_component_utils(base_test);
function new(string name = "base_test", uvm_component parent);
super.new(name, parent);
endfunction
extern virtual function void connect_phase(uvm_phase phase);
extern virtual function void build_phase(uvm_phase phase);
endclass
function void base_test::connect_phase(uvm_phase phase);
super.connect_phase(phase);
info_log = $fopen("info.log", "w");
env.i_agent.drv.set_report_severity_file(UVM_INFO,info_log);//设置日志记录等级
env.i_agent.drv.set_report_severity_action(UVM_INFO, UVM_LOG);//设置指定等级的输出通道
endfunction
function void base_test::build_phase(uvm_phase phase);
super.build_phase(phase);
env = dut_env::type_id::create("env", this);
endfunction
这样设置完之后,所有driver中的等级为UVM_INFO的消息就会记录到日志文件中:
2、set_report_severity_*_hire()这样就可以递归生效,这个组件和这个组件的孩子节点都可以生效。