RE: [sv-bc] visibility with parameterized types

From: Rich, Dave <Dave_Rich@mentorg.com>
Date: Thu Oct 07 2004 - 14:55:46 PDT

Greg,

I agree with this approach, label names should not get imported for both type parameters and package imports. Using the scope operator is a good idea for getting at the labels when only the type name has been imported into the scope, but I consider that an enhancement.

Dave

-----Original Message-----
From: Greg Jaxon [mailto:Greg.Jaxon@synopsys.com]
Sent: Wednesday, October 06, 2004 2:26 PM
To: Rich, Dave
Cc: sv-bc@eda.org
Subject: Re: [sv-bc] visibility with parameterized types

Rich, Dave wrote:
> This should be related to
> http://www.eda.org/svdb/bug_view_page.php?bug_id=0000026
>
> I think the answer should be yes. See the thread starting at
> http://www.eda.org/sv-bc/hm/1783.html
>
> Dave

First I think we should agree to extend the BNF so that enum literals can be accessed via their type name. Where we now allow "class_scope", we can read the enum's type identifier ("t" in Paul's example) as a class name and thus permit t::blue to be an unambiguous reference to the enum literal.
Of course we cannot confuse enums and classes, so a separate production rule for enum_scope is probably necessary, one which includes finding enum types wherever types are sold.

With this syntax in hand, we are then free to say NO to letting an enum type parameter accidentally pollute the module namespace. I think Paul's choice of "blue" was apt: identifiers whose meaning emerges "out of the blue"
are a menace to readability. This choice also saves the committee from writing about what happens when TWO enum types become type parameters of the same module.

Greg Jaxon

>
>
> -----Original Message-----
> From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] On Behalf Of
> Paul Graham
> Sent: Wednesday, October 06, 2004 12:24 PM
> To: sv-bc@eda.org
> Subject: [sv-bc] visibility with parameterized types
>
> Does using a parameterized type have an effect on visibility? For instance:
>
> module sub #(parameter type t = int)
> (input t x, ...);
> ...
> endmodule
>
> module top();
> typedef struct { bit f1, f2; } mystruct;
> typedef enum {red, blue, green} color;
>
> sub #(mystruct) u1((...);
> sub #(color) u2(...);
> endmodule
>
> If sub is instantiated with type mystruct, then within sub are the fields f1 and f2 visible?
>
> assign y = x.f1; // ??
>
> If sub is instantiated with type color, then within sub are the colors red, blue, and green visible?
>
> assign y = (x == blue); // ??
>
> These components of the types are not directly visible within sub, but I wonder if they are somehow imported through the type parameter.
>
> Paul
>
>
Received on Thu Oct 7 14:55:55 2004

This archive was generated by hypermail 2.1.8 : Thu Oct 07 2004 - 14:56:01 PDT