【问题标题】:Array of STD_LOGIC_VECTORSTD_LOGIC_VECTOR 数组
【发布时间】:2016-04-27 06:13:32
【问题描述】:

我想创建一个可以将 std_logic_vectors 作为其元素的数组,但我不确定如何将元素放入数组中。

我创建数组的代码如下:

type ist_array is array (0 to 1) of std_logic_vector(31 downto 0);

我想在这个数组中放置 2 个 32 位向量。向量是输入端口。

但是从这里开始,我不确定如何将我的向量放入数组中。

我该怎么做?

【问题讨论】:

    标签: arrays vector vhdl


    【解决方案1】:

    不知道为什么它在没有解释的情况下被否决。

    我通过试用和调试找到的解决方案是:

    type ist_array is array (0 to 1) of std_logic_vector(31 downto 0);
    variable Instructions: ist_array;
    

    ist_array 是我要创建的数组的类型,Instructions 是类型为 ist_array 的变量的声明。

    然后,将一个向量放入这个数组中,我只需这样做:

    Instructions(0) := a_vector(31 downto 0);
    

    【讨论】:

      猜你喜欢
      • 2023-03-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-04-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多