UVM Compare method does not give all mismatches

Hey there, hope you are all doing well. I’m starting UVM and practicing on it. I’m having a rather odd problem that when I use compare method to check for mismatches, it always gives only single mismatch. Although, when I print the 2 classes, there are several mismatches. Here is the code that I’m using for defining the macros:


`uvm_object_utils_begin( yapp_packet )
    `uvm_field_array_int( payload, UVM_ALL_ON | UVM_BIN )  
    `uvm_field_int( parity, UVM_ALL_ON | UVM_BIN )
    `uvm_field_int( addr, UVM_ALL_ON | UVM_BIN )
    `uvm_field_int( length, UVM_ALL_ON | UVM_DEC )
    `uvm_field_enum( parity_t, parity_type, UVM_ALL_ON | UVM_BIN)
    `uvm_field_int( packet_delay, UVM_ALL_ON | UVM_DEC | UVM_NOCOMPARE)    
`uvm_object_utils_end

and here is the output:


COPY
-----------------------------------------------
Name            Type          Size  Value      
-----------------------------------------------
copy_packet     yapp_packet   -     @2585      
  payload       da(integral)  3     -          
    [0]         integral      8     'b10111    
    [1]         integral      8     'b10001011 
    [2]         integral      8     'b10001001 
  parity        integral      8     'b11000    
  addr          integral      2     'b1        
  length        integral      8     'd3        
  parity_type   parity_t      32    GOOD_PARITY
  packet_delay  integral      32    'd4        
-----------------------------------------------

Randomized
-----------------------------------------------
Name            Type          Size  Value      
-----------------------------------------------
packet          yapp_packet   -     @2618      
  payload       da(integral)  3     -          
    [0]         integral      8     'b1011000  
    [1]         integral      8     'b11101111 
    [2]         integral      8     'b1001     
  parity        integral      8     'b10110000 
  addr          integral      2     'b10       
  length        integral      8     'd3        
  parity_type   parity_t      32    GOOD_PARITY
  packet_delay  integral      32    'd17       
-----------------------------------------------
UVM_INFO @ 0: reporter [MISCMP] Miscompare for copy_packet.payload: 
UVM_INFO @ 0: reporter [MISCMP] 1 Miscompare(s) for object packet@2618 vs. copy_packet@2585
ncsim: *W,RNQUIE: Simulation is complete.

Following is the code that I’m using in tb_top.sv:


$display( "\nCOPY" );
copy_packet.copy( packet );
copy_packet.print();
    
$display( "\nRandomized" );
ok = packet.randomize();  
packet.print();
ok = copy_packet.compare( packet );

In reply to muhammadsalmanafzal:

You are compairing packets and not the single values. If 2 packest are different, this is 1 miscompare independently how many data mebmers are differing.

In reply to chr_sue:

Can you kindly guide me or provide a link to post that can help me elaborate the differences in the single values declared inside the class? I’ll appreciate it.

In reply to muhammadsalmanafzal:

The default compare method leaves the compare after recognizing the first miscon´mpare. Finally it does not make sense to go in to the details after seeing the first mistake. This belongs to the debug