Jump to content

Function do_compare override in uvm_sequence_item derived class - compare always returns '1'

Recommended Posts


I have created new transaction by extending uvm_sequence_item, where I have implemented do_compare function. Once implemented, compare calls seems to return '1', even if do_compare returns '0' (comparison failed).

I have traced comparison to uvm_object compare function calling uvm_comparer compare_object method. There, do_compare seems to be used in following code:

      if (field_op.user_hook_enabled()) begin
        ret_val = lhs.do_compare(rhs,this);
      // If do_compare() returned 1, check for a change
      // in the result count.
      if (ret_val && (get_result() > old_result))
        ret_val = 0;
        ret_val = 1;

It seems that any time do_compare returns '0', the condition below it always change ret_val (compare_object return value) to '1'.  This behaviour exists only in 1800.2-2017-0.9 reference implementation of UVM library. If I use UVM-1.2, compare calls returns '0',  if do_compare returns '0' on comparison failure (as I would expect).

I would like to ask whether this behaviour is intentional. In such case, is there any recommended way to implement do_compare task?

Thank you.

Share this post

Link to post
Share on other sites

Thanks for posting this issue Rolko.  The "else ret_val = 1" is a bug in 1800.2-2017-0.9.  It is removed in 1800.2-2017-1.0, a release which was approved last week by the committee and should be available for download very soon.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now