On Wed, 09 May 2007 17:48:39 +0100, Evan Lavelle <
[email protected]>
wrote:
>Does anyone know what exactly can be referenced before declaration?
>The LRM seems pretty vague on this. As far as I can see, it only says
>that
>
>- specparams must be declared before use
>- events must be declared before use
>- UDPs may be instantiated before declaration
>
>Presumably the full list of use-before-declare objects are modules and
>UDPs, although I think some tools also add explicitly-declared module
>inputs to this list.
Subprograms can be used before declaration, although the
reasoning behind that is kinda weird - IIRC a call to an
as-yet undeclared function or task is treated as a cross-module
reference and the name is resolved at elaboration time.
This is because you can use an unqualified (non-dotted) name
to call functions or tasks in an enclosing (parent) module
instance. However, at elab time, if the name turns out
to be that of a task/function declared later in the current
module, it's the local one that you get.
Is it completely unfair to ask why you're working on a
Verilog parser? :-)
--
Jonathan Bromley, Consultant
DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services
Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
[email protected]
http://www.MYCOMPANY.com
The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.