Hi,
I’m using set_check_on_read(1) approach to compare the default registers read value, and for registers wr/rd comparison.
But, for few registers, my requirement is as follows:
FIELD1 8 DEF=0x0 RW
FIELD2 7 DEF=0x0 RW
FIELD3 6:5 DEF=0x0 RO NO_CSR_W_TEST
FIELD4 4:3 DEF=0x0 RO NO_CSR_W_TEST
FIELD5 2:1 DEF=0x0 RO NO_CSR_W_TEST
FIELD6 0 DEF=0x0 RW
- As mentioned above, I need to write into RW reg fields only for few registers(but not into RO fields). So, instead of writing into complete register using : reg_model.reg_name.write(status, .value, .parent(this));
, I’m thinking of using the below syntax to write into RW fields only for those registers.
reg_model.Reg_name.field_name.set(value);
reg_model.Reg_name.field_name.update(status);
Is it OKAY? Can anyone please confirm?
Or else if there is any other alternative approach, could you please let me know?
-
I want to skip register comparison for those few RO fields (NO_CSR_W_TEST) for few registers. For that, I’ve tried with the below syntax example:
rg = model.get_reg_by_name("ureg2");
fld = rg.get_field_by_name("f1");
old_check_setting = fld.get_compare();
// Disable checking on that field
fld.set_compare(UVM_NO_CHECK);
I’ve tried some examples using that approach. But it didn’t work, but my complete register is getting compared with the desired value (like as-usual) for all registers in my reg model.
I want to skip comparing those few reg fields in a register. Can anyone please guide me in this regard?
Thanks for the reply Dave.
I’ll try this approach for my 2nd question.
For my 1st question : Can I proceed with .set & .update to write into specific fields only (instead of complete register using .write) ?
It’s been a while for me, but I think you can set() the individual fields, and then do a single update() the to register.
But you can also use the common write and read for register fields. These methods are also defined on fields.
Thanks Dave & chr_sue. I’ll check them.
Hi Dave,
I’m writing into DUT registers using UVM RAL. I’m using get_registers approach & using foreach to write/read from all registers. But the address offset is in random manner. I want to write in incremental address offset manner.
Ex: 0,4,8,c …
if any address offset is not present in reg model, it should goto next available offset.
Could you please provide me any snippet for this…
It is an essential benefit of the UVM RAL thgat it is not dealing with register names rather than addreesses. This allows you to modify the address until the last minutes of your verification process. And accessing your registers in a random order increases the verification quality. I believe it is not a good idea to access your registers in ordered addresses.
But if you want to do so you can use the functions get_address and get_addresses. See the UVM Standard for more details.
Thanks for the comment chr_sue.
As per earlier comment from Dave in another post: get_registers() by default doesn’t get addresses in incremental offset manner.
But, in one of our scenarios, we are supposed to do incremental reg wr/rd bit bash test.
Could you please provide any snippet for that.
The method get_addresses
stores all addresses found in a dynamic array or a queue.
You can use to order the addresses in ascending order by calling the sort() method on this array/queue:
uvm_reg_addr_t addr[$];
uvm_reg_addr_t addr_asc[$];
get_addresses (addr);
addr_asc = addr.sort();
// addresses in ascending order