Constrain random variable result to enumerated type

In reply to ben@SystemVerilog.us:

Is the solve set before inst really necessary? Maybe in some cases you actually want to constraint inst to a certain value. Having the order constraint will make it more verbose. You’ll need:


obj.randomize() with { set == SET1; inst == 1 };

to choose a value of one for inst, instead of


obj.randomize() with { inst == 1 };

if you wouldn’t have a solve order defined.