Is this a VHDL limitation, or Modelsim bug

Discussion in 'VHDL' started by Tricky, Apr 11, 2011.

  1. Tricky

    Tricky Guest

    I have the following line of code:

    img_height := ( img.get_image )'length(1);

    img is a protected type.
    get_image is a function returning a 2D array containing the image
    data.
    img_height is an integer.

    Now, in modesim I get the compilation error:

    # ** Error: hdl/mem_interface_model.vhd(745): near "'": expecting ';'

    The error is pointing to the 'length attribute.

    So I can see that modelsim wants to end the like at the function call,
    but what's wrong with taking the attribute of a return value.

    Before anyone asks, Ive found an annoying bug that crashes the
    modelsim compiler which mean (for reasons of my file) I cannot have
    functions that return the width or height of the image in the
    protected type. It works when I return the image array, so Im trying
    to work around this bug with the code above.
     
    Tricky, Apr 11, 2011
    #1
    1. Advertising

  2. On 4/11/2011 4:37 AM, Tricky wrote:
    > I have the following line of code:
    >
    > img_height := ( img.get_image )'length(1);
    >
    > img is a protected type.
    > get_image is a function returning a 2D array containing the image
    > data.
    > img_height is an integer.



    Why doesn't the (1) go with the array?

    -- Mike Treseler
     
    Mike Treseler, Apr 11, 2011
    #2
    1. Advertising

  3. Tricky

    Tricky Guest

    On Apr 11, 8:13 pm, Mike Treseler <> wrote:
    > On 4/11/2011 4:37 AM, Tricky wrote:
    >
    > > I have the following line of code:

    >
    > > img_height              := ( img.get_image )'length(1);

    >
    > > img is a protected type.
    > > get_image is a function returning a 2D array containing the image
    > > data.
    > > img_height is an integer.

    >
    > Why doesn't the (1) go with the array?
    >
    >              -- Mike Treseler


    n-d arrays, declared like this:

    type my_array is array( integer range <>, integer range <>, integer
    range etc etc) of integer;

    means that you have to specify which dimension you are talking about
    when you try and take an attribute, hence the (1).
     
    Tricky, Apr 11, 2011
    #3
  4. Tricky

    Peter Spjuth Guest

    On 11 Apr, 14:37, Tricky <> wrote:
    > I have the following line of code:
    >
    > img_height              := ( img.get_image )'length(1);


    I think ' must be preceeded by a name or function call, and in your
    case it
    is preceeded by a parenthesised expression.

    Does img.get_image'length(1) or img.get_image()'length(1) work?

    /Peter
     
    Peter Spjuth, Apr 15, 2011
    #4
    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. Manfred Balik

    VHDL Simulation in ModelSim

    Manfred Balik, Jul 15, 2003, in forum: VHDL
    Replies:
    0
    Views:
    1,783
    Manfred Balik
    Jul 15, 2003
  2. Vilvox

    VHDL design and ModelSim

    Vilvox, Aug 31, 2003, in forum: VHDL
    Replies:
    2
    Views:
    770
    Vilvox
    Sep 1, 2003
  3. afd
    Replies:
    1
    Views:
    8,560
    Colin Paul Gloster
    Mar 23, 2007
  4. fons
    Replies:
    0
    Views:
    771
  5. Vincent Foley

    RDoc: bug or limitation?

    Vincent Foley, Jun 4, 2005, in forum: Ruby
    Replies:
    3
    Views:
    108
    Lothar Scholz
    Jun 6, 2005
Loading...

Share This Page