Functions don't work in declarations section

D

davehigton

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
 
T

Tricky

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

davehigton

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top