我需要從定義的VHDL(.vhd)文件中讀取數據。該文件是這樣的:從另一個體繫結構中讀取VHDL數據
entity ROM is
port (address : in std_logic_vector(3 downto 0);
data : out std_logic_vector(7 downto 0));
end entity ROM;
architecture behavioral of ROM is
type ROM is array (0 to 2**4 - 1) of std_logic_vector(7 downto 0);
constant my_ROM : ROM := (
0 => "00000000",
1 => "00000001");
begin
data <= my_ROM(to_integer(unsigned(address)));
end architecture behavioral;
我知道類似的問題已發佈,How to read data from rom_type in VHDL?,但我想我還需要它的幫助。假設我有另一個.vhd文件,我應該如何獲取存儲在這個ROM實體中的數據?
除了缺少上下文條款(例如'庫IEEE;使用ieee.std_logic_1164.all;使用ieee.numeric_std.all;')您的代碼示例不分析。用於提供默認值的聚合對於ROM陣列類型中的每個元素都沒有匹配的元素。 (你應該添加一個其他的選擇)。 – user1155120