module sdcsc;
bit a;
bit b;
covergroup cg;
A: coverpoint a;
B: coverpoint b;
Axb: cross A,b;
endgroup
cg c;
initial
begin
c=new();
a=$urandom;
b=$urandom;
$display("a=%0d b=%0d",a,b);
c.sample();
$display("coverage=%0f",c.get_coverage);
end
endmodule
OUTPUT:
a=0 b=0
coverage=43.750000
In reply to shravan.v:
Since you crossed uppercase A with lowercase b, a third implicit coverpoint gets created for the variable b. Each coverpoint will have 2 bins, and the cross will have 4 bins. So the resulting coverage is
( 1/2 + 1/2 + 1/2 + 1/4 )/ 4 = 0.4375
covergroup cg;
A: coverpoint a;
B: coverpoint b;
AxB: cross A,B;
endgroup
initial
begin
a=0; b=0;
c.sample;
end
Now, what will be the difference before snippet and this snippet. In both, coverage is same.
Can you explain in detail?
In reply to shravan.v:
In both, coverage is same.
Have you tried your 2nd code ?
what will be the difference before snippet and this snippet
In 2nd case resulting coverage is :
( 1/2 + 1/2 + 1/4 )/ 3 = 0.4166