RE: [sv-ec] Query on bin value

From: Swapnajit Chakraborti <swapnaj@cadence.com>
Date: Thu Jul 29 2010 - 03:15:56 PDT

Hi Dave,

Thanks for your response. Basic intent of this query was to figure out if "const" ness of an object propogates
down or not. For example, if I declare something like below, will x_obj.a be treated as instance const although this
is hierarchical expression and then treated legal as bin value.
class x;
    int a;
endclass
x myobj = new;
class y;
   const x x_obj = myobj;
   covergroup cg @
       coverpoint v {
            bins b1 = {x_obj.a}; // Is this a instance const just because x_obj is a const member of class?
       }
   endgroup
endclass
I also refered to mantis 1802. But the logic provided there doesn't hold anymore. The reason is that we already
introduced "merge_instances" type_option to take care of merging different coevrage spaces across multiple covergroup
instances. Please let me know if I am missing something here.

>Third, myt.xx is a field select, not a hierarchical reference. If you were to change "const" to "parameter", it would be legal.
So, do you mean the member select expression is illegal as long as we keep it "const"?
If you notice, I am trying to figure out if a dot-separated name (be it member select or hierarchical reference) can be considered
an instance const in case the top-level element of the name is declared "const" within a class.

Regds,
Swapnajit
________________________________
From: Rich, Dave [mailto:Dave_Rich@mentor.com]
Sent: Friday, July 23, 2010 9:47 PM
To: Swapnajit Chakraborti; sv-ec@eda.org
Subject: RE: [sv-ec] Query on bin value

Swapnajit,

First, a variable declared as "const" cannot be used in the context of a constant expression. It is a write-once variable.
Second, an instance constant is only valid in the context of an embedded covergroup within a class.
Third, myt.xx is a field select, not a hierarchical reference. If you were to change "const" to "parameter", it would be legal.
Finally, the reason for the LRM restriction is discussed but not resolved in http://www.eda.org/mantis/view.php?id=1802

Dave

From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf Of Swapnajit Chakraborti
Sent: Friday, July 23, 2010 4:37 AM
To: sv-ec@eda.org
Subject: [sv-ec] Query on bin value

I have query regarding use of hierarchical names as bin value of a coverpoint.

The LRM says the following:
"The open_range_list used to specify the set of values associated with a bin shall
be constant expressions (see 11.2.1), instance constants (for classes only), or non-ref arguments to the coverage
group."

Now, if I have something like below, should "myt.xx" be treated as instance constant/constant expression
and thus allowed in bin value expression. Or will it be considered as hierarchical expression and hence should be treated as illegal.

module test;
   typedef struct { int xx; } my_t;
   class item_c;
      const my_t myt = '{xx:6};
      covergroup data_cg;
          DATA: coverpoint data{
                 bins chid[] = {[0:myt.xx]}; // This is a member of a const struct. Should this be allowed as instance const or const expression or illegal?
          }
      endgroup : data_cg
      ...
   endclass : item_c
....
endmodule : test

Regds,
Swapnajit

--
This message has been scanned for viruses and
dangerous content by MailScanner<http://www.mailscanner.info/>, and is
believed to be clean.
-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Thu Jul 29 03:16:55 2010

This archive was generated by hypermail 2.1.8 : Thu Jul 29 2010 - 03:17:15 PDT