Re: [sv-bc] Clarification: import and visibility of imported symbols

From: Arturo Salz <Arturo.Salz@synopsys.com>
Date: Fri Jul 23 2004 - 14:41:14 PDT

Francoise,

In your first example there is no error. The line that includes the
declaration "logic mylogic" (a correct declaration) prevents
globals::mylogic from being imported into module top.

The second example should result in an error because the type of
mylogic is undefined in the scope of module top.Since variables and
types share the same name space, the declaration of variable mylogic
prevents globals::mylogic from being imported, thus, resulting in an
undefined type error.

    Arturo

----- Original Message -----
From: "Francoise Martinolle" <fm@cadence.com>
To: <sv-bc@eda.org>
Sent: Friday, July 23, 2004 10:37 AM
Subject: [sv-bc] Clarification: import and visibility of imported symbols

Should the following examples compile without any error?
This seeks clarification on when a symbol coming from a import * is
imported into the scope.
import * makes symbols potentially visible, the question is when does a
compiler make them
visible?

package globals;
typedef logic mylogic;
endpackage

module top;
import globals::*;

logic mylogic; // attempt to declare a variable named mylogic of type logic
                      // I think that should be allowed as globals::mylogic
is only imported if used
                      // in this particular case, the type is not imported
as we are trying to declare
                      // a variable
endmodule

What about if have :
module top;
import globals::*;

logic mylogic; // attempt to declare a variable named mylogic of type logic
                      // now I have declared a symbol mylogic in my scope
hash table

mylogic var; // attempt to declare a variable var of type mylogic
                   // is this legal?

endmodule
Received on Fri Jul 23 14:41:17 2004

This archive was generated by hypermail 2.1.8 : Fri Jul 23 2004 - 14:41:25 PDT