In reply to Tudor Timi:
ben,
if(!my_class.randomize()) $error; // <-- Use this
// my_class.randomize(); // Instead of this
Yup, was lazy ;)
constraint ct_inst { set==SET1 -> inst inside {[0:2]};
set==SET2 -> inst inside {[34:36]};
set==SET3 -> inst inside {[114:116]};}
The only problem being that in my real application the numbers are not simple series, and I don’t want repeat the numbers in the constraint, I only want them specified in one place, the enumerated type definition. (no magic numbers)
It would be nice to simply say “inst inside set1_inst_list”, but alas, it’s not an actual array.
But, yes I am using an implication operator, the only difference is I created random variables of the enumerated type, and then use those the constraints. (see my link below)
Tudor,
I don’t believe the order constraint is necessary. It seems to have no effect; not even on running…
obj.randomize() with { set == SET1; inst == 1 };
vs
obj.randomize() with { inst == 1 };
So I removed it.
my current solution is: EDA
For the life of me, I don’t understand why the implication operator → works for the case of
obj.randomize() with { inst == 1 };
It seems as though the instruction would be 1, but the set would be random. (the implication is not bidirectional)
However, the set always matches up correctly (SET1 in this case).
I would have expected it to only work with the bidirectional operator <->.
Thoughts?