In reply to dave_59:
Thanks Dave, it helped.
Tried a simple example. might be helpful others.
Dave, correct me if anything wrong in the usage.
class x;
int y;
endclass
covergroup x2 (ref x z1);
option.per_instance = 1;
coverpoint z1.y {
bins x1 = {3};
}
endgroup
class cg;
x t;
x2 t1,t2;
function new ();
t=new();
t1 = new(t);
t2 = new(t);
fork
call();
join_none
endfunction
task call ();
int cnt ;
repeat (40) begin
t.y = cnt;
if (cnt [0]) t1.sample();
if (!cnt [0]) t2.sample();
cnt = cnt +1;
#10;
$display (“sample \n”);
end
endtask
endclass
module tb;
cg q1;
initial begin
q1 = new();
#10000;
$finish;
$display (“done”);
end
endmodule