|HOME |ABOUT |ARTICLES |ACK |FEEDBACK |TOC |LINKS |BLOG |JOBS |


Tutorials



EXPLICIT BIN CREATION




Explicit bin creation is recommended method. Not all values are interesting or relevant in a cover point, so when the user knows the exact values he is going to cover, he can use explicit bins. You can also name the bins.



program main;
bit [0:2] y;
bit [0:2] values[$]= '{3,5,6};

covergroup cg;
cover_point_y : coverpoint y {
bins a = {0,1};
bins b = {2,3};
bins c = {4,5};
bins d = {6,7};
}

endgroup

cg cg_inst = new();
initial
foreach(values[i])
begin
y = values[i];
cg_inst.sample();
end

endprogram



In the above example, bins are created explicitly. The bins are named a,b,c and d.



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

Uncovered bins
--------------------
a

Covered bins
--------------------
b
c
d



Array Of Bins



To create a separate bin for each value (an array of bins) the square brackets, [], must follow the bin name.



program main;
bit [0:2] y;
bit [0:2] values[$]= '{3,5,6};

covergroup cg;
cover_point_y : coverpoint y {
bins a[] = {[0:7]};
}

endgroup

cg cg_inst = new();
initial
foreach(values[i])
begin
y = values[i];
cg_inst.sample();
end

endprogram


In the above example, bin a is array of 8 bins and each bin associates to one number between 0 to 7.



Coverage report:
--------------------
VARIABLE : cover_point_y
Expected : 8
Covered : 3
Percent: 37.50

Uncovered bins
-------------------
a_0
a_1
a_2
a_4
a_7

Covered bins
-------------------
a_3
a_5
a_6




To create a fixed number of bins for a set of values, a number can be specified inside the square brackets.



program main;
bit [0:3] y;
bit [0:2] values[$]= '{3,5,6};

covergroup cg;
cover_point_y : coverpoint y {
bins a[4] = {[0:7]};
}

endgroup

cg cg_inst = new();
initial
foreach(values[i])
begin
y = values[i];
cg_inst.sample();
end

endprogram



In the above example, variable y is 4 bit width vector. Total possible values for this vector are 16.
But in the cover point bins, we have giving the interested range as 0 to 7. So the coverage report is calculated over the range 0 to 7 only. In this example, we have shown the number bins to be fixed to size 4.



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

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

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



Default Bin



The default specification defines a bin that is associated with none of the defined value bins. The default bin catches the values of the coverage point that do not lie within any of the defined bins. However, the coverage calculation for a coverage point shall not take into account the coverage captured by the default bin.



program main;
bit [0:3] y;
bit [0:2] values[$]= '{3,5,6};

covergroup cg;
cover_point_y : coverpoint y {
bins a[2] = {[0:4]};
bins d = default;
}

endgroup

cg cg_inst = new();
initial
foreach(values[i])
begin
y = values[i];
cg_inst.sample();
end

endprogram



In the above example, we have specified only 2 bins to cover values from 0 to 4. Rest of values are covered in default bin ~Sd~T which is not using in calculating the coverage percentage.



Coverage report:
--------------------
VARIABLE : cover_point_y
Expected : 2
Covered : 1
Percent: 50.00

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

Covered bins
----------------
a[2:4]

Default bin
-----------------
d


Index
Introduction
Cover Group
Sample
Cover Points
Coverpoint Expression
Generic Coverage Groups
Coverage Bins
Explicit Bin Creation
Transition Bins
Wildcard Bins
Ignore Bins
Illegal Bins
Cross Coverage
Coverage Options
Coverage Methods
System Tasks
Cover Property

Report a Bug or Comment on This section - Your input is what keeps Testbench.in improving with time!





<< PREVIOUS PAGE

TOP

NEXT PAGE >>

copyright 2007-2017 :: all rights reserved www.testbench.in::Disclaimer