gpt4 book ai didi

vhdl - 在VHDL中定义Matrix2D的初始值

转载 作者:行者123 更新时间:2023-12-02 17:24:33 26 4
gpt4 key购买 nike

我在为 VHDL 中的 matrix2D 信号类型赋予初始值 0 时遇到问题。我定义如下:

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定义初始值零?

最佳答案

我的 Ashenden 副本的第 86 页州

We can also use aggregates to write multi-dimensional array values. In this case, we treat the array as though it were an array of arrays, writing an array aggregate for each of the leftmost index values first.

这是您的示例所需要的:

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

关于vhdl - 在VHDL中定义Matrix2D的初始值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11467493/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com