Jump to content
Sign in to follow this  
shreyasraju

field.mirror() task not working as expected

Recommended Posts

Hi,

 

I wanted to use the field.mirror() task provided in the uvm_reg_field class to check only a particular field. However, I see that the field.mirror() task is just calling the parent register mirror task. Hence the entire register is read and compared which I didn't intend to do. I tried this in my sequence and I see the above mentioned behavior. This looks like a serious bug. Can you please confirm this.

 

Regards,

Shreyas

Share this post


Link to post
Share on other sites

It depends on how your code was built.  You can check the set_compare policy for a field by checking it:

bit model.blk.reg.get_compare()

 

1. If it is set UVM_COMPARE, this will override the UVM_CHECK provided to the mirror.

2. The mirror() call will always use the register/field off of the default_map provided by context when you make the mirror call.  

3. You can change your compare policy on the field right before you make the mirror call and see if that makes any difference.

 

model.blk.reg.fld.set_compare(UVM_NO_COMPARE);

// now that field should not be compared on mirror

mirror(); //arguments to mirror will be different on R/W or check

Share this post


Link to post
Share on other sites

hi,

 

im not clear what the issue is?

 

1. when you invoke mirror on a field - then yes the whole register is accessed UNLESS your bus supports a read of the field slice only. there is just no other way

 

2. is it the issue that the whole register is reg and there is a compare mismatch in other fields of the reg which you didnt want to compare? if that is the case you should disable the compare using UVM_NO_COMPARE

 

? something different ?

//uwe

Share this post


Link to post
Share on other sites

If you are just trying to see if the desired matches the actual, you should use peek() to do a back door access and then compare the value with the results of a get(). There is no significant advantage of having mirror() do the check, and as you observed, mirror() does a front door access of the entire register. That is the purpose of mirror() generally. You might also be able tell mirror to do a back door access by specifying .path(UVM_BACKDOOR) I think, but I have not tried this.

Share this post


Link to post
Share on other sites

Hi uwes,

 

The issue is, I call field.mirror(UVM_CHECK). This should ideally read the field and check only that field with the mirror register field. However, the field.mirror() task is now comparing the entire register with the mirror which I don't want to do. Can you give me a solution to overcome this?

 

Shreyas

Share this post


Link to post
Share on other sites

Hi David,

 

I'm not comparing the desired value. I'm comparing the read back value with the mirror value. The read back and compare is done in the mirror task which is convenient to use. Otherwise I will have to read the register and compare only the field bits, which will require some code to be written.

 

Regards,

Shreyas

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...