ovm_in_order_comparator #(T,comp_type,convert,pair_type)

Compares two streams of data objects of type T, a parameter to this class.  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

TSpecifies the type of transactions to be compared.
compThe type of the comparator to be used to compare the two transaction streams.
convertA policy class to allow convert2string() to be called on the transactions being compared.  If T is an extension of ovm_transaction, then it uses T::convert2string().  If T is a built-in type, then the policy provides a convert2string() method for the comparator to call.
pair_typeA policy class to allow pairs of transactions to be handled as a single ovm_transaction 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, <ovm_in_order_builtin_comparator #(T)> for built-in types.

When T is a class, T must implement comp and convert2string, and you must specify class-based policy classes for comp_type, convert, and pair_type.  In most cases, you can use the convenient subtype, ovm_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.

Summary
ovm_in_order_comparator #(T,comp_type,convert,pair_type)
Compares two streams of data objects of type T, a parameter to this class.
Ports
before_exportThe export to which one stream of data is written.
after_exportThe export to which the other stream of data is written.
pair_apThe comparator sends out pairs of transactions across this analysis port.
Methods
flushThis method sets m_matches and m_mismatches back to zero.

before_export

The export to which one stream of data is written.  The port must be connected to an analysis port that will provide such data.

after_export

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.

pair_ap

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.

flush

virtual function void flush()

This method sets m_matches and m_mismatches back to zero.  The tlm_fifo #(T)::flush takes care of flushing the FIFOs.

in_order_built_in_comparator #(T)

This class uses the ovm_built_in_* comparison, converter, and pair classes.  Use this class for built-in types (int, bit, string, etc.)

Summary
in_order_built_in_comparator #(T)
This class uses the ovm_built_in_* comparison, converter, and pair classes.
Class Hierarchy
ovm_in_order_comparator#(T)
in_order_built_in_comparator#(T)
Class Declaration
class ovm_in_order_built_in_comparator #(
   type T = int
) extends ovm_in_order_comparator #(T)

in_order_class_comparator #(T)

This class uses the ovm_class_* comparison, converter, and pair classes.  Use this class for comparing user-defined objects of type T, which must provide implementations of comp and convert2string.

virtual function void flush()
This method sets m_matches and m_mismatches back to zero.
virtual function void flush()
Removes all entries from the FIFO, after which used returns 0 and is_empty returns 1.
class ovm_in_order_built_in_comparator #(
   type T = int
) extends ovm_in_order_comparator #(T)
This class uses the ovm_built_in_* comparison, converter, and pair classes.