【问题标题】:Defining initial value for Matrix2D in VHDL在 VHDL 中定义 Matrix2D 的初始值
【发布时间】:2012-07-13 09:13:25
【问题描述】:

我在 VHDL 中将初始值零赋予矩阵 2D 的信号类型时遇到问题。我是这样定义的:

type matrix2D is array (integer range <> , integer range <> ) of signed(2 downto 0);

在我的初始值的 VHDL 代码中我写道:

process(matrix1, matrix2, s_out_adder)
  variable v_flipflop_adder: matrix2D(0 to 4, 0 to 4) :=((0 to 4),(others =>(others=>'0')));
begin   
....

但不幸的是它不起作用。

有谁知道我如何为 matrix2D 定义初始值零?

【问题讨论】:

    标签: vhdl fpga


    【解决方案1】:

    我的Ashenden 状态副本的第 86 页

    我们还可以使用聚合来编写多维数组值。在这种情况下,我们将数组视为数组的数组,首先为每个最左边的索引值编写一个数组聚合。

    这是您的示例所需要的:

    variable v_flipflop_adder_simple_init: matrix2D(0 to 4, 0 to 4) :=
           (others => (others => (others => '0')));
    

    这里有一个更复杂的:

    variable v_flipflop_adder: matrix2D(0 to 4, 0 to 5) :=
           (      4 => (1 => "001", others => "101"),
             others => (5 => "110", others => "010"));
    

    【讨论】:

      猜你喜欢
      • 2022-08-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多