Hi ,
I saw the Your text to link here… link for using do_compare.
I am trying to use do_compare and I have a requirement that 1 field in the packet to be compared is a structure but I just need to compare 2 fields in the struct and mask 1 field.Is it possible to do it.
I tried the below code and it fails since the value of depth_cmp_mode is not equal for the predicted and collected output.
Even if I comment the line
//eq&=(idec_utre_sb0[3:0]==tr.idec_utre_sb0[3:0]);
//eq&=(idec_utre_sb0[7]==tr.idec_utre_sb0[7]);
still the code fails with the error.I am not clear why the code fails though the idec_utre_scissor is exactly same.
typedef struct packed {
logic depth_write_disable;
logic[2:0] depth_cmp_mode;
logic[2:0] stencil_reference;
}isp_facestate_struct;
typedef struct packed {
isp_facestate_struct facestate;
logic dfb_enable_depth_test;
}isp_sideband0_struct;
typedef struct packed {
logic[15:0] ymax;
}isp_scissor_struct;
class definition:
class isp_idec_utre_packet extends uvm_sequence_item;
isp_scissor_struct idec_utre_scissor ;
isp_sideband0_struct idec_utre_sb0 ;
`uvm_object_utils_begin(isp_idec_utre_packet)
`uvm_field_int(idec_utre_scissor , UVM_DEFAULT)
`uvm_field_int(idec_utre_sb0 , UVM_DEFAULT)
`uvm_object_utils_end
function new(string name = "isp_idec_utre_packet");
super.new(name);
endfunction: new
function bit do_compare(uvm_object rhs, uvm_comparer comparer);
isp_idec_utre_packet tr;
bit eq;
if(!$cast(tr, rhs)) `uvm_fatal("isp_idec_utre_packet", "ILLEGAL do_compare() cast")
eq = super.do_compare(rhs, comparer);
eq&=(idec_utre_scissor==tr.idec_utre_scissor);
eq&=(idec_utre_sb0[3:0]==tr.idec_utre_sb0[3:0]);
eq&=(idec_utre_sb0[7]==tr.idec_utre_sb0[7]);
return(eq);
endfunction: do_compare
endclass: isp_idec_utre_packet
In the scoreboard I am calling the compare function:
if (collected_packet.compare(predicted_packet)==0) begin
report = {"Mismatch between collected and predicted idec utre packet\n",
collected_packet.sprint(),predicted_packet.sprint()};
`uvm_error("idec_utre_mismatch",report);
end