Tutorials COVERAGE BINS

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};

covergroup cg;
cover_point_y : coverpoint y
{ option.auto_bin_max = 4 ; }
endgroup

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 for 0 and 1
Bin for 2 and 3
Bin for 4 and 5
Bin for 6 and 7

Varible Y is assigned values 3,5 and 6. Values 3,5 and 6 belongs to bins bin,bin and bin respectively. Bin is not covered.

Coverage report:
--------------------
VARIABLE : cover_point_y
Expected : 4
Covered : 3
Percent: 75.00

Uncovered bins
------------------
auto[0:1]

Covered bins
------------------
auto[2:3]
auto[4:5]
auto[6:7]

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.

typedef enum { A,B,C,D } alpha;
program main;
alpha y;
alpha values[\$]= '{A,B,C};

covergroup cg;
cover_point_y : coverpoint y;
endgroup

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.

Coverage report:
---------------------
VARIABLE : cover_point_y
Expected : 4
Covered : 3
Percent: 75.00

Uncovered bins
--------------------
auto_D

Covered bins
--------------------
auto_C
auto_B
auto_A

 << PREVIOUS PAGE TOP NEXT PAGE >> 