uvm_comparer¶
- class uvm.base.uvm_comparer.UVMComparer[source]¶
Bases:
objectThe 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
nameinput is used for purposes of storing and printing a miscompare.The left-hand-side
lhsand right-hand-siderhsobjects 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_fieldexcept that the arguments are small integers, less than or equal to 64 bits. It is automatically called bycompare_fieldif 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
- compare_object(name, lhs, rhs)[source]¶
Compares two class objects using the
policyknob 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
lhsandrhsobjects are the two objects used for comparison.The
check_typedetermines whether or not to verify the object types match (the return from ~lhs.get_type_name()~ matches ~rhs.get_type_name()~).
- compare_string(name, lhs, rhs)[source]¶
Compares two string variables.
The
nameinput is used for purposes of storing and printing a miscompare. Thelhsandrhsobjects are the two objects used for comparison.
- print_msg(msg)[source]¶
Causes the error count to be incremented and the message,
msg, to be appended to themiscomparesstring (a newline is used to separate messages).If the message count is less than the
show_maxsetting, then the message is printed to standard-out using the current verbosity and severity settings. See theverbosityandsevvariables for more information.- Parameters
msg (str) – Message to print