RE: [sv-bc] Search order for functions/tasks in modules, $unit and packages

From: Steven Sharp <sharp_at_.....>
Date: Tue Aug 30 2005 - 11:23:28 PDT
>From: "Rich, Dave" <Dave_Rich@mentor.com>

>The upward reverence rule is in the 1364 standard. See section 12.7.
>
>"If the item is a variable, it shall stop at a module boundary; if the
>item is a task, function, named block or generate block, it continues to
>search higher-level modules until found."

You are right.  I missed this change.  The 1995 standard did not specify
this.  The 2001 LRM tried to specify this, but followed it with another
sentence that directly contradicted it.  The 2005 draft removes the
contradictory sentence.

So now the upward reference rule is part of the 1364 standard, which
avoids that potential ambiguity.  This still leaves us with a more
severe variation of the issues that Mark and others have raised.
When the upward search reaches the module level, 1364 specifies that
for certain kinds of identifiers, the search continues up the design
hierarchy from the instance.  On the other hand, P1800 specifies that
it proceeds up to $unit.  These need to be reconciled.

I presume that the desired resolution would be to look in $unit
(during parsing) first, and then look upward in the hierarchy after
it has been elaborated.

This still leaves the exact sequence unclear.  The rules in 1364-2005
section 12.7 are oversimplified.  They imply that the upward search
for names looks at everything in the upward scopes, which would include
forward declarations.  We know this is not the case.  In fact, it only
includes names declared prior to this reference, not later ones.

As I said earlier, I don't think the apparent forward references allowed
to tasks and functions are due to the last step of upward search before
reaching the module level.  Instead, they are resolved due to the first
step of the later upward search.  So is the search upward into $root an
extension of the earlier search (in which case a declaration in $root will
be found, and a local but forward reference will not) or is it part of the
later search (in which case a local but forward declaration will be found
before a declaration in $root)?

Steven Sharp
sharp@cadence.com
Received on Tue Aug 30 11:23:33 2005

This archive was generated by hypermail 2.1.8 : Tue Aug 30 2005 - 11:25:49 PDT