Systemverilog constraint on a enum type

In reply to sharvil111:

You can also convert the expression to integral by writing

constraint subset_c {foreach(subset) subset[I] inside {[15 * num_fruits[I]/100 : 75 * num_fruits[I]/100]}; }

But another problem is you are not allowed to use a random variable as an array select

fruit_num_array[fruits[j]]

cannot be used. You’ll need to nest another foreach (fruit_num_array[k])