In reply to Anudeep J:
$countones takes any bit-stream type which includes unpacked arrays of bits. The problem is you can’t reference an unpacked array in a constraint expression without using a foreach or array reduction construct. Try this
constraint c{my_mixed_array.sum() with ($countones(item)) <100;}