Working of option.per_instance

Hi all,

I have the following Code



module Coverage_per_instance ;



class A ;

bit a , b ;

covergroup AA ;
`ifdef PI // "Per_Instance"
option.per_instance = 1 ;
`endif

aval:coverpoint a ; 

bval:coverpoint b ; 


endgroup



function new();

AA = new();

endfunction


endclass

A a1 , a2 ;



initial 
begin

  a1 = new() ;
  a2 = new() ;

  a1.a = 0 ;
  a1.b = 0 ;
  a1.AA.sample();


  a2.a = 1 ;
  a2.b = 1 ;
  a2.AA.sample();


  $display("With a1 we Have Coverage %f ",a1.AA.get_coverage);
  $display("With a2 we Have Coverage %f ",a2.AA.get_coverage);

end

endmodule

[Q1] Irrespective of whether I use +define+PI or Not I still get ::


 
 With a1 we Have Coverage 100.000000 
 With a2 we Have Coverage 100.000000
 
 

which I am unable to understand .

[Q2] I am unable to fully understand how option.per_instance works ?

 In the Coverage Report 

(a) With No define :: Covergroup AA has 100% Coverage . Coverpoints aval and bval Give a 100% Coverage .

(b) With +define+PI :: I get 2 Instances ( based on +define )

Covergroup AA still has 100% Coverage ( How ?? )

(1) /Coverage_per_instance/A::AA (2) /Coverage_per_instance/A::AA#2

(1) Here aval has 50% Coverage with auto[0] hit , bval has 50% Coverage with auto[0] hit
(2) Here aval has 50% Coverage with auto[1] hit , bval has 50% Coverage with auto[1] hit





Regards,
AGIS

In reply to Etrx91:

Please have a look at the following DVCon paper: Unraveling the Complexities of Functional Coverage, particularly section II, as it describes how the covergroup options work, along with some examples to show how those options affect your coverage results:

In reply to thomellis:

The link is not opening

In reply to Shivanand Ajjannavar:

The DVCon proceedings archive links have been lost. I have updated the link to an alternate site.

In reply to dave_59:

Hi Dave ,

I went through the paper . As per Table 1 in it , both get_coverage() N get_inst_coverage() return same value
i.e Average of ALL instances ( as merge_instances and get_inst_coverage are at default 0 )

So shouldn’t we observe output as 50% in both cases ?

For object a1 , 50% has been covered ( a == b == 0 ) .
For object a2 , 50% has been covered ( a == b == 1 ) .

Average of both instances is :: ( 50 + 50 ) / 2 == 50 .

Won’t covergroup AA have 2 instances with both instances requiring ALL 4 bins to be hit for 100% coverage per instance ?