RE: [sv-bc] Import directive proposal


Subject: RE: [sv-bc] Import directive proposal
From: Maidment, Matthew R (matthew.r.maidment@intel.com)
Date: Fri Mar 14 2003 - 09:55:59 PST


Why is this necessary if we already have the `ifndef...`ifdef
convention? The `import as proposed does not solve the problem
where two imported files define an item with the same name and
wind up stomping each other.
 
If we're going to add a keyword for aiding in definition of
items, why not include enough semantics to meaningfully
differentiate it from `include +`ifndef...`endif?
 
Why not do something more like perl's package/use/etc.?
 
 
For example:
 
Allow definition of namespace for items (types,functions, etc.)
enclosed in
 
  package <packagename> .. endpackage
 
The default definition namespace/package is $root
 
To include the definitions of a particular namespace
into the default namespace, use the `import directive
 
 `import package
 
 
Alternately, one can reference a parts of a package without
importing:
 
  namespace::mytype
 
  namespace::myfunction
 
Matt
 

--
Matt Maidment                 
mmaidmen@ichips.intel.com
(503)712-2915
Intel Corporation              
MS JF4-409
2111 NE 25th Ave.
Hillsboro, Oregon  97124
  

-----Original Message----- From: Peter Flake [mailto:Peter.Flake@synopsys.com] Sent: Friday, March 14, 2003 6:42 AM To: sv-bc@eda.org Cc: Arturo Salz Subject: [sv-bc] Import directive proposal

ADD to draft 3 a new Section 23.3

23.3 Import directive

For tools which require separate analysis of modules, it is useful to be able to `include a file of global definitions for each module. For tools which analyze modules all together, it is necessary to avoid multiple definitions, and so each such file should be included only once.

SystemVerilog provides an enhanced form of the `include directive, which is the `import directive `import "myhead"

is similar in effect to `ifndef myhead `include "myhead" `define myhead `endif

Note that 'import is not exactly the same as the above code, because the filename string is converted to a description of the file, such as the absolute path, which is less sensitive to the current working directory.



This archive was generated by hypermail 2b28 : Fri Mar 14 2003 - 09:56:48 PST