3

我有一个 UVM 记分牌,它有多个导致`uvm_error. 我想自动拦截 uvm_error 并转储我的记分牌的内容。其他工程师将向记分板(及其子级)添加检查,因此回调应尽可能透明。

我正在尝试做的简单示例:

  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 Playground 上模拟和修改上述示例:http ://www.edaplayground.com/s/4/549

什么是 UVM 推荐的方法来做到这一点?有人可以分享工作代码吗?

4

1 回答 1

4

你想设置一个report_catcher。这会拦截报告,您可以将转储添加到消息字符串中,或​​者将其放在单独的消息中。为了使报告更容易捕获,您应该使用唯一的消息 ID(如“SBERRDMP”)来捕获添加完整 DuMP 的记分板错误。

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
于 2013-12-11T05:16:31.217 回答