Functions don't work in declarations section

Discussion in 'VHDL' started by davehigton, Dec 24, 2008.

  1. davehigton

    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
    davehigton, Dec 24, 2008
    #1
    1. Advertising

  2. davehigton

    Tricky Guest

    On 24 Dec, 08:17, davehigton <> 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 );
    Tricky, Dec 24, 2008
    #2
    1. Advertising

  3. davehigton

    davehigton Guest

    On 24 Dec, 08:38, Tricky <> wrote:
    > On 24 Dec, 08:17, davehigton <> 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
    davehigton, Dec 24, 2008
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Xiangliang Meng
    Replies:
    1
    Views:
    1,576
    Victor Bazarov
    Jun 21, 2004
  2. Jeff
    Replies:
    1
    Views:
    384
    Mark A. Odell
    Nov 14, 2003
  3. Replies:
    9
    Views:
    336
    Ike Naar
    May 3, 2010
  4. Christoph Klocker

    newbie: functions don't work in script

    Christoph Klocker, Jan 12, 2006, in forum: Ruby
    Replies:
    3
    Views:
    64
    Christoph Klocker
    Jan 12, 2006
  5. kampy
    Replies:
    9
    Views:
    314
    Steven D'Aprano
    Oct 19, 2012
Loading...

Share This Page