When i am trying to get the coverage of a coverpoint with cg_name.cp_name.get_coverage() it always returns 0 or 100.
To be specific. This dummy coverpoint contains 1 bin and has option.at_least=100.
So i supposed when it has been hitted 50 times shouldn't .get_coverage() return 50% instead of 0?
Simple example:
Shouldn't the cg.cp_signal_high.get_coverage() return 50% when it has been hitted 50/100 times?
module dumb( );
logic signal;
covergroup cg_signal;
option.goal = 100;
cp_signal_high: coverpoint signal {
option.at_least = 100;
bins set = {1};
}
cp_signal_low: coverpoint signal {
option.at_least = 100;
bins unset = {0};
}
endgroup
cg_signal cg = new();
initial begin
signal = 0;
for (int i = 0; i < 200; i++) begin
signal = ~signal;
cg.sample();
$display("%f",cg.get_coverage());
$display("%f",cg.cp_signal_high.get_coverage());
$display("%f\n",cg.cp_signal_low.get_coverage());
end
end
endmodule