UVM Class reference manual define uvm_report_server
uvm_report_handler. None of its methods are intended to be called by normal testbench uvm_report_server is a global server that processes all of the reports generated by an code, although in some circumstances the virtual methods process_report and/or compose_uvm_info may be overloaded in a subclass.
Define uvm_report_server Link to heading
To change the message format, say CSV, compase_message
can be used to return re-formatted message.
compose_message
documentation states:
compose_message
Constructs the actual string sent to the file or command line from the severity, component name, report id, and the message itself. Expert users can overload this method to customize report formatting.
The following snippet, uses
class server extends uvm_report_server;
function string compose_message(
uvm_severity severity,
string name,
string id,
string message,
string filename,
int line);
return ($sformatf("%s,%s",id,message));
endfunction
endclass
Override report server Link to heading
The customer report server will be registered using static method uvm_report_server::set_server
server srv= new();
function void start_of_simulation_phase(uvm_phase phase);
uvm_report_server::set_server(srv);
endfunction
Putting it all together Link to heading
`include "uvm_macros.svh"
import uvm_pkg::*;
class server extends uvm_report_server;
function string compose_message(
uvm_severity severity,
string name,
string id,
string message,
string filename,
int line);
return ($sformatf("MESSAGE %s,%s",id,message));
endfunction
endclass
class test extends uvm_test;
`uvm_component_utils(test)
server srv= new();
function new(string name="", uvm_component parent=null);
super.new(name, parent);
endfunction
function void build_phase(uvm_phase phase);
super.build_phase(phase);
endfunction
function void start_of_simulation_phase(uvm_phase phase);
uvm_report_server::set_server(srv);
endfunction
task run_phase(uvm_phase phase);
phase.raise_objection(this);
`uvm_warning("MYID","Hello World report server")
phase.drop_objection(this);
endtask
endclass
module top;
initial run_test("test");
endmodule