Recently I came across a scenario where the variable width is 256 bits so I have tried to take coverage of that variable by declaring bins as follows:
bins qrnb_mask = {{[ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_0000_0000_0000_0000:ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff]};}
But in coverage report, the coverage is not getting generated for the cover point.
In reply to Subhra Bera:
Realize that the auto_bin_max default is 64 bins, so this is the same as specifying
coverpoint my_variable[127:122] iff (my_variable[255:128] == '1);
Is that what you really want do?
In reply to dave_59:
Hi, Dave could you please elaborate? I know that if we do not define explicit bins the number of automatic bins gets created. In my case, I have coded in the following way:
covergroup QRNB;
option.per_instance=1;
mask_coverpoint:coverpoint qrnb_mask bins qrnb_mask [] = {{[ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_0000_0000_0000_0000 : ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff]};}
endgroup
In this above range no bins getting generated.
In reply to Subhra Bera:
How many bins are you expecting to see generated? What are the value ranges you expect for each generated bin?
In reply to dave_59:
In this case, I was expecting 2^64 bins which are too huge to calculate for the tool. This is what I understood. Correct me if I’m wrong. Values of bins I was expecting as follows:
qrnb_mask[0]=ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_0000_0000_0000_0000 ,
qrnb_mask[1]=ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_0000_0000_0000_0001 ,
qrnb_mask[2]=ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_0000_0000_0000_0002 ,
qrnb_mask[3]=ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_0000_0000_0000_0003 ,
.
.
.
.
qrnb_mask[F]=ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_0000_0000_0000_000F ,
.
.
.
qrnb_mask[FFFF_FFFF_FFFF_FFFF]=ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_FFFF_FFFF_FFFF_FFFF ,
In reply to Subhra Bera:
Hi, I wrote a simple test bench based on the suggestions by dave and the idea was to refute your observations that “coverage is not getting generated for the cover point”. I found the values are covered.
But I am not sure if coding 2^64 bins is a pragmatic approach. Rather divide values in pre-defined ranges based on constrained stimulus generated.
module test();
class cov;
bit [255:0] qrnb_mask ;
event e;
covergroup QRNB @(e.triggered);
option.per_instance=1;
CP_qrnb_mask : coverpoint qrnb_mask [63:0] iff (qrnb_mask [255:64] == '1) {
bins qrnb_mask_b = {[64'h0 : 64'hffff_ffff_ffff_ffff]};
}
endgroup : QRNB
function new();
QRNB = new();
endfunction : new
endclass : cov
cov c;
initial begin
c = new();
std::randomize(c.qrnb_mask) with {c.qrnb_mask [255:64] == '1;};
$display("qrnb_mask = %0h",c.qrnb_mask);
->c.e;
end
endmodule
Results:
CLASS - work.test/\test cov \
SUMMARY
=============================================
| Coverage Type | Weight | Hits/Total |
=============================================
| Covergroup Coverage | 1 | 100.000% |
|---------------------|--------|------------|
| Types | | 1 / 1 |
=============================================
WEIGHTED AVERAGE: 100.000%
COVERGROUP COVERAGE
=======================================================================
| Covergroup | Hits | Goal / | Status |
| | | At Least | |
=======================================================================
| TYPE /test/cov/QRNB | 100.000% | 100.000% | Covered |
=======================================================================
| INSTANCE <UNNAMED1> | 100.000% | 100.000% | Covered |
|-------------------------------------|----------|----------|---------|
| COVERPOINT <UNNAMED1>::CP_qrnb_mask | 100.000% | 100.000% | Covered |
|-------------------------------------|----------|----------|---------|
| bin qrnb_mask_b | 1 | 1 | Covered |
=======================================================================