Size of an array

S

Srinivasan Venkataramanan

Hi Kwaj,
No "command", but an attribute of a vector named Length

a_vec'length

HTH,
Srinivasan

--
Srinivasan Venkataramanan
Senior Verification Engineer, Intel Bangalore, India
Co-Author of: Using PSL/SUGAR for Formal and Dynamic Verification 2nd
Edition,
2004 isbn 0-9705394-6-0, Ben Cohen, Srinivasan & Ajeetha

http://www.noveldv.com
I don't speak for Intel
 
C

Charles M. Elias

kwaj said:
Is there a command to return the size of an array?

There is a predefined attribute that will do this:

A'Length (n) returns number of values in the n-th index range of array A
For a single-dimensional array (n) can be omitted.

A'Length can be used like this:

signal b : std_logic_vector( A'Length - 1 downto 0 );


or almost anywhere where you would want to plug in the length of A
 

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
474,159
Messages
2,570,883
Members
47,419
Latest member
ArturoBres

Latest Threads

Top