Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to declare two dimensional arrays and their elements in VHDL

Tags:

vhdl

i need to declared the values that the counter is to take in a 2D array. Also, how do i select elements from the array and use them (say assign them to another variable) how do i declare the elements of this 2D array ?

type lutable is array (0 to 4, 0 to 63) of integer range 0 to 4000;
like image 961
user2481101 Avatar asked Jun 18 '13 05:06

user2481101


1 Answers

in a 2D array e.g.:

type lutable is array (0 to 4, 0 to 2) of integer range 0 to 4000;

signal sample_array: lutable;

you can assign elements to another signal as follows:

out_signal<=sample_array(in_a, in_b);

the contents of the array can be declared e.g. as defaults (caution, this is not supported by all synthesis-tools!):

signal sample_array: lutable:=( (1000, 2000, 3000),
                        (4000, 3000, 2000),
                        (100, 200, 300),
                        (1,2,3),
                        (5,6,7));

or over a constant-array, e.g.:

signal sample_array: lutable;
constant sample_array_init: lutable:=(  (1000, 2000, 3000),
                        (4000, 3000, 2000),
                        (100, 200, 300),
                        (1,2,3),
                        (5,6,7));
 ...
 sample_array<=sample_array_init;
 ...

or, of course, element by element:

 sample_array(1,1)<=1000;
 ...
like image 124
baldyHDL Avatar answered Nov 12 '22 08:11

baldyHDL