Is this a VHDL limitation, or Modelsim bug

T

Tricky

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.
 
M

Mike Treseler

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
 
T

Tricky

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).
 
P

Peter Spjuth

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
 

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,990
Messages
2,570,211
Members
46,796
Latest member
SteveBreed

Latest Threads

Top