我需要声明计数器要在2D数组中采用的值.另外,我如何从数组中选择元素并使用它们(比如将它们分配给另一个变量)如何声明这个2D数组的元素?
type lutable is array (0 to 4, 0 to 63) of integer range 0 to 4000;
Run Code Online (Sandbox Code Playgroud)
bal*_*HDL 12
在2D数组中,例如:
type lutable is array (0 to 4, 0 to 2) of integer range 0 to 4000;
signal sample_array: lutable;
Run Code Online (Sandbox Code Playgroud)
您可以将元素分配给另一个信号,如下所示:
out_signal<=sample_array(in_a, in_b);
Run Code Online (Sandbox Code Playgroud)
数组的内容可以声明为默认值(注意,所有综合工具都不支持!):
signal sample_array: lutable:=( (1000, 2000, 3000),
(4000, 3000, 2000),
(100, 200, 300),
(1,2,3),
(5,6,7));
Run Code Online (Sandbox Code Playgroud)
或者在一个常数数组上,例如:
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;
...
Run Code Online (Sandbox Code Playgroud)
或者,当然,逐个元素:
sample_array(1,1)<=1000;
...
Run Code Online (Sandbox Code Playgroud)