0

I'm following http://cluelogic.com/2013/01/uvm-tutorial-for-candy-lovers-do-hooks/ and https://verificationacademy.com/cookbook/transaction/methods to implement compare the only difference is instead of big logical AND (&&) I'm using

virtual function bit do_compare ....
  do_compare &= <statement A>;
  do_compare &= <statement B>;

  $display (do_compare); ///< this displays 1
  return do_compare;

endfunction

However returned value always comes out to be 0 for e.g. consider sequences

temp = m.compare(n);
$display (temp); ///< displays 0

I've been trying to debug why temp is always 0 but couldn't figure out. Can anyone point me in right direction

4

1 回答 1

2

查看源代码,compare(...)我看到以下do_compare(...)要调用的条件:

if(!done) begin
  comparer.compare_map.set(rhs, this);
  __m_uvm_field_automation(rhs, UVM_COMPARE, "");
  dc = do_compare(rhs, comparer);
end

不确定它们何时设置done(一种情况是为使用字段宏自动生成的字段标记错误)。你确定你do_compare(...)的被叫?在其中添加一个 `uvm_info 或设置一个断点以确保。

我在 John Aynsley 的演示文稿中看到的另一个想法是,如果您想实现自己的do_*方法,则不要使用字段自动化宏。如果您正在使用它们,请尝试将所有字段设置为UVM_NOCOMPARE. 这是因为 的返回值compare(...)计算为return (comparer.result == 0 && dc == 1);。这意味着即使您do_compare(...)返回 1,也可能仍然存在其中一个自动字段标记错误的情况(尽管我预计会出现错误消息)。

于 2014-06-19T07:07:55.343 回答