Why the call back post_predict is not call if you try to predict a register field with UVM_PREDICT_DIRECT?

In reply to richard_lam:

You could extend uvm_reg_field::do_predict(…) in an own subclass of uvm_reg_field and then set instance overrides on the appropriate fields. This will only work if you created your fields with the factory and with unique contexts, i.e. some_field = uvm_reg_field::type_id::create(“some_field”, null, get_full_name());.

A pragmatic solution would be to attach the callback to your mask fields and to call its post_predict(…) manually wherever you predict the value of your int fields:


some_int.predict(value);
reg_update_upper_interrupt_cb.post_predict(..., .kind(UVM_PREDICT_DIRECT), ...);

You’d need as many calls as you have calls to predict(…). This is something you can wrap in a function:


function void predict_interrupt(uvm_reg_field int_field, uvm_reg_data_t value);
  int_field.predict(value);
  reg_update_upper_interrupt_cb.post_predict(..., .kind(UVM_PREDICT_DIRECT), ...);
endfunction