How do I constrain data within hierarchy at test level?

In reply to Dragewood:

Instead of trying to manage the constraints explicitly, it would be easier to override data from the factory.

Incidentally, I think you have one too many layers of hierarchy. I see no benefit in declaring data as a separate object rather than just putting value directly into the sequence item:


class my_transaction extends uvm_sequence_item;
rand bit [15:0] value;
`uvm_object_utils_begin(my_transaction)
`uvm_field_object(data_obj, UVM_ALL_ON)
`uvm_object_utils_end
endclass

And I’ll once again admonish you not to use the field macros.