Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Functions don't work in declarations section

Reply
Thread Tools

Functions don't work in declarations section

 
 
davehigton
Guest
Posts: n/a
 
      12-24-2008
I've created a package file with some constants and some functions.
I've
referenced this package with the usual "library" and "use" statements.
The functions are available in the architecture bodies just fine; but
I'd like
to use one of the functions in a declarations section, to help define
some
constants. However, I can't do this; the scope of functions appears
to be
limited to architecture bodies.

Why is this?

Dave
 
Reply With Quote
 
 
 
 
Tricky
Guest
Posts: n/a
 
      12-24-2008
On 24 Dec, 08:17, davehigton <davehig...@dsl.pipex.com> wrote:
> I've created a package file with some constants and some functions.
> I've
> referenced this package with the usual "library" and "use" statements.
> The functions are available in the architecture bodies just fine; but
> I'd like
> to use one of the functions in a declarations section, to help define
> some
> constants. *However, I can't do this; the scope of functions appears
> to be
> limited to architecture bodies.
>
> Why is this?
>
> Dave


Functions can set up constants just fine. make sure you're setting up
the constants below where you said use my_lib.my_package.all;

Are you declaring the constants like this?:

constant MY_CONSTANT : integer := my_functions( vars );
 
Reply With Quote
 
 
 
 
davehigton
Guest
Posts: n/a
 
      12-24-2008
On 24 Dec, 08:38, Tricky <Trickyh...@gmail.com> wrote:
> On 24 Dec, 08:17, davehigton <davehig...@dsl.pipex.com> wrote:
>
> > I've created a package file with some constants and some functions.
> > I've
> > referenced this package with the usual "library" and "use" statements.
> > The functions are available in the architecture bodies just fine; but
> > I'd like
> > to use one of the functions in a declarations section, to help define
> > some
> > constants. *However, I can't do this; the scope of functions appears
> > to be
> > limited to architecture bodies.

>
> > Why is this?

>
> > Dave

>
> Functions can set up constants just fine. make sure you're setting up
> the constants below where you said use my_lib.my_package.all;
>
> Are you declaring the constants like this?:
>
> constant MY_CONSTANT : integer := my_functions( vars );


Thanks for your reply. In fact I'd just realised what I'd failed to
do: I hadn't written a function declaration. Now I have, everything
works fine, of course!

Dave
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
section with in a section config file and reading that config file kampy Python 9 10-19-2012 10:59 PM
Why is it important to share functions' declarations? grishin-mailing-lists@minselhoz.samara.ru C Programming 9 05-02-2010 11:45 PM
Won't work without useless declarations Lars Eighner C Programming 9 09-18-2007 05:34 PM
please help me in distinguish redefining functions, overloading functions and overriding functions. Xiangliang Meng C++ 1 06-21-2004 03:11 AM
Function declarations & use of static functions Jeff C Programming 1 11-14-2003 06:33 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57