当您调用 Predict 函数时,它会调用 do_predict()。如果寄存器忙,请进行预测检查。如果发现寄存器忙,do_predict() 将不会执行预测操作。
因此,用户必须检查 predict() 函数的返回值以检查操作是否成功完成
对于 SUCCESS,Predict 返回 1,对于 UN_SUCCESSFUL 操作返回 0
您可以编写如下内容,以确保完成预测操作
while (! (REGISTER.predict(<value>)));
OR
Declare a standard task something like the following, and call it whenever you need
task dac_reg_base_seq::predict_register(uvm_reg REGISTER, bit [31:0] predict_value );
uvm_reg register_temp;
predict_register = 0; //Unsuccessful
if (!$cast(register_temp, REGISTER))
begin
`uvm_fatal("NOT_UVM_REG_TYPE","Provided REGISTER is not of the correct type")
end
`uvm_info("PREDICT_REGISTER", $psprintf(" Starting the predict function setting register %s with value %h", register_temp.get_name(),predict_value), UVM_HIGH);
while(1) begin
if(register_temp.is_busy == 1) begin
`uvm_info("PREDICT_REGISTER", $psprintf(" register %s is busy ", register_temp.get_name()), UVM_HIGH);
// Adding Delay to avoid simulater gets locked up here
#1;
continue;
end
else begin
register_temp.predict(register_temp.get()| predict_value);
break;
end
end
`uvm_info("PREDICT_REGISTER", $psprintf(" Done with updating the predict value to the register %s", register_temp.get_name()), UVM_HIGH);
endtask : predict_register