Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multidimensional Array Of Signals in VHDL

Tags:

arrays

vhdl

I have a signal in VHDL declared like this :

signal Temp_Key : std_logic_vector(79 downto 0);

This Temp_Key is passed through a for loop 31 times and it is modified. I want to store all the 31 different Temp_Keys in an array.

Is it possible to use multi-dimensional arrays in VHDL to store 80 bit signals ?

like image 525
Amritha Avatar asked Mar 14 '12 11:03

Amritha


People also ask

What is multidimensional array in data structure with example?

A multi-dimensional array is an array with more than one level or dimension. For example, a 2D array, or two-dimensional array, is an array of arrays, meaning it is a matrix of rows and columns (think of a table). A 3D array adds another dimension, turning it into an array of arrays of arrays.

How do you declare a 2D vector in VHDL?

a 2d array can also be defined as follows. type dataout is array (0 to 6)of std_logic_vector(7 downto 0);

What is Std_logic_vector in VHDL?

The VHDL keyword “std_logic_vector” defines a vector of elements of type std_logic. For example, std_logic_vector(0 to 2) represents a three-element vector of std_logic data type, with the index range extending from 0 to 2.


1 Answers

Yes, first you need to declare a type:

type YOUR_ARRAY_TYPE is array (0 to 30) of std_logic_vector(79 downto 0);

Note you can also declare the type to be of undefined length - so you can specify how many 80 bit words it has when you declare your signal. And with VHDL 2008, you can also leave the size of the slv unspecified, also to be declared when you create your signal. For example:

type slv_array is array (natural range <>) of std_logic_vector;

and then use it

signal MY_SIGNAL : YOUR_ARRAY_TYPE;
...
MY_SIGNAL(0) <= data;
...
MY_SIGNAL(1) <= data;

See here for a reference.

like image 109
Josh Avatar answered Oct 03 '22 09:10

Josh