In reply to suniljasthi:
Lets assume you have to update two registers with predict in a function.
For completeness, lets assume that the prediction of those two registers must be done for any register access in a reg_block.
virtual function void custom_field_predict(uvm_reg_field m_field=null, uvm_reg_data_t value);
if ((m_field!=null)) begin
fork
automatic uvm_reg_field m_field_fork=m_field;
automatic uvm_reg_data_t value_fork =value;
begin
automatic uvm_reg m_reg_fork=m_field_fork.get_parent();
if (m_reg_fork.is_busy()) begin
wait(!m_reg_fork.m_is_busy);
end
assert( m_field_fork.predict(value_fork)) else `uvm_error( "pve_reg_predict", $sformatf( "The register with name:%s and field %s cannot be predicted correctly.",m_reg_fork.get_name(),m_field_fork.get_name() ) );
end
join_none
end
endfunction
As you can see, we use regblock to access the register we want to predict and we use register item to identify if we are going to have collision by predicting a register that is currently being accessed in reg.
I use “wait” instead of a “while” construct because we don´t have to put a fixed #1 time delay.
Notice that i use a fork inside a function so that we can use this function inside other functions. e.g. do_predict() overwrite in a custom register class.
Another elegant solution is just to hack in the busy functionality of UVM.
If you are interested to do the direct prediction ignoring the busy flag, then you can just force the busy flag to go to ZERO.
This is achieved calling ‘Xset_busyX(0)’ before doing the prediction. This has the advantage that you will not have the warning from the busy check. However, ignoring the busy flag means that you may have mismatches between frontdoor DUT output and your predicted value. This depends on the time of the update and the taken value for the frontdoor READ/WRITE. Therefore, disabling the busy flag is only thought for volatile register that are predicted using a backdoor/spysignal access, so that the register value is always aligned to the intern value of the DUT.
I hope it helps
Best regards,
Jonathan