Re: [sv-bc] Member select or hierarchical name

From: Gordon Vreugdenhil <gordonv_at_.....>
Date: Wed Jan 07 2009 - 07:20:37 PST
The given reference should resolve to the "x" in the generate block,
not the member select.

Many of the rules for name resolution were still in flux pretty
late in the LRM process.  Given how most legacy implementations
likely deal with hierarchical names, it isn't surprising to
me that everyone currently resolves this to the struct.  That
just means that there is a common "trap" that legacy resolution
falls into in such cases, it doesn't mean that the behavior
is correct.

This is a particularly nasty situation for legacy resolution
since the existence of "bl" as a scope name means that "bl.x"
is a proper hierarchical name; so even if "x" is declared after
the struct, bl.x should still resolve to the generate block
variable.  In legacy non-SV code, the only "bl.x" that could
exist "below" the given generate scope would have to itself
be a scope and thus always attempting a "downwards" resolution
from the scope of reference is correct.  Now that is no longer
the case.  If a dotted name resolves late, one has to determine
whether the variable prefix was seen lexically; if not, you
must *ignore* it during the rest of the resolution.  This is
a non-trivial complication to existing systems and such
subtleties are likely to take some time to reach production
systems since most designs wouldn't expose such issues.

Gord.

Surya Pratik Saha wrote:
> Hi,
> I have just gone through the section 23.7 (Member selects and 
> hierarchical names). The section seems very interesting. However, I am 
> not sure if a hierarchical name will be converted to member select or 
> not when the whole scope is traversed. For e.g.
> 
> module top;
>    generate
>        begin:bl
>            int x;
>            initial begin                    bl.x = 1; // will it be 
> converted to member select of struct after the full scope is traversed
>            end
>             struct {int x;} bl;
>       end
>    endgenerate
> endmodule
> 
> Please let me know.
> Currently all standard simulators consider 'bl.x' as member select.
> 

-- 
--------------------------------------------------------------------
Gordon Vreugdenhil                                503-685-0808
Model Technology (Mentor Graphics)                gordonv@model.com


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Wed Jan 7 07:21:50 2009

This archive was generated by hypermail 2.1.8 : Wed Jan 07 2009 - 07:22:14 PST