Re: [sv-ec] Mantis 2149 - Covergroups sample method with arguments

From: David Scott <david_scott_at_.....>
Date: Wed Nov 14 2007 - 09:51:08 PST
A few responses marked with "DCS:" ... no response means in general I concur.

-- David (Scott)

Arturo Salz wrote:

Scott,

 

My comments inlined below.

 

            Arturo

 


From: David Scott [mailto:david_scott@mentor.com]
Sent: Friday, November 09, 2007 2:27 PM
To: Arturo Salz
Cc: SV-EC; sv-ac@eda-stds.org
Subject: Re: [sv-ec] Mantis 2149 - Covergroups sample method with arguments

 

Arturo:

Some reaction from the Mentor covergroup team and Gordon (Dave R and Ray not represented):

#1.  Syntax.  There was a preference to drop the @, to allow a declaration like so:

covergroup ct function sample(int x);

The issue is that "@ function" seems like a cue to wait on an event related to the function, or that it seems somehow related to event-based sampling.

We’re open to syntactical changes.

The reason for the “@ function” syntax was to use an operator to separate the coverage declaration from the sampling method declaration; it seems more readable this way. We’d like to hear from other people.


#2.  We'd prefer some re-wording around the first sentence of the last paragraph.  Maybe something like this:

Within coverpoint and guard expressions, the formal arguments of an overridden sample method shall be searched after other covergroup items but before the scope enclosing the covergroup.

("Other covergroup items" might be the option or type_option members, though not coverpoints and crosses according to Mantis 1279.)

I’m not sure this is better. The more complex verbiage does not appear to solve any issue.

How does the limitation to coverpoint and guard expressions needed?


DCS: I was trying to suggest a re-wording in line with this comment from Gordon:
The sentence:
   The formal arguments of an overridden sample method shall be searched
   before the enclosing scope
needs to be clarified -- I assume that this means that *within*
the covergroup, the formals for "sample" are visible and shall
match *after* other covergroup items but before the scope
enclosing the covergroup.


#3.  "error to use a sample argument" should read "error to use a sample formal".

OK.


#4.  The last example needs a "ref" added in the covergroup arguments, like so: "covergroup C1 (ref int v)".

No. That’s the whole point of the example.

Users may think that it’s OK to use the “v” covergroup argument by the constructor (to set the weight option) and the “v” sample formal by the definition of the coverpoint., The rule is intended to avoid this ambiguity.


DCS: In your example "v" was a coverpoint expression.  If someone were to write it passing "v" into the constructor, they would write it as "ref int v".  You are passing "b" -- assigned to weight -- through the sample method, a different illegality.


#5.  Just for people to consider, we are expecting the following to be legal (with our preferred syntax)?

int a;
covergroup ct (ref int b) function sample(int c);
    coverpoint a + b + c;
endgroup

 

Yes. We agree. Awkward, but legal nonetheless.

 

#6.  A host of issues around sample arguments.  One thing that occurred to us -- without, I'll note, Gordon's blessing! -- is that we could possibly allow this:

int a;
covergroup ct function sample(ref int x = a);
    coverpoint a;

This would allow event-based sampling to occur as well as procedural sampling, let's say with this syntax (which I know would be a change from the proposal):

covergroup ct function sample(ref int x = a) @(e);

With event-based sampling, the default arguments would be used, which as you see cause "a" from the enclosing scope to be sampled.  It wasn't clear from Mike's original e-mail whether the override was expected to be optional (used occasionally) or required (used always).

I am very uncomfortable with this change. The current proposal makes it clear that there are two mutually exclusive ways to trigger a covergroup: via an events (or block event) or procedurally through the sample method. Otherwise, there are other issues like “strobe” sampling that rear their ugly head.


DCS: I'm OK disallowing what I suggested; it does make it simpler to disallow it.  I'll comment on "strobe" later in the thread, though.


If default arguments are used, what restrictions are there?  Can they be covergroup formals, like this?

covergroup ct (ref int a) function sample(ref int x = a);

 

Good point. I would say no. Covergroup formals should not be visible in the scope of default arguments.

 

Can they be non-static class properties for an embedded covergroup?

Yes. Any reason to disallow them?


What about "output" arguments?  While this sounds nonsensical, someone might find a use for something like this:

function int f(output o, input i);
    o = 2*i;
    return o;
endfunction

covergroup ct function sample(output o, input i);
    coverpoint f(o,i);
endgroup

 

As you say, “output” arguments are nonsensical. Do we need an explicit error rule? Is there any plausible expectation on the part of users?


DCS: I have no idea whether users would expect this or not -- users frequently surprise me -- but an explicit sample arguments list opens up the possibility.  We need language in the proposal to disallow what we believe makes no sense.

 

Finally, what about a null argument list to sample?  That sounds to me like it should be disallowed.

The current BNF allows it and I see no problem for an overridden method to have the same signature as the default method. In a way the proposal is saying that omitting the coverage_event is the same as an explicit “covergroup <name> @ function sample();”



-- David Scott, Mentor Graphics


Arturo Salz wrote:

I've uploaded a proposal for Mantis 2149. Please review.
 
        Arturo
 
-----Original Message-----
From: owner-sv-ec@eda.org On Behalf Of Michael Burns
Sent: Wednesday, October 24, 2007 4:38 PM
To: SV_EC List
Cc: John Havlicek
Subject: [sv-ec] Mantis 2149 - Covergroups sample method with arguments
 
 
Mantis 2149 - Covergroups sample method with arguments has been
submitted 
describing what we'd like to see in a solution for the covergroup sample
issue I 
raised a week or two ago.
 
--Mike Burns
 
 
  

 




--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean. Received on Wed Nov 14 09:51:40 2007

This archive was generated by hypermail 2.1.8 : Wed Nov 14 2007 - 09:51:49 PST