Sign in to follow this  
Followers 0
mrforever

how to use uvm_in_order_comparator

4 posts in this topic

hi, experts

If i wish to define a custom comparison for my transaction, i can do it as these two ways.

1) override do_compare in my transaction class, and use the uvm_in_order_comparator .

2) pass in a policy class, which includes a static comp method that returns a bit, to the comparator that defines my custom comparison.

i know how to implement it using the second way. but i don't know how to use uvm_in_order_comparator. i have tried to found it in this forum and uvm class ref, but i couldn't find any piece of examples, would somebody give some examples about using uvm_in_order_comparator. for example, how does uvm_in_order_comparator invoke compare() , which invokes do_compare() in uvm automatically.

Share this post


Link to post
Share on other sites

Hi,

The uvm_in_order_comparator is pretty old and inflexible. I am afraid that there is no easy way for you to do what you want. I create a predictor (uvm_subscriber) on one or both sides of the in order comparator and "zero out" the fields that I don't want to be compared.

Best Regards

Peter

Share this post


Link to post
Share on other sites

Is there any update on this comparator class? Is it still considered bad/old/inflexible and let users write their own using tlm_analysis_fifo? 

 

Thanks

Srini

Share this post


Link to post
Share on other sites

I find it to be a perfectly reasonable alternative to writing your own comparator. I'm not sure why back in 2012 was considered old. But it does only do one thing. If you need any more advanced comparisons, then it's not that useful.

 

Implementing do_compare in your class is a pretty simple thing to do. Once done, the do_compare provides the ability to create your own custom comparators that can provide more flexibility.

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
Sign in to follow this  
Followers 0