我的任务是设计一个缓存和缓存控制器。我正在从内存中读取一个块的16个字节,并将其写入缓存。仅在块的最后一个字节上,data_array不会更新,并保持为0。我已经成功地将意外行为隔离为一条奇怪的不执行的指令。
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity cache is
...
port(
...
m_readdata : in std_logic_vector (7 downto 0);
...
);
end cache;
architecture arch of cache is
...
type Data_Array_Type is array (31 downto 0) of std_logic_vector(127 downto 0);
signal data_array : Data_Array_Type := (others=> (others=>'0'));
...
begin
process(clock, reset)
begin
...
data_array (index) (127 downto 120) <= m_readdata;
report "m_readdata: " & integer'image(to_integer(unsigned(m_readdata)));
report "data_array (index) (127 downto 120): " & integer'image(to_integer(unsigned(data_array (index) (127 downto 120))));
...
end process;
end arch;这是输出。
# ** Note: m_readdata: 255
# Time: 195500 ps Iteration: 0 Instance: /cache_tb/dut
# ** Note: data_array (index) (127 downto 120): 0
# Time: 195500 ps Iteration: 0 Instance: /cache_tb/dut输出显示了将m_readdata分配给data_array的这行代码没有以某种方式执行。其他任何地方都不会修改数据数组。
发布于 2021-03-08 12:52:06
这太奇怪了。很明显,这是因为VHDL直到下一次运行才会更新进程内部的值。在这里https://stackoverflow.com/a/13956532/7923070解释得更清楚了。
https://stackoverflow.com/questions/66524344
复制相似问题