Functions don't work in declarations section

D

davehigton

Guest
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
 
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 );
 
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
 

Welcome to EDABoard.com

Sponsor

Back
Top