Re: [sv-bc] Referencing $unit identifiers from within a package

From: Greg Jaxon <Greg.Jaxon_at_.....>
Date: Wed Apr 12 2006 - 11:47:42 PDT
Rich, Dave wrote:
> Is the following legal? Should it be legal?

> file.v
> 
> typedef int foo;
> package p;
>   foo A;;
> endpackage

I'll express a personal opinion unrelated to any SV products,
or SV users' code.

This looks legit, and I can specify a precise definition
of how different importers of p will understand A.  But the
author has missed the exit on the the software engineering
superhighway...

$unit dependencies from within a package are defects in that
package's encapsulation of its contents.   If the package
only expects them to function for local uses within the package
there are few problems here - maybe an inept SV processor will
complain about $unit name collisions under some circumstances.

But if the package expects these global identifiers to function
as part of its API (either calling in, or for the package to call
out to other packages), then it has thrown itself on the mercy
of the user's compilation flow, since the behavior of $unit
definitions in multiple files is a choice left to the user.

I don't know how bad a gaffe this really is.  My guess is that
the language should allow this - it is part and parcel of its
mission to allow clear expression of every intent, no matter how
misguided, but that its "lint" processors would be justified
in warning about it.

Greg Jaxon
Received on Wed Apr 12 11:50:20 2006

This archive was generated by hypermail 2.1.8 : Wed Apr 12 2006 - 11:50:30 PDT