A coverage-point bin associates a name and a count with a set of values or a sequence of value transitions. If the bin designates a set of values, the count is incremented every time the coverage point matches one of the values in the set. If the bin designates a sequence of value transitions, the count is incremented every time the coverage point matches the entire sequence of value transitions.
Bins can be created implicitly or explicitly.
Implicit Bins
While define cover point, if you do not specify any bins, then Implicit bins are created. The number of bins creating can be controlled by auto_bin_max parameter.
Example for non enum cover point
program main;
bit [0:2] y;
bit [0:2] values[$]= '{3,5,6};
cg cg_inst = new();
initial foreach(values[i])
begin y = values[i];
cg_inst.sample();
end
endprogram
In the above example, the auto_bin_max is declared as 4. So, the total possible values are divided in 4 parts and each part correspoits to one bin.
The total possible values for variable "y" are 8. They are divided in to 4 groups.
Bin[0] for 0 and 1 Bin[1] for 2 and 3 Bin[2] for 4 and 5 Bin[3] for 6 and 7
Varible Y is assigned values 3,5 and 6. Values 3,5 and 6 belongs to bins bin[1],bin[2] and bin[3] respectively. Bin[0] is not covered.
Example of enum data type:
For Enum data type, the numbers of bins are equal to the number of elements of enum data type. The bin identifiers are the enum member name.
cg cg_inst = new();
initial foreach(values[i])
begin y = values[i];
cg_inst.sample();
end
endprogram
In The above example, the variable "y" is enum data type and it can have 4 enum members A,B,C and D. Variable Y is assigned only 3 Enum members A,B and C.