I have a question about a cross coverage among multiple covergroups. Below is the example code which I found in a web article[*1].
class A;
rand bit[3:0] var1;
covergroup cgA;
option.per_instance = 1;
coverpoint var1 {
bins each[16] = {[0:$]};
}
endgroup
function new ();
cgA = new;
endfunction
endclass
class B extends A;
rand bit[3:0] var2;
covergroup cgB();
option.per_instance = 1;
coverpoint var2 {
bins all = {[0:$]};
}
cross cgA.var1, var2;
endgroup
function new ();
super.new();
cgB = new;
endfunction
endclass
There is a cross coverage which takes bins from different covergroups:
cross cgA.var1, var2;
for (int i = 0;i < 5; i++) begin
a.randomize();
b.randomize();
$display ("a.var1=0x%0h b.var1=0x%0h b.var2=0x%0h", a.var1, b.var1, b.var2);
a.cgA.sample(); // step 1
b.cgA.sample(); // step 2
b.cgB.sample(); // step 3
end
The sampling timing for cgA and cgB are different in the code.
My question: is it okey to think that the cross coverage is computed when “b.cgB.sample(); // step 3” is executed and the value of cg.A is last sampled value for cgA (i.e. “step 2”)?
I could not find the statement to define as such in LRM.
Regards
[*1] https://www.chipverify.com/blog/inheritance-of-covergroups