Re: [sv-bc] Hierarchical resolution in nested modules

From: Steven Sharp <sharp_at_.....>
Date: Mon Dec 03 2007 - 16:46:54 PST
>From: Gordon Vreugdenhil <gordonv@model.com>

>This is a fairly contrived case to make sure that "a"
>doesn't conflict.  The basic point is that in the
>"a.b = 5" assignment, the "a.b" refers to "top.a.b"
>and not "top.c.a.b".  The reason is that the struct
>"a" is lexically visible and thus "a" binds immediately
>to it.

I am not convinced that it does.  Looking at IEEE Std 1800-2005 19.6,
it says that "The outer name space is visible to the inner module so
that any name declared there can be used, unless hidden by a local name,
provided the module is declared and instantiated in the same scope."

Notice that last requirement.  It is not met in your example.

The LRM does not say how it is supposed to behave if the module is not
declared and instantiated in the same scope.  However, since it is
apparently expected to behave differently, I would assume that the
names are resolved from the point of the instantiation rather than the
point of the declaration.  So I would expect it to bind to "top.c.a.b".

One benefit of this is that it avoids the oddity that you were pointing
out with your examples.

I admit that I have not paid much attention to nested modules, but
this is the interpretation I get from reading the LRM text.

Steven Sharp
sharp@cadence.com


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Mon Dec 3 16:47:20 2007

This archive was generated by hypermail 2.1.8 : Mon Dec 03 2007 - 16:47:38 PST