a)Write constraints so that myvec1 has atleast 10 but no more than 18 bits set as 1
b) Also, myvec2 has more than 5 bits that are set to 1 but number of bits that are 1 should be lesser than the number of bits that are 1 in myvec1
rand bit [31:0] myvec1;
rand bit myvec2[32];
constraint c_myvec1 {$countones(myvec1) >9;$countones(myvec1) <18;}
constraint c_myvec2 { int’(myvec2.sum) >5;
int’(myvec2.sum) < $countones(myvec1) } ;
No comments:
Post a Comment