(VHDL)尝试从阵列输出时收到错误

时间:2018-12-05 20:28:22

标签: arrays output vhdl seven-segment-display

我正在尝试将阵列内的数据输出到DE1-SoC板上的7段显示器。

这是我的变量:

display : out std_logic_vector (6 downto 0);

type bigDisplay is array (0 to 4, 0 to 6) of bit;

signal displayArray : bigDisplay;

代码如下:

display <= displayArray (0, 6-0);

这是我收到的错误:

Error (10381): VHDL Type Mismatch error at Final_Project.vhd(326): indexed name returns a value whose type does not match "std_logic_vector", the type of the target expression

所以,我猜我需要将我的位数组转换为输出到std_logic_vector吗?我该怎么办?

1 个答案:

答案 0 :(得分:2)

使用bit的任何特殊原因?您可以轻松地创建std_logic_vector的数组:

type bigDisplay is array(0 to 4) of std_logic_vector(6 downto 0);
signal displayArray : bigDisplay;

然后简单地(当然,在用值初始化displayArray之后):

display <= displayArray(0);

Etc或所需的任何索引,以便将数组中的值分配给显示。