FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > Verilog

Verilog comp.lang.verilog newsgroup / usenet

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-09-2007, 06:48 PM
Evan Lavelle
Guest
 
Posts: n/a
Default Declare before use, or vice-versa?

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.

Thanks -

Evan
Reply With Quote
  #2 (permalink)  
Old 05-09-2007, 07:09 PM
Jonathan Bromley
Guest
 
Posts: n/a
Default Re: Declare before use, or vice-versa?

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.
Reply With Quote
  #3 (permalink)  
Old 05-09-2007, 07:17 PM
Jonathan Bromley
Guest
 
Posts: n/a
Default Re: Declare before use, or vice-versa?

On Wed, 09 May 2007 18:09:08 +0100, Jonathan Bromley
<[email protected]> wrote:

>On Wed, 09 May 2007 17:48:39 +0100, Evan Lavelle <[email protected]>
>wrote:
>
>>Does anyone know what exactly can be referenced before declaration?


>Subprograms can be used before declaration


True, but what I *forgot* to add was...

With the two exceptions of module/UDP names and task/function
names, anything that will go out-of-module must be specified
as a dotted name. And I'm fairly sure this means that any
name must be declared before use unless it falls into one
of those categories.

Don't forget implicit wire declaration on port connection :-(
--
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.
Reply With Quote
  #4 (permalink)  
Old 05-10-2007, 07:02 PM
Evan Lavelle
Guest
 
Posts: n/a
Default Re: Declare before use, or vice-versa?

On Wed, 09 May 2007 18:09:08 +0100, Jonathan Bromley
<[email protected]> wrote:

Thanks; I'd missed subprograms.

>Is it completely unfair to ask why you're working on a
>Verilog parser? :-)


Displacement activity; resting between engagements

Evan
Reply With Quote
  #5 (permalink)  
Old 05-10-2007, 10:07 PM
Stephen Williams
Guest
 
Posts: n/a
Default Re: Declare before use, or vice-versa?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Evan Lavelle wrote:
> On Wed, 09 May 2007 18:09:08 +0100, Jonathan Bromley
> <[email protected]> wrote:
>
> Thanks; I'd missed subprograms.
>
>> Is it completely unfair to ask why you're working on a
>> Verilog parser? :-)

>
> Displacement activity; resting between engagements


Somebody quick give this guy a job before he codes some more!-)

- --
Steve Williams "The woods are lovely, dark and deep.
steve at icarus.com But I have promises to keep,
http://www.icarus.com and lines to code before I sleep,
http://www.picturel.com And lines to code before I sleep."
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iD8DBQFGQ3uBrPt1Sc2b3ikRAlyuAKDbPQrDUhBzvMsLSnvf7+ gTx2a4EgCfVD/4
WNvSOJ00+uuPO+7zQPA7Jkc=
=puCr
-----END PGP SIGNATURE-----
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how i declare array for input port kunal Verilog 6 05-18-2006 07:50 PM
Integer to Binary and vice versa [email protected] Verilog 4 02-28-2006 11:39 PM
Re: CFGs vs. "declare variable before use" glen herrmannsfeldt Verilog 2 06-09-2005 04:31 AM


All times are GMT +1. The time now is 04:30 AM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved