"hot bit" randomization

In reply to ajeetha:

Hi Ajeetha,

I like your solution, even if it only runs on Questa at the moment!
However, using an inside constraint will give a value with 2 bits set to 1, most of the time (presumably because the constraint solver has to pick a value for vec_1 before calling $countones and there are many more combinations of vec_1 with 2 bits set than just one).

An alternative constraint to overcome that problem would be to use dist instead:

constraint cdist {$countones(vec_1) dist{1:=90, 2:=10};}

to give a value with only 1 bit set to 1 approximately 90% of the time.

Regards,
Dave