1

我正在尝试将数组内的数据输出到我的 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?我该怎么做?

4

1 回答 1

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);

等等,或者你想要的任何索引,以便将数组中的值分配给显示器。

于 2018-12-05T20:46:58.843 回答