How to override the parent's data's attribute specified by `ovm_filed_int from the child

Hi all,

I define two ovm transaction items, one inherits from the other, like the following:

class PARENT extends ovm_sequence_item;
int data_0;
int data_1;

ovm_object_utils_begin(PARENT ) ovm_field_int(data_0, OVM_ALL_ON)
ovm_field_int(data_1, OVM_ALL_ON)
`ovm_object_utils_end

endclass

class CHILD extends PARENT;
int data_3;

ovm_object_utils_begin(CHILED) ovm_field_int(data_0, OVM_ALL_ON+OVM_NOPACK) //DOES NOT OVERRIDE
ovm_field_int(data_1, OVM_ALL_ON+OVM_NOPACK)//DOES NOT OVERRIDE ovm_field_int(data_3, OVM_ALL_ON+OVM_NOPACK) //THIS WORKS
`ovm_object_utils_end


endclass

My intention is to exclude the auto pack from the data_0, data_1 which were originally defined in the PARENT class. I tried to do it as that in the CHILD class. But it doesn’t work as expected, which means data_0 and data_1 are still automatically packed/unpacked.

Is there anyone who knows the solution for this?

Thanks in advance !

Xinwei

We strongly discourage the use of ovm_field macros because of a multitude of limitations and performance issues. See MacroCostBenefit | Verification Academy

The coded added by the macros to do pack/unpack macros is probably the most inefficient code there is in the OVM. See the example in the appnote for suggestions on how to recode this.