Jump to content

register access

Recommended Posts


from UVM examples on codec, I found some code for register model access like this:

if (!regmodel.RxStatus.Align.get()) begin







regmodel.IntSrc.write(status, -1);


My questions are:

1) regmodel.IntMask.set('h000) has set the model to 000, why there is a code to set SA field to 'b1 followed? I guess it could be finished by regmodel.IntMask.set('h001), is my guess right?

2) suppose dut is different from register model for IntMask,



will write 'h00f to dut and update register model at the same time with same value, it this correct?

3) In code "regmodel.IntSrc.write(status, -1)", what does "-1" should be? from simulation (incisive/11.10.002) I found value 0x1ff is written to dut, why?


Link to comment
Share on other sites

1) You are correct. But the example is independent of the position of bit "SA". Should it ever move, it won't need to be changed. It's also better documentation!

2) Correct. But the actual DUT update won't happen until update() is called.

3) To get all-1's. it is functionally equivalent to '1.

Link to comment
Share on other sites

thanks for your reply. I still have some questions on it:

1) why you think it is a better documentation? If you move SA to other registers, you still need to change xxx.SA. Or maybe it is the case when you move SA to other registers, you only delete the line and don't need to do any other changes to IntMask. Is my guess correct?

3) I didn't follow you reply. to my understanding, -1 should be represented by all '1', such as 0xffff for 16 bits data. for "simulation (incisive/11.10.002) I found value 0x1ff", I think it should be 0xfff. Can you explain with more detail? thanks.

Link to comment
Share on other sites

1) Of course, if you move SA to another register you have to change (unless you use ralgen and "SA" is a uniquely named field in your block, in which case you can do "myblk.SA.set(1)). I was referring to IntMask.SA.set(1) being better than IntMask.set('h0001).

3) The IntSrc register is probably 9-bits wide. But that's just guess. There are many possible cause for the value to be truncated along the way.

Link to comment
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.

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.

  • Create New...