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 ?
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.
a 2d array can also be defined as follows. type dataout is array (0 to 6)of std_logic_vector(7 downto 0);
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With