Jump to content
Sign in to follow this  
lisakb1963

Examples of when to use Access APIs for UVM_REG

Recommended Posts

Experts,

I understand basic Read and Write API (FRONTDOOR/BACKDOOR)

I understand why we need update() and mirror() -- for the SV Randomize.

Why would we want the get() and set() that just modifies the desired value. Under what circumstances is it desirable to use these?

Share this post


Link to post
Share on other sites

Hello,

get() and set() are used to modify the register model directly instead of doing something like reg_model.block.reg.field=1. (which I don't think you can do anyway because they should be protected).

This might be used when your testbench can predict the value of a register field based on what is happening in the testbench. For example. An interrupt status register may be a read-only register. And if you want to read that register and do a real check of the value, you would have to identify that an interrupt occurred in your testbench – and then update that desired value directly. This is how you would do it. I guess it is used to update a register in the register model when it is modified by the DUT (instead of by generating stimulus).

I hope this helps!

Kathleen

Share this post


Link to post
Share on other sites

What Kathleen describes is the predict() method.

The set()/get() is used when you want to do batch updates. Instead of causing a write/read operation every time to need to set or read a register, you can set its desired value or get its mirrored value in zero-time, then batch-update the model only for those values that have changed.

So you have the choice of two use models: read-write-read-write or mirror-get-set-get-set-update

Share this post


Link to post
Share on other sites

Hi Janick,

How would I know I want to use batch updates? I am assuming based on comments --- that this is related to DUT changing registers. This would be part of the monitor activity of a variety of DUT changing registers (Counters, Interrupts, One register action reflecting another .... ). The documentation is a little skimpy on this in the UG (It only shows a hard-coded path). I always have to use a hard RTL path and I want to leverage the Register Model -- it does know the backdoor path. But I cannot pass it in to wait_for_change because it's a string , not an uvm_object. What I really want to know is the Accellera use model of dealing with DUT changing registers.

Reading back on your answer. I am asking a separate question here -- unrelated to the use model of get/set -- Sorry.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×