I am trying to write a task as shown below. the variable count is decreased each time in the while loop but when we jump out this loop, the variable count is not zero, May I know how to handle it ?
task read_check(logic [19:0] addr, output logic [31:0] rd_data, input logic [31:0] expect_data, uint32 count);
if(rd_data != expect_data) begin
`uvm_info(get_type_name(), "not matched now", UVM_LOW);
`uvm_info(get_type_name(), "matched!", UVM_LOW);
if(count == 0) begin // <== I thought it should be zero but it isn't...
`uvm_error(get_type_name(), "finally NOT MATCHED");