我正在尝试将64位ROM type ROM is array (7 downto 0, 7 downto 0) of std_logic;放进机箱。
那么我想要创建constant R :ROM :=。
如果R(0, 7 downto 0 )是"00010011"的值,
R(0, ) R(1, )由一个3位指针值选择,然后按公式输出:
for i in 0 to 7 loop
Data_Out(i) <= R(conv_integer(AArray),i);
end loop;.但是,如果我试图定义ROM的常量值,就会出现一个错误,有人可以为这个数组指出正确的定义常量的方法。
发布于 2016-06-06 09:36:12
对于更复杂的初始化值,通常需要创建一个返回要赋值的常量值的函数,例如:
type ROM is array (7 downto 0, 7 downto 0) of std_logic;
function ROM_init return ROM is
variable res_v : ROM;
begin
-- Write code that assigns initial value to res_v
return res_v;
end function;
constant R : ROM := ROM_init;如果实际上需要一个向量数组,则可以考虑执行以下操作:
type ROM is array (7 downto 0) of std_logic_vector(7 downto 0);
function ROM_init return ROM is
variable res_v : ROM;
begin
res_v(0) := "00010011"; -- Value from question
-- Write more code that assigns initial value to res_v;
return res_v;
end function;
constant R : ROM := ROM_init;请注意,综合工具可能不会将其实现为ROM内存块,而只是作为一个简单的逻辑网络来实现。
https://stackoverflow.com/questions/37653559
复制相似问题