How to declare two-dimensional arrays and their elements in VHDL

I need to declare the values ​​that the counter should take in a 2D array. In addition, how can I select elements from an array and use them (for example, assign them to another variable) how to declare elements of this 2D array?

type lutable is array (0 to 4, 0 to 63) of integer range 0 to 4000; 
+6
source share
1 answer

in a 2D array, for example:

 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, for example. as default values ​​(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 above a constant array, for example:

 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; ... 
+12
source

Source: https://habr.com/ru/post/947518/


All Articles