virtualfunctionvoidexecute_report_message(uvm_report_messagereport_message,stringcomposed_message);// Add the intended custom handling here.super.execute_report_message(report_message,composed_message);endfunction
此示例保留默认 action、计数与退出处理。不要在自定义方法和 super 中重复计数或写出同一消息;需要完全接管时须自行实现这些契约。仅定制格式无需同时重写 execute。构造新 server 后通过 uvm_report_server::set_server(server) 安装,并触发真实消息验证自定义钩子生效。
兼容措施与范围:旧 report server 方法不再提供;改用 uvm_report_message 接口并保留格式与 action 处理。
迁移后验证
编译派生 server,触发一条 INFO 和一条 ERROR;确认自定义处理仍被调用、消息路由和计数正确。
//// Use <uvm_report_server::get_server()>functionuvm_report_serverget_report_server();uvm_report_serverl_rs=uvm_report_server::get_server();returnl_rs;endfunction// Function- dump_report_state//// This method dumps the internal state of the report handler. This includes// information about the maximum quit count, the maximum verbosity, and the// action and files associated with severities, ids, and (severity, id) pairs.//// Use:// uvm_report_handler rh =get_report_handler();// rh.print().
// This method can be overloaded by expert users to customize the way the// reporting system processes reports and the actions enabled for them.virtualfunctionvoidprocess_report(uvm_severityseverity,stringname,stringid,stringmessage,uvm_actionaction,UVM_FILEfile,stringfilename,intline,stringcomposed_message,intverbosity_level,uvm_report_objectclient);uvm_report_messagel_report_message;l_report_message=uvm_report_message::new_report_message();
//// Expert users can overload this method to customize report formatting.virtualfunctionstringcompose_message(uvm_severityseverity,stringname,stringid,stringmessage,stringfilename,intline);uvm_report_messagel_report_message;l_report_message=uvm_report_message::new_report_message();l_report_message.set_report_message(severity,id,message,UVM_NONE,filename,line,"");returncompose_report_message(l_report_message,name);endfunction