Legal places to use cover_point_identifier

Hi All ,

I saw a thread recently on the forum which invoked an interest in usage of cover_point_identifier aka coverpoint label

If I were to write following code :


 //  CODE1 
   bit [7:0]  a ;   
   covergroup cg_exp ;
   
      a_cp : coverpoint a  //   cover_point_identifier / coverpoint label  is  ' a_cp ' 
      {   
         bins mod3[]  =  a_cp  with (  a_cp  % 3 == 0 ) ;  //  ' label '  used  instead  of  ' item  '  within  with_clause   
      }    
    
   endgroup

LRM Syntax 19-2 says :


  [ cover_point_identifier :  ] coverpoint expression [ iff ( expression )  ]
                                {
[ wildcard ] bins_keyword bin_identifier [ [ [ covergroup_expression ] ]  ] = cover_point_identifier with ( with_covergroup_expression )  [ iff ( expression )  ]                 
                                }
 

Hence I observe a compilation error for the CODE1 as cover_point_identifier is illegal within with_clause

The legal way to write it would be ::


 
      a_cp : coverpoint a  //   cover_point_identifier / coverpoint label  is  ' a_cp ' 
      {   
         bins mod3[]  =  a_cp  with (  item  % 3 == 0 ) ;  
      }    
    
   endgroup

LRM Syntax 19-4 says :


 [ cross_identifier : ] cross cross_item ,  cross_item { ,  cross_item } [ iff ( expression )  ] cross_body
                        {
                           bins_keyword bin_identifier = cross_identifier  with ( with_covergroup_expression ) 
                        }

                        where                  cross_item  ::=  cover_point_identifier | variable_identifier 
   
                                with_covergroup_expression ::=  covergroup_expression
 

Note that cover_point_identifier as part of with_covergroup_expression isn’t shown as a possibility ( but it does work as per the link )

[Q1] Why is it considered legal ? Am I missing on something ?

LRM further says :


 A coverpoint name has limited visibility. An identifier can only refer to a coverpoint in the following contexts:
 —  In the coverpoint list of a cross declaration (see 19.6),
 —  In a hierarchical name where the prefix specifies the name of a covergroup variable. For example, 
    cov1.cp.option.weight where cov1 is the name of a covergroup variable and cp is the name of a coverpoint declared within the covergroup.
 —  Following :: , where the left operand of the scope resolution operator refers to a covergroup. 
    For example, covtype :: cp :: type_option.weight.
 

Another legal syntax is to write the following within cross_body ::

 .. = binsof( cover_point_identifier [ .bin_identifier ] ) [ intersect {  covergroup_range_list }  ] 

[Q2] From a strict coverpoint_body and cross_body perspective , what are the other legal places to write cover_point_identifier ?

In reply to MICRO_91:

This is a reported errata in the current LRM. The LRM has not been updated to describe all the allowed places you can use a cover_point_identifer.

In reply to dave_59:

Hi Dave ,

Do you see any further possibility to write a cover_point_identifier ( which the LRM is yet to update ) , apart from the above 3 ? .

Just wanted to make a note of it in my local LRM copy .

In reply to MICRO_91:

I’m not looking for any more :)

If you find something you think is missing and worthy of adding, let us know.

In reply to dave_59:

Two more possibilities I tried :
(1) Within coverpoint without with_clause :


       bit [3:0]  data ;

   covergroup cg_exp @( posedge clk ) ; 
   
      data_cp : coverpoint ( data ) 
               {
                  bins  dyn[] = data_cp ; //  ' cover_point_identifier '  without  with_clause  !!  
               }                                              
   endgroup

   cg_exp  cg1  =  new() ;
    

The above code works across all tools .

(2) Within cross-bins as part of iff expression :


        bit [3:0]  a , b ; 

    covergroup  cg_exp; 

       cp_a : coverpoint (a) 
              {
                 bins b1[] = {[1:3]} ;   
              }

       cp_b : coverpoint (b) 
              {
                 bins b2[] = {[1:3]} ;   
              }
    
       cp3 : cross cp_a , cp_b 
             {
               ignore_bins ib  =  cp3  with ( cp_a > cp_b ) iff ( cp_a > 0 ) ;         
             }

    endgroup
     
    cg_exp  cg1  =  new() ;
     

Only 1 tool accepts this .
Since even the LRM isn’t clear on this , tools might have their own implementation.