How to dynamically change what to you want to compare()

Hi,

I know they are preferring do_compare(), but if you would like to dynamically change what you want compare() (i.e. what fields you want to skip in compare), how it could be done? I need to skip compare() of certain transaction item fields (actual vs. expected) in some of test cases. Is it possible to utilize uvm_config_db() for example?

Thank you already in advance!

-ilia

In reply to ilia:

I don’t know the details of what you want to do, but the uvm_config_db can be used for passing information through the UVM environment. You have to perfrom a set from the corresponding test and perform a get where you are perfoming your compare.

As I mentioned, I would like to use UVM compare() method to compare expected and actual data items in my scoreboard. I have several data fields in the item, and in some of the test cases I would like skip comparison of some of them.

I found the following thread in which Dave says you can dynamically change what to compare using the configuration mechanism. But the question here goes which is that particular mechanism?

https://verificationacademy.com/forums/ovm/how-compare-only-specific-fields-using-compare-function

-ilia

In reply to ilia:

I would extend the sequence_item class and modify the do_compare() method as required. In your test, override the base sequence_item with the extended sequence_item.

In reply to cgales:

I would like to prefer that, but we end up in the situation where we have several different combinations of skipped fields. In test1, we need to skip field 1, in another test fields 1 and 2, etc. To resolve that we should derive many different versions of sequence item class and its do_compare() method, and it doesn’t make sense in my opinion.

In reply to ilia:

If you don’t want to change the do_compare function for the sequence_item, then I would recommend using a compare function in your scoreboard. You can add variables to your environmental configuration object which can control which parts of compare function is used.