uvm_comparer

class uvm.base.uvm_comparer.UVMComparer[source]

Bases: object

The UVMComparer 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 UVMComparer policy object.

compare_field(name, lhs, rhs, size, radix=0)[source]

Function: compare_field

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 (string name,

uvm_bitstream_t lhs, uvm_bitstream_t rhs, int size, uvm_radix_enum radix=UVM_NORADIX);

Parameters
  • name

  • lhs

  • rhs

  • size

  • radix

Returns:

compare_field_int(name, lhs, rhs, size, radix=0)[source]

Function: 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. It is automatically called by compare_field if the operand size is less than or equal to 64.

virtual function bit compare_field_int (string name,

uvm_integral_t lhs, uvm_integral_t rhs, int size, uvm_radix_enum radix=UVM_NORADIX);

Parameters
  • name

  • lhs

  • rhs

  • size

  • radix

Returns:

compare_field_real(name, lhs, rhs)[source]

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

Parameters
  • lhs – First float to compare

  • rhs – Second float to compare

Returns

True if numbers match, False otherwise

Return type

bool

compare_object(name, lhs, 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()~).

Parameters
  • name (str) – Extra info for printing miscompare.

  • lhs (UVMObject) – First object to compare.

  • rhs (UVMObject) – Second object to compare.

Returns

True if objects match, False otherwise.

Return type

bool

compare_string(name, lhs, 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.

Parameters
  • name (str) – Extra info for printing miscompare.

  • lhs (str) – First str to compare.

  • rhs (str) – Second str to compare.

Returns

True if strings match, False otherwise.

Return type

bool

print_msg(msg)[source]

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.

Parameters

msg (str) – Message to print

print_rollup(rhs, lhs)[source]

Internal methods - do not call directly

print_rollup

Need this function because sformat doesn’t support objects

Parameters
  • rhs

  • lhs

print_msg_object(lhs, rhs)[source]
Parameters