Use $countones system-function
rand bit [31:0] vec_1;
constraint cst_max_2_hot_bits {
$countones(vec_1) inside {1,2};
} // cst_max_2_hot_bits
HTH,
Ajeetha, CVC
Use $countones system-function
rand bit [31:0] vec_1;
constraint cst_max_2_hot_bits {
$countones(vec_1) inside {1,2};
} // cst_max_2_hot_bits
HTH,
Ajeetha, CVC