I'm tasked with designing a cache and cache controller. I'm reading the 16 bytes for a block from memory and writing it to the cache. On the last byte of the block only, the data_array isn't updated and remains 0s. I've managed to isolate an unexpected behavior down to one instruction weirdly not executing.
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;
This is the output.
# ** 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
The output shows the line assigning m_readdata to the data_array not executing somehow. Nowhere else is the data array being modified.