module def_cov_point;
class trx;
rand bit [2:0]a;
rand bit [3:0]b;
endclass
covergroup c;
ADDRESS : coverpoint tr.a+tr.b{
// This should create 11 bins
bins low[] = {[0:10]};
// This should create 10 bins
bins med[] = {[11:20]};
}
endgroup
trx tr;
c c1;
initial begin
tr = new;
c1 = new;
repeat(10) begin
tr.randomize();
c1.sample();
end
end
endmodule
here in this code, onlky 15 bins are getting created why not 20 bins as specified in code?
bins med= [{11:20}]; will create bins from [{11:15}] bins 16,17,18,19,20 are eliminated because your 4bit output can not hold values of 16,17,18,19,20.
bins low={[0:11]} // this will create 11 bins 0 to 10
bins med=[{11:20}] // this will create 5 bins 11 to 15
i am adding a 3 bit number and a 4 bit number, so effective number of bins will be 16.but adding a 4 bit and 3 bit number may result in 5 bit number (Eg: 15+8 = 23 which is maximum possible result)
So i need to create 23 bins
So bins len = {[0:22]}
can be used to create 23 bins
Is this Correct?
*In reply to rakesh reddy:*Except that according to the 1800-2012 LRM table 11-21, the length of a + b is max(L(a),L(b)) in a self-determined context. You need to write
ADDRESS : coverpoint 5'(tr.a+tr.b) {
// This should create 11 bins
bins low[] = {[0:10]};
// This should create 10 bins
bins med[] = {[11:20]};
}
In the example above, the first
bins
construct associates bin awith the values of variable v_abetween 0 and63, and the value 65. The second binsconstruct creates a set of 65 bins b[127], b[128],…b[191]. Like-wise, the third bins construct creates 3 bins: c[200], c[201], and c[202].
The fourth bins construct asso-ciates bin d with the values between 1000 and 1023 ($ represents the maximum value of v_a).
Every value thatdoes not match bins a, b, c, or d
is added into its own distinct bin
In this way i also want to create 23 bins but it is not happening
module def_cov_point;
class trx;
rand bit [2:0]a;
rand bit [3:0]b;
endclass
covergroup c;
ADDRESS : coverpoint tr.a+tr.b{
// This should create 11 bins
bins low[] = {[0:10]};
// This should create 10 bins
bins med[] = {[11:20]};
}
endgroup
trx tr;
c c1;
initial begin
tr = new;
c1 = new;
repeat(10) begin
tr.randomize();
c1.sample();
end
end
endmodule