For easy debugging
in SOC verification, generate separate log files for different IPs/Instances.
How to Generate separate
Log files for different Functions/Layers/Instances/Files?
You can implement
the below logic in your uvm environment to generate the separate Log files for
each instances. Below I have written a piece of code to generate the separate
Log files and you can refer the same.
For Example:
Without generating
the Separate Log files,
///////////////////////////////////////////////////////////////////////////////////
// Test driver
class test_driver extends uvm_component;
`uvm_component_utils(test_driver)
`uvm_component_utils(test_driver)
function new(string name,uvm_component parent);
super.new(name, parent);
endfunction
task run();
uvm_report_info(get_name(), "Driver Info :: dump into the Log ",UVM_HIGH);
endtask
endclass
// Test monitor
class test_monitor extends uvm_component;
`uvm_component_utils(test_monitor)
`uvm_component_utils(test_monitor)
function new(string name,uvm_component parent);
super.new(name, parent);
endfunction
task run();
uvm_report_info(get_name(), "Monitor Info :: dump into the Log ",UVM_HIGH);
endtask
endclass
// Test agent
class test_agent extends uvm_component;
test_driver log_drv;
test_driver log_drv;
test_monitor
log_mon;
`uvm_component_utils(test_agent)
function new(string name,uvm_component parent);
super.new(name, parent);
endfunction
function void build();
super.build();
log_drv = test_driver::type_id::create("log_drv",this);
log_mon =
test_driver::type_id::create("log_mon",this);
endfunction
endclass
///////////////////////////////////////////////////////////////////////////////////
With generating the
Separate Log files,
///////////////////////////////////////////////////////////////////////////////////
// Test driver
class test_driver extends
uvm_component;
string test;
`uvm_component_utils(test_driver)
`uvm_component_utils(test_driver)
function new(string name,uvm_component parent);
super.new(name, parent);
test = “TEST”;
endfunction
endfunction
task run();
uvm_report_info(test, "Driver Info :: dump into the Log ",UVM_HIGH);
endtask
uvm_report_info(test, "Driver Info :: dump into the Log ",UVM_HIGH);
endtask
endclass
// Test monitor
class test_monitor extends
uvm_component;
string test;
`uvm_component_utils(test_monitor)
`uvm_component_utils(test_monitor)
function new(string name,uvm_component parent);
super.new(name, parent);
test = “TEST”;
endfunction
task run();
uvm_report_info(test, "Monitor Info :: dump into the Log ",UVM_HIGH);
endtask
endfunction
task run();
uvm_report_info(test, "Monitor Info :: dump into the Log ",UVM_HIGH);
endtask
endclass
// Test agent
class test_agent extends uvm_component;
integer log_ptr, log_ptr_id;
test_driver log_drv;
test_driver log_drv;
test_monitor
log_mon;
`uvm_component_utils(test_agent)
function new(string name,uvm_component parent);
super.new(name, parent);
endfunction
function void build();
super.build();
log_drv = test_driver::type_id::create("log_drv",this);
log_mon =
test_driver::type_id::create("log_mon",this);
// set the uvm action for that ID
log_drv.set_report_id_action(“TEST”,UVM_LOG);
log_mon.set_report_id_action(“TEST”,UVM_LOG);
// open the file to dump
log_ptr = $fopen(“test.log”);
log_ptr_id = $fopen(“test_id.log”);
// to dump all log in the file
log_drv.set_report_default_file(log_ptr);
log_mon.set_report_default_file(log_ptr);
// to dump the particular ID log in
the file
log_drv.set_report_id_file(TEST,log_ptr_id);
log_mon.set_report_id_file(TEST,log_ptr_id);
endfunction
endclass
///////////////////////////////////////////////////////////////////////////////////
With an above example you can have a display test case status without any signal/variable from the test environment.