class my_classe extends uvm_object;
rand int unsigned port_idx;
rand int unsigned port_num;
endclass
and in my test I have :
rand my_classe ex_class[6]
and I want this array of classes (ex_class) to be generated in a way that all the port_idx fields in all the classes are unique - The port_idx in ex_class[0] is not the same as in ex_class[1,2,3,4,5] and so on,
And I don’t want to use other arrays for the generation, just the “unique” property.
How should I write such a constraint? Is it possible to use the unique constraint when it is not the case of an array of native types (bit, int…)
In reply to snognog:
The unique constraint requires a list of integral values, or arrays of integral values. If you insist on using the unique constraint, then the only way do do this is listing the elements individually.