[sv-ec] Discussion on #1279 (coverpoint and cross names)

From: Ryan, Ray <Ray_Ryan_at_.....>
Date: Thu May 04 2006 - 17:27:01 PDT
As per my action item, here is some more specific detail regarding issue
1279 that deals with visability issues related to coverpoint and cross
declarations. 
 

1) The LRM (18.3, 18.4) states that a coverpoint (cross) creates a
hierarchical scope that is optionally labelled. What is the namespace of
these names?  The 'block name space' (as defined in 19.13) seems the
most appropriate. To indicate this, the LRM could state that a
coverpoint or cross creates a "block scope" rather than the text
"hierarchical scope".
 
2) Coverpoints and crosses occur with a covergroup. 
  a) Within a covergroup, it should be illegal to define two objects
(coverpoint / cross) with the same name.
  b) Is it illegal for a coverpoint or cross to have the same name as
another object with the covergroup scope? Seems this should be a name
conflict. How about the example:

       covergroup cov1 (ref int x ) 
         x : coverpoint x;
       endgroup

     In this example, the covergroup declares a (user-defined) type. The
argument 'x' is defined within the scope of the covergroup. Is it
illegal to now define a coverpoint named 'x' that is also in the scope
of the covergroup? 
 
3) The visibility of coverpoint and cross names need clarification. In
the following example, what is the resolution of the symbols
   'x', 'y', 'z' in the indicated syntactic regions.

      int x, y, z, z2 ;
      covergroup cov1 ( ref int x, in int y )
           <region 1>
         x : coverpoint <region 2> x {
           <region 3>
           bins y = { [10 : y ] }; // what is the second 'y'
           bins x = { [ y : x ] };
         }
         cp2 : coverpoint  ( <region 4> z + x.option.weight ) {
           bins cp2 = { [ 1 : 10 ] };         // Is there a name
conflict here ?
         }
         <region 5>
         y : coverpoint x ; // should be invalid as 'x' refers to a
coverpoint
         <region 6>
         c : cross x, z ;   // This should create an implicit coverpoint
named 'z '
         <region 7>
         coverpoint z ;   // This is illegal 'z' already defined in this
scope
      endgroup
 
4) The order of declarations is significant in a coverpoint declaration
(as in other parts of the language). If at the point of the declartion
of a cross, a name refers to a variable, an implicit coverpoint is
created - even if a coverpoint of that name is later declared. The later
declaration is then invalid since the implicitly created coverpoint (of
the same name) already exists in covergroup scope. In a cross, the
reference to a coverpoint is to the coverpoint name not the variable
covered by the coverpoint. 
For example:

      int x, y ;
      covergroup cov2 ;
         foo : coverpoint x ;
         bar : coverpoint x ;
         coverpoint y ;
         cross x, y ;                // create implicit coverpoint 'x' 
         coverpoint x ;           // illegal, 'x' already exists.
      endgroup
 
5) A 'scope' is not the same as a type. A coverpoint (or cross) does not
create a named type. Therefore the '::' syntax should not be used to
reference members of the coverpoint (or cross). This syntax is used in
section 18.7 to access the option and type_option members of a
coverpoint or cross.
 
 
 Ray
 
Received on Thu May 4 17:27:07 2006

This archive was generated by hypermail 2.1.8 : Thu May 04 2006 - 17:27:34 PDT