UVM Reporting
Hi,
I am new to UVM and I have a conceptual doubts on how to use uvm reporting.
I got a BFM, which will display all the trasacastions handled. Now I need to redirect all messages to a log file.
Can somebody please explain how do it with an example.
Thanks,
Deepak
In reply to deepak_infy:
I tried the below code:
class file_test extends pcie_top_base_test;
// component macro
`uvm_component_utils(file_test)
int fh, fh1;
// component constructor
function new(string name, uvm_component parent);
super.new(name, parent);
endfunction : new
function void build_phase(uvm_phase phase);
super.build_phase(phase);
uvm_config_wrapper::set(this, "tb.pcie_tx_env.tl_tx_env.tl_tx_agent.tl_tx_sequencer.run_phase",
"default_sequence",
pack_tl_pkt::type_id::get());
endfunction : build_phase
virtual task run();
fh = $fopen ("my_test_fh.log","w"); // opening two text files
fh1= $fopen ("my_test_fh1.log","w");
//uvm_top.set_report_default_file_hier();
uvm_top.set_report_default_file(fh1); // setting default write file as fh1
`uvm_info(get_name(),"Hello world",UVM_LOW) // this will be printed only to terminal/ simulation log
// since 'set_report_severity_action' is not yet set
$fdisplay(fh,"fdisplay - Hello world"); // will be written irrespective of 'set_report_*' setting
uvm_top.set_report_severity_action(UVM_INFO, UVM_LOG); // redirecting `ovm_info ony to text file
`uvm_info(get_name(),"My world",UVM_LOW) // will be in text file my_test_fh1.log
$fdisplay(fh,"fdisplay - My world");
uvm_top.set_report_default_file(fh); // setting default to fh, here after all `ovm_info woll be
// directed to fh
// instead of fh1
uvm_top.set_report_severity_action(UVM_INFO, UVM_LOG | UVM_DISPLAY ); // setting `ovm_info to be directed to my_test_fh.log
// and to terminal/ simulation log
$fdisplay(fh1,"fdisplay1 - My world");
`uvm_info(get_name(),"My last world :-) ",UVM_LOW) // will be in text file my_test_fh.log
// and in terminal/ simulation log
$fclose(fh);
$fclose(fh1);
endtask:run
endclass :file_test
But nothing is written into file. I am not sure if I am missing something.
You set the file logging correctly for the uvm_top (used by info messages that are not components), but none of its children. Add the "hier" suffix to your set_report* calls.