The following classes define comparators for objects and built-in types.
Comparators | The following classes define comparators for objects and built-in types. |
uvm_in_order_comparator #(T,comp_type,convert,pair_type) | Compares two streams of data objects of the type parameter, T. |
uvm_in_order_built_in_comparator #(T) | This class uses the uvm_built_in_* comparison, converter, and pair classes. |
uvm_in_order_class_comparator #(T) | This class uses the uvm_class_* comparison, converter, and pair classes. |
Compares two streams of data objects of the type parameter, T. These transactions may either be classes or built-in types. To be successfully compared, the two streams of data must be in the same order. Apart from that, there are no assumptions made about the relative timing of the two streams of data.
Type parameters
T | Specifies the type of transactions to be compared. |
comp_type | A policy class to compare the two transaction streams. It must provide the static method “function bit comp(T a, T b)” which returns TRUE if a and b are the same. |
convert | A policy class to convert the transactions being compared to a string. It must provide the static method “function string convert2string(T a)”. |
pair_type | A policy class to allow pairs of transactions to be handled as a single uvm_object type. |
Built in types (such as ints, bits, logic, and structs) can be compared using the default values for comp_type, convert, and pair_type. For convenience, you can use the subtype, uvm_in_order_built_in_comparator #(T) for built-in types.
When T is a uvm_object, you can use the convenience subtype uvm_in_order_class_comparator #(T).
Comparisons are commutative, meaning it does not matter which data stream is connected to which export, before_export or after_export.
Comparisons are done in order and as soon as a transaction is received from both streams. Internal fifos are used to buffer incoming transactions on one stream until a transaction to compare arrives on the other stream.
uvm_in_order_comparator #(T,comp_type,convert,pair_type) | |
Compares two streams of data objects of the type parameter, T. | |
Ports | |
before_export | The export to which one stream of data is written. |
after_export | The export to which the other stream of data is written. |
pair_ap | The comparator sends out pairs of transactions across this analysis port. |
Methods | |
flush | This method sets m_matches and m_mismatches back to zero. |
The export to which one stream of data is written. The port must be connected to an analysis port that will provide such data.
The export to which the other stream of data is written. The port must be connected to an analysis port that will provide such data.
The comparator sends out pairs of transactions across this analysis port. Both matched and unmatched pairs are published via a pair_type objects. Any connected analysis export(s) will receive these transaction pairs.
virtual function void flush()
This method sets m_matches and m_mismatches back to zero. The uvm_tlm_fifo::flush takes care of flushing the FIFOs.
This class uses the uvm_built_in_* comparison, converter, and pair classes. Use this class for built-in types (int, bit, string, etc.)
uvm_in_order_built_in_comparator #(T) | |||||||||||||||||
This class uses the uvm_built_in_* comparison, converter, and pair classes. | |||||||||||||||||
Class Hierarchy | |||||||||||||||||
| |||||||||||||||||
Class Declaration | |||||||||||||||||
|
This class uses the uvm_class_* comparison, converter, and pair classes. Use this class for comparing user-defined objects of type T, which must provide compare() and convert2string() method.
uvm_in_order_class_comparator #(T) | |||||||||||||||||
This class uses the uvm_class_* comparison, converter, and pair classes. | |||||||||||||||||
Class Hierarchy | |||||||||||||||||
| |||||||||||||||||
Class Declaration | |||||||||||||||||
|
This class uses the uvm_built_in_* comparison, converter, and pair classes.
class uvm_in_order_built_in_comparator #( type T = int ) extends uvm_in_order_comparator #(T)
This class uses the uvm_class_* comparison, converter, and pair classes.
class uvm_in_order_class_comparator #( type T = int ) extends uvm_in_order_comparator #( T , uvm_class_comp #( T ) , uvm_class_converter #( T ) , uvm_class_pair #( T, T ) )
This method sets m_matches and m_mismatches back to zero.
virtual function void flush()
The uvm_object class is the base class for all UVM data and hierarchical classes.
virtual class uvm_object extends uvm_void
Removes all entries from the FIFO, after which used returns 0 and is_empty returns 1.
virtual function void flush()