ovm_algorithmic_comparator.svh | |
Comparators | A common function of testbenches is to compare streams of transactions for equivalence. |
A common function of testbenches is to compare streams of transactions for equivalence. For example, a testbench may compare a stream of transactions from a DUT with expected results.
The OVM library provides a base class called ovm_in_order_comparator and two derived classes, which are ovm_in_order_built_in_comparator for comparing streams of built-in types and ovm_in_order_class_comparator for comparing streams of class objects.
The ovm_algorithmic_comparator also compares two streams of transactions; however, the transaction streams might be of different type objects. This device will use a user-written transformation function to convert one type to another before performing a comparison.
Compares two streams of data objects of different types, BEFORE and AFTER.
The algorithmic comparator is a wrapper around ovm_in_order_class_comparator. Like the in-order comparator, the algorithmic comparator compares two streams of transactions, the BEFORE stream and the AFTER stream. It is often the case when two streams of transactions need to be compared that the two streams are in different forms. That is, the type of the BEFORE transaction stream is different than the type of the AFTER transaction stream.
The ovm_algorithmic_comparator’s TRANSFORMER type parameter specifies the class responsible for converting transactions of type BEFORE into those of type AFTER. This transformer class must provide a transform() method with the following prototype:
function AFTER transform (BEFORE b);
Matches and mistmatches are reported in terms of the AFTER transactions. For more information, see the ovm_in_order_comparator #(...) class.
ovm_algorithmic_comparator #(BEFORE,AFTER,TRANSFORMER) | |||||||||||||||||||||||||||
Compares two streams of data objects of different types, BEFORE and AFTER. | |||||||||||||||||||||||||||
Class Hierarchy | |||||||||||||||||||||||||||
| |||||||||||||||||||||||||||
Class Declaration | |||||||||||||||||||||||||||
| |||||||||||||||||||||||||||
Ports | |||||||||||||||||||||||||||
before_export | The export to which a data stream of type BEFORE is sent via a connected analysis port. | ||||||||||||||||||||||||||
after_export | The export to which a data stream of type AFTER is sent via a connected analysis port. | ||||||||||||||||||||||||||
Methods | |||||||||||||||||||||||||||
new | Creates an instance of a specialization of this class. |
The export to which a data stream of type BEFORE is sent via a connected analysis port. Publishers (monitors) can send in an ordered stream of transactions against which the transformed BEFORE transactions will (be compared.
The export to which a data stream of type AFTER is sent via a connected analysis port. Publishers (monitors) can send in an ordered stream of transactions to be transformed and compared to the AFTER transactions.
function new( TRANSFORMER transformer, string name , ovm_component parent )
Creates an instance of a specialization of this class. In addition to the standard ovm_component constructor arguments, name and parent, the constructor takes a handle to a transformer object, which must already be allocated (no null handles) and must implement the transform() method.
The ovm_object class is the base class for all OVM data and hierarchical classes.
virtual class ovm_object extends ovm_void
The ovm_report_object provides an interface to the OVM reporting facility.
class ovm_report_object extends ovm_object
The ovm_component class is the root base class for OVM components.
virtual class ovm_component extends ovm_report_object
Compares two streams of data objects of different types, BEFORE and AFTER.
class ovm_algorithmic_comparator #( type BEFORE = int, type AFTER = int, type TRANSFORMER = int ) extends ovm_component
Creates an instance of a specialization of this class.
function new( TRANSFORMER transformer, string name , ovm_component parent )