Tricky
Guest
Mon Apr 11, 2011 2:37 pm
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.
Mike Treseler
Guest
Mon Apr 11, 2011 7:13 pm
On 4/11/2011 4:37 AM, Tricky wrote:
Quote:
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
Tricky
Guest
Tue Apr 12, 2011 12:12 am
On Apr 11, 8:13 pm, Mike Treseler <mtrese...@gmail.com> wrote:
Quote:
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).
Peter Spjuth
Guest
Fri Apr 15, 2011 8:20 pm
On 11 Apr, 14:37, Tricky <trickyh...@gmail.com> wrote:
Quote:
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