specmane

Specman UVM: What is the difference between write_reg { .field == 2;}; and write_reg_fields?


I'm working with vr_ad package for e. My question is: What is the difference between 2 following macros for modifying registers (suppose foo register consists of 2 fields: field1 and field2):

1)

write_reg foo {.field1 == 1;};

2)

write_reg_fields foo {.field1 = 1};

I really appreciate any help


Solution

  • There is a very important difference between these forms.

    In the first, the register value will be generated, using all defined constraints, + the constraint you wrote in this action (field1 == 1). The new generated value will be written to the DUT.

    In the second code, what you state is that you want to modify only one field of the register - field1. What will happen is that vr_ad will get the current value of the register from the e model (the shadow model), change field1 - and will write the new value the the register in the DUT. None of the other register's fields will be changed. Also - there is no check that the value you assign to field1 complies with the constraints defined on this register.