chenyong Posted May 8, 2012 Report Share Posted May 8, 2012 Hi, from UVM examples on codec, I found some code for register model access like this: if (!regmodel.RxStatus.Align.get()) begin regmodel.IntMask.set('h000); regmodel.IntMask.SA.set('b1); regmodel.IntMask.update(status); ... end ... 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, regmodel.IntMask.set('h00f); regmodel.IntMask.update(status); 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? thanks Quote Link to comment Share on other sites More sharing options...
janick Posted May 14, 2012 Report Share Posted May 14, 2012 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. Quote Link to comment Share on other sites More sharing options...
chenyong Posted May 17, 2012 Author Report Share Posted May 17, 2012 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. Quote Link to comment Share on other sites More sharing options...
janick Posted May 17, 2012 Report Share Posted May 17, 2012 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. Quote Link to comment Share on other sites More sharing options...
chenyong Posted May 18, 2012 Author Report Share Posted May 18, 2012 thanks for your kind reply Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.