The ovm_comparer class provides a policy object for doing comparisons. The policies determine how miscompares are treated and counted. Results of a comparison are stored in the comparer object. The ovm_object::compare and ovm_object::do_compare methods are passed an ovm_comparer policy object.
ovm_comparer | ||
The ovm_comparer class provides a policy object for doing comparisons. | ||
Class Declaration | ||
| ||
Variables | ||
policy | Determines whether comparison is OVM_DEEP, OVM_REFERENCE, or OVM_SHALLOW. | |
show_max | Sets the maximum number of messages to send to the messager for miscompares of an object. | |
verbosity | Sets the verbosity for printed messages. | |
sev | Sets the severity for printed messages. | |
miscompares | This string is reset to an empty string when a comparison is started. | |
physical | This bit provides a filtering mechanism for fields. | |
abstract | This bit provides a filtering mechanism for fields. | |
check_type | This bit determines whether the type, given by ovm_object::get_type_name, is used to verify that the types of two objects are the same. | |
result | This bit stores the number of miscompares for a given compare operation. | |
Methods | ||
compare_field | Compares two integral values. | |
compare_field_int | This method is the same as compare_field except that the arguments are small integers, less than or equal to 64 bits. | |
compare_field_real | This method is the same as compare_field except that the arguments are real numbers. | |
compare_object | Compares two class objects using the policy knob to determine whether the comparison should be deep, shallow, or reference. | |
compare_string | Compares two string variables. | |
print_msg | Causes the error count to be incremented and the message, msg, to be appended to the miscompares string (a newline is used to separate messages). |
ovm_recursion_policy_enum policy = OVM_DEFAULT_POLICY
Determines whether comparison is OVM_DEEP, OVM_REFERENCE, or OVM_SHALLOW.
int unsigned show_max = 1
Sets the maximum number of messages to send to the messager for miscompares of an object.
int unsigned verbosity = OVM_LOW
Sets the verbosity for printed messages.
The verbosity setting is used by the messaging mechanism to determine whether messages should be suppressed or shown.
ovm_severity sev = OVM_INFO
Sets the severity for printed messages.
The severity setting is used by the messaging mechanism for printing and filtering messages.
string miscompares = ""
This string is reset to an empty string when a comparison is started.
The string holds the last set of miscompares that occurred during a comparison.
bit physical = 1
This bit provides a filtering mechanism for fields.
The abstract and physical settings allow an object to distinguish between two different classes of fields.
It is up to you, in the ovm_object::do_compare method, to test the setting of this field if you want to use the physical trait as a filter.
bit abstract = 1
This bit provides a filtering mechanism for fields.
The abstract and physical settings allow an object to distinguish between two different classes of fields.
It is up to you, in the ovm_object::do_compare method, to test the setting of this field if you want to use the abstract trait as a filter.
bit check_type = 1
This bit determines whether the type, given by ovm_object::get_type_name, is used to verify that the types of two objects are the same.
This bit is used by the compare_object method. In some cases it is useful to set this to 0 when the two operands are related by inheritance but are different types.
int unsigned result = 0
This bit stores the number of miscompares for a given compare operation. You can use the result to determine the number of miscompares that were found.
virtual function bit compare_field ( string name, ovm_bitstream_t lhs, ovm_bitstream_t rhs, int size, ovm_radix_enum radix = OVM_NORADIX )
Compares two integral values.
The name input is used for purposes of storing and printing a miscompare.
The left-hand-side lhs and right-hand-side rhs objects are the two objects used for comparison.
The size variable indicates the number of bits to compare; size must be less than or equal to 4096.
The radix is used for reporting purposes, the default radix is hex.
virtual function bit compare_field_int ( string name, logic[63:0] lhs, logic[63:0] rhs, int size, ovm_radix_enum radix = OVM_NORADIX )
This method is the same as compare_field except that the arguments are small integers, less than or equal to 64 bits. It is automatically called by compare_field if the operand size is less than or equal to 64.
virtual function bit compare_field_real ( string name, real lhs, real rhs )
This method is the same as compare_field except that the arguments are real numbers.
virtual function bit compare_object ( string name, ovm_object lhs, ovm_object rhs )
Compares two class objects using the policy knob to determine whether the comparison should be deep, shallow, or reference.
The name input is used for purposes of storing and printing a miscompare.
The lhs and rhs objects are the two objects used for comparison.
The check_type determines whether or not to verify the object types match (the return from lhs.get_type_name() matches rhs.get_type_name()).
virtual function bit compare_string ( string name, string lhs, string rhs )
Compares two string variables.
The name input is used for purposes of storing and printing a miscompare.
The lhs and rhs objects are the two objects used for comparison.
function void print_msg ( string msg )
Causes the error count to be incremented and the message, msg, to be appended to the miscompares string (a newline is used to separate messages).
If the message count is less than the show_max setting, then the message is printed to standard-out using the current verbosity and severity settings. See the verbosity and sev variables for more information.
The ovm_comparer class provides a policy object for doing comparisons.
class ovm_comparer
Determines whether comparison is OVM_DEEP, OVM_REFERENCE, or OVM_SHALLOW.
ovm_recursion_policy_enum policy = OVM_DEFAULT_POLICY
Sets the maximum number of messages to send to the messager for miscompares of an object.
int unsigned show_max = 1
Sets the verbosity for printed messages.
int unsigned verbosity = OVM_LOW
Sets the severity for printed messages.
ovm_severity sev = OVM_INFO
This string is reset to an empty string when a comparison is started.
string miscompares = ""
This bit provides a filtering mechanism for fields.
bit physical = 1
This bit provides a filtering mechanism for fields.
bit abstract = 1
This bit determines whether the type, given by ovm_object::get_type_name, is used to verify that the types of two objects are the same.
bit check_type = 1
This function returns the type name of the object, which is typically the type identifier enclosed in quotes.
virtual function string get_type_name ()
This bit stores the number of miscompares for a given compare operation.
int unsigned result = 0
Compares two integral values.
virtual function bit compare_field ( string name, ovm_bitstream_t lhs, ovm_bitstream_t rhs, int size, ovm_radix_enum radix = OVM_NORADIX )
This method is the same as compare_field except that the arguments are small integers, less than or equal to 64 bits.
virtual function bit compare_field_int ( string name, logic[63:0] lhs, logic[63:0] rhs, int size, ovm_radix_enum radix = OVM_NORADIX )
This method is the same as compare_field except that the arguments are real numbers.
virtual function bit compare_field_real ( string name, real lhs, real rhs )
Compares two class objects using the policy knob to determine whether the comparison should be deep, shallow, or reference.
virtual function bit compare_object ( string name, ovm_object lhs, ovm_object rhs )
Compares two string variables.
virtual function bit compare_string ( string name, string lhs, string rhs )
Causes the error count to be incremented and the message, msg, to be appended to the miscompares string (a newline is used to separate messages).
function void print_msg ( string msg )
The compare method deep compares this data object with the object provided in the rhs (right-hand side) argument.
function bit compare ( ovm_object rhs, ovm_comparer comparer = null )
The do_compare method is the user-definable hook called by the compare method.
virtual function bit do_compare ( ovm_object rhs, ovm_comparer comparer )