0% found this document useful (0 votes)
27 views29 pages

Types of Bins

Uploaded by

Tejal Adake
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views29 pages

Types of Bins

Uploaded by

Tejal Adake
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 29

Types of bins

Eswara prasad
p
Bins
› Bin is something that collects coverage information. Bins
created for cover points.
› Each bin is either single value or multiple set of values.
› When any one of those values in bin is hit ,that bins
treated is covered.
› If bin construct is not used, cover point generates
automatic bins based on the variable size
Ex: bit[3:0] addr; //16 bins created if we not used bin
› bins b1 = {[0:15]};
› if any value hit in between 0 to 15 then b1 bin treated as
covered.
Types of bins
› Bins can be declare in two ways,
1. Implicit bins : max no.of bins automatically created bins
when no bins are explicitly defined for coverpoint.
2. Explicit bins :“bins” keyword is used to declare the bins
explicitly to a variable.

EX: rand bit[11:0] addr;


covergroup cg;
› P1:coverpoint addr;
› How many bins create ?
› class implicit_bins; › module top;
› rand bit[4:0] addr; › implicit_bins s;
› initial begin
› covergroup cg; › s = new();
› P1:coverpoint addr; › assert(s.randomize());
› endgroup › s.cg.sample();
› function new(); › $display("addr
› cg=new(); %0b",s.addr);

› endfunction › end
› endmodule
› endclass
OUTPUT
Types of explicit bins
› Simple bins
› Fixed array of bins
› Dynamic array of bins
› Transition bins
› Wildcard bins
› illegal bins
› Ignore bins
EX
› class coverage;
› rand bit [4:0] addr ;

› covergroup cg;
› P1: coverpoint addr {
› bins b1[] = {3,5,6,7,8,12};//dynamic array of bin
› bins b2[5] = {[15:20]};//fixed array of bin
› bins b3 = {1};//simple bins
› bins b4[] = {[21:$]}; // hereto end
› }
› endgroup
› endclass
Output
› class coverage;
› rand bit [4:0] addr;
› covergroup cg;
› P1: coverpoint addr {
› bins b1[] = {[1:10]};
› bins b2[5] = {[1:10]};
› bins b3[4] = {[1:10]};
› bins b4[3] = {[1:10]};
› bins b5[2] = {[1:10]};
› }
› endgroup
Output
› class coverage; › * Warning: (vsim-8546)
› rand bit [4:0] addr; The number of values
specified '2' is less than
› covergroup cg; the size '3' of fixed-size
› P1: coverpoint addr array bin 'b7' in
{ Coverpoint 'P1' of
Covergroup instance
› bins b6[2] = {[6:8]};
› The '1' empty bins will not
› bins b7[3] = contribute towards
{[9:10]}; coverage
› }
› endgroup
Transition bins
› Transition bins are used to capture transitions from value
to another. We can use this sample for any specific
transition.
› Single value transitions : value1 => value2
› Sequence of transitions : value1 => value2 => value3
› Set of transition : range1 => range2
› Consecutive repetition of transition :
signal_name[*repeat range]
signal_name[*range1:range2] //range

› Nonconsecutive repetition of transition :


signal_name[->repeat_range]
› class trans;
› bit [2:0] addr;

› covergroup cg;
› P1:coverpoint addr{
› bins b1 = (1=>2=>3);
› bins b2[] = (1,4 =>5,6);
› bins b3 = (1=>2=>3=>4=>5=>6=>7);
› bins b4[] = (1=>3,1=>4,2=>3,2=>4);
› bins b6 = (5[*3]);//consecutive repeation operator
› bins b7 = (2[->3]);//non-consecutive repeation operator

› }
› endgroup
Output
Wildcard bins
› We know , a value of bins definition can
specify 4-state values.
› A wildcard bin definition causes all x, z (or) ?
to be treated as wildcards for 0 or 1.
› These are mostly use when we are interested
in some of the bits of the signal and rest can
be don’t care.
› EX: wildcard bins b1 = (3’b11x);
› It will take values of 3’b110 and 3’b111
› module top;
› logic [3:0] addr;
› reg ce;
› covergroup cov_cg@(posedge ce);
› CP : coverpoint addr {
› wildcard bins adr0 = {4'b?11?};
› wildcard bins adr1[] = (4'b?1x0 => 4'bx0?0);
› wildcard bins adr2 = (4'b1x?0 => 4'b?0z0);
› }
› endgroup

OUTPUT
Ignore bins
› Ignore bins are bins which are used to specify the
values that should not be counted for coverage.
› A set of values or transitions associated with a
coverage-point can be explicitly excluded from
coverage by specifying them as ignore bins.
Without ignore_bins

› class coverage;
› rand bit [6:0] addr;
› covergroup cg;
› P1: coverpoint addr;
› endgroup
With ignore bins
› class coverage;
› rand bit [6:0] addr;
› covergroup cg;
› P1: coverpoint addr{
› ignore_bins b1 = {[20:60]};
› }
› endgroup
Illegal bins
› Illegal bins are bins which are used to define
invalid bins.
› If the signal or variable takes this value an error
will be generated.
› A set of values or transitions associated with a
coverage-point can be explicitly excluded from
coverage by specifying them as illegal bins.
Without illegal bins
› class coverage;
› rand bit [4:0] addr;
› covergroup cg;
› P1: coverpoint addr{
› bins b1 = {1,5,8,10};
› bins b3[] = {[12:30]};
› }
› endgroup
With illegal_bins
› class coverage;
› rand bit [4:0] addr;
› covergroup cg;
› P1: coverpoint addr{
› bins b1 = {1,5,8,10};
› bins b3[] = {[12:30]};
› illegal_bins b4 = {12,13,15};
› }
› endgroup
› For the above code,
› ** Error: (vsim-8565) Illegal state bin was hit at
value=12. The bin counter for the illegal bin
‘ill_sv_unit::coverage::cg .P1.b4' is 1.
› ** Error: (vsim-8565) Illegal state bin was hit at
value=12. The bin counter for the illegal bin
'ill_sv_unit::coverage::cg .P1.b4' is 2.
Thank you

You might also like