type dmemSpace is array(0 to 1023) of std_logic_vector(31 downto 0);
signal dataMem : dmemSpace := (
400 => X"00000000",
404 => X"00001000",
408 => X"FFFFEFFF",
others => X"00000000"
);
signal dAddr : std_logic_vector(31 downto 0);
signal check : integer;
dAddr(31 downto 0) <= Addr(31 downto 2) & "00";
check <= to_integer(unsigned(dAddr));
DataOut <= dataMem(to_integer(unsigned(dAddr))) when (check > 0);
又是我......
DataOut <= dataMem(to_integer(unsigned(dAddr))) when (check > 0);
我想防止 DataOut 出现索引越界错误,但这不起作用。有任何想法吗?
Check > 0
防止所有数据流出。Check >= 0
让错误通过...当导致异常的索引为-4时。