System verilog 如何拦截uvm_错误并导致回调?
我有一个UVM记分板,它有多个导致System verilog 如何拦截uvm_错误并导致回调?,system-verilog,uvm,System Verilog,Uvm,我有一个UVM记分板,它有多个导致`UVM\u错误的检查。 我想自动拦截uvm_错误并转储记分板的内容。其他工程师将向记分板(及其子项)添加检查,因此回调应尽可能透明 我正在尝试做的简单示例: task run_phase(uvm_phase phase); phase.raise_objection(this); // How to do an automatic sb.dump_contents() callback? `uvm_error("ERROR", "s
`UVM\u错误的检查。
我想自动拦截uvm_错误并转储记分板的内容。其他工程师将向记分板(及其子项)添加检查,因此回调应尽可能透明
我正在尝试做的简单示例:
task run_phase(uvm_phase phase);
phase.raise_objection(this);
// How to do an automatic sb.dump_contents() callback?
`uvm_error("ERROR", "scoreboard caught an error");
phase.drop_objection(this);
endtask
function void dump_contents();
$display("The queue contents of my scoreboard.");
endfunction
您可以在EDA平台上模拟和修改上述示例:
UVM推荐的方法是什么?有人可以共享工作代码吗?您想设置一个报表捕获器。这将截取报告,您可以将转储添加到消息字符串中,或者将其放在单独的消息中。为了使报告更容易捕获,您应该使用一个独特的消息ID(如“SBERRDMP”)来捕获添加完整转储的记分板错误
class sb_dump_catcher extends uvm_report_catcher;
function new(string name="sb_dump_catcher");
super.new(name);
endfunction
function action_e catch();
if(get_severity() == UVM_ERROR && get_id() == "SBERRDMP")
begin
sb sb_h;
if ( !$cast(sb_h, get_client()) ) `uvm_error("NOTASB", "The Message ID \"SBERRDMP\" is reserved for my scoreboard")
set_message( {get_message, "/n", sb_h.dump_contents()} );
end
return THROW;
endfunction
endclass
然后在记分板的某个阶段,您将此捕手添加到回调列表中
function void start_of_simulation_phase(uvm_phase phase);
sb_dump_catcher h = new;
uvm_report_cb::add(this, h);
endfunction
这很有效。我不能简单地使用$cast(sb_h,get_client())
来确定是否转储内容,而不必担心id吗?比如这里:是的,如果强制转换失败,那么null句柄引用对您来说是一个足够好的错误。