jeudi 7 février 2019

randomizing number of 1's in an array in UVM without using $countones?

In UVM , I want to constraint an array such that I can fix the number of ones in an array to 3, I have written the following code using constraint which uses $countones, but how to do it without using $countones ??

class class_1;
rand bit[31:0] array;

constraint three_ones {
$countones(array) == 3;
}
endclass




Aucun commentaire:

Enregistrer un commentaire