[source]

Class uvm_comparer

uvm_pkg::uvm_comparer + abstract : bit + check_type : bit + compare_map[uvm_object] : uvm_object + depth : int + miscompares : string + physical : bit + policy : uvm_recursion_policy_enum + result : int unsigned + scope : uvm_scope_stack + sev : uvm_severity + show_max : int unsigned + verbosity : int unsigned + compare_field(): bit + compare_field_int(): bit + compare_field_real(): bit + compare_object(): bit + compare_string(): bit + init(): uvm_comparer + print_msg(): void + print_msg_object(): void + print_rollup(): void uvm_pkg::uvm_object uvm_pkg::uvm_scope_stack compare_map[] scope

Collaboration Diagram of uvm_comparer

The uvm_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 uvm_object::compare and uvm_object::do_compare methods are passed a uvm_comparer policy object.

Variables

Name

Type

Description

policy

uvm_recursion_policy_enum

Determines whether comparison is UVM_DEEP, UVM_REFERENCE, or UVM_SHALLOW.

show_max

int unsigned

Sets the maximum number of messages to send to the printer for miscompares of an object.

verbosity

int unsigned

Sets the verbosity for printed messages.

The verbosity setting is used by the messaging mechanism to determine whether messages should be suppressed or shown.

sev

uvm_severity

Sets the severity for printed messages.

The severity setting is used by the messaging mechanism for printing and filtering messages.

miscompares

string

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.

physical

bit

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 uvm_object::do_compare method, to test the setting of this field if you want to use the physical trait as a filter.

abstract

bit

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 uvm_object::do_compare method, to test the setting of this field if you want to use the abstract trait as a filter.

check_type

bit

This bit determines whether the type, given by uvm_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.

result

int unsigned

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.

depth

int

current depth of objects

compare_map

uvm_object

scope

uvm_scope_stack

Functions

virtual function bit compare_field ( string name, uvm_bitstream_t lhs, uvm_bitstream_t rhs, int size, uvm_radix_enum radix ) [source]

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, uvm_integral_t lhs, uvm_integral_t rhs, int size, uvm_radix_enum radix ) [source]

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 ) [source]

This method is the same as compare_field except that the arguments are real numbers.

virtual function bit compare_object ( string name, uvm_object lhs, uvm_object rhs ) [source]

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 ) [source]

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.

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.

Need this function because sformat doesn't support objects

print_msg_object

static function uvm_comparer init ( ) [source]

init ??