Jump to content
Sign in to follow this  
balasubramanian.g@pmcs.com

Can we perform UVM_REG read/write access based on Address?

Recommended Posts

Hi there

 

From the UVM users guide, a register read access can be executed as

 

  reg_model.BLK1.REG_FILE1.REG_1.read(status, rdata);

 

But this mandates us to know the hierarchy of the register instantiation.

ie., 'reg_model.BLK1.REG_FILE1' needs to be known to execute a read on register 'REG_1'.

 

Is it possible to perform read/write access based on address instead of this hierarchy?

Something like:

 

generic_uvm_read (.address(0x0), rdata);

 

In otherwords, we need not even know the register type or register instantiation hierarchy to issue a read access to that register.

 

Can this be performed with UVM_REG?

Requesting thoughts here.

 

Best regards

Balasubramanian G

 

Share this post


Link to post
Share on other sites

hi,

 

if you just want a low-level raw access why not to send that (address,direction,data) tuple directly to the low level sequencer. if you want a register/memory why not use uvm_reg_map::get_reg_by_offset() or uvm_reg_map::get_mem_by_offset() and then perform the read/write on the one returned.

 

btw: there might be some pitfalls such as requesting a register from an address which is not a registers base address or similar

 

regards

/uwe

Share this post


Link to post
Share on other sites

You can get the register that is defined at a specific offset using the get_reg_by_offset() method of the register map. Have a look in the class reference for more details.

 

Note: a big point of using the register access layer is that you don't care at what address a register is defined. This future-proofs your stimulus/checking code, should the offsets change. Have a look at get_reg_by_name() in uvm_reg_block. This allows you to get a register inside a block (hierarchically) without knowing the exact hierarchical path. It takes a string argument, so changing the register name won't break the compile (you have to take care of this at run time), but it's a good compromise (better than hardcoding address values).

Share this post


Link to post
Share on other sites

Thanks Tudor/Uwe,

 

get_reg_by_offset and get_reg_by_name methods aids in accessing registers based on address.

 

We see benefit in accessing registers by name as well as address.

Writing workaround source code to compute a register address using get_reg_by_offset and get_reg_by_name methods and exception handling cases manually looks tedious. This could well be handled inside UVM package itself. It would save user efforts to perform the calculation and manupulation in user environment.

'Register read using address' is an ease of use method/feature which can be easily enhanced in UVM package itself. (If this cannot be implemented, that's fine, a workaround exists, atleast)

 

Best regards

Balasubramanian G

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...