Skipping a register field from comparison with RAL

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

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

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

It’s not easy in the UVM. See Theory vs. Practice - Reserved Fields in UVM RAL | Verification Gentleman Blog

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.