Uvm_reg_sequence "Convenience API"

Looking at the documentation of the uvm_reg_sequence I don’t seem to find any field access API. What is the reason for that? I guess I can still use the usual:

 model.regA.regF.write()

But I was wondering if there was a better way to do that.

In reply to abasili:

Because, each register has address in address map and each field don’t.
And In design also usually we have address based on register ( combination of Fields ) not for individual fields.

Thanks!

In reply to harsh pandya:

Hi Harsh, ,thanks for your answer, but I actually I still don’t get it. The uvm_reg_sequence claims it has a “convenience” API, yet I cannot really see the benefit of using write_reg instead of calling uvm_reg::write().

I do see the advantage of the automatically built in translation sequence to be executed on the reg_sequencer, but can’t seem to find any big advantage with the API it provides.

Maybe you can show me a use case where it would be beneficial?

In reply to abasili:

As, far I know you write_reg will work at register level only ( as it’s argument is uvm_reg rg)
And your understanding is correct. write_reg ultimately calling rg.write method only.
However, normal write is generic method will work at field as well as register level.
That is basic difference between write and write_reg.

And back to the your original question. Why API is not available at field level.
Because, if you use field level write/read you are compromise with “reusability” feature of UVM.


  // Reference UVM_COOKBOOK -> Register-Level Stimulus -> page 328
  
Although the read and write methods can be used at the register and field level, they should only be used at the 
register level to get predictable and reusable results. Field level reads and writes can only work if the field takes up 
and fills the whole of a byte lane when the target bus supports byte level access. Whereas this might work with 
register stimulus written with one bus protocol in mind, if the hardware block is integrated into a sub-system which 
uses a bus protocol that does not support byte enables, then the stimulus may no longer work.

Thanks!