我如何在 VHDL 中初始化 std_logic_vector?
how do i initialize a std_logic_vector in VHDL?
我有一个 std_logic_vector(4096 downto 0) 信号,我想像下面这样初始化它:
architecture Behavioral of test is
type ram_type is array(4095 downto 0) of std_logic_vector(15 downto 0);
signal ram : ram_type;
ram(0) := "0010000000000100";
ram(1) := "0001000000000101";
ram(2) := "0011000000000110";
ram(3) := "0111000000000001";
ram(4) := "0000000000001100";
ram(5) := "0000000000000011";
ram(6) := "0000000000000000";
ram(4095 downto 7) := (others => (others => '0'));
begin
"some code"
end behavioral
出于某种原因,我需要使用这些值对其进行初始化(我无法将这些值分配给它,必须对其进行初始化)
甚至有什么办法吗?我试过上面的代码,但没有用
ram
可以像这样初始化:
architecture Behavioral of test is
type ram_type is array(4095 downto 0) of std_logic_vector(15 downto 0);
signal ram : ram_type := (0 => "0010000000000100",
1 => "0001000000000101",
2 => "0011000000000110",
3 => "0111000000000001",
4 => "0000000000001100",
5 => "0000000000000011",
6 => "0000000000000000",
others => (others => '0'));
begin
-- Concurrent code
end Behavioral;
但您可能想查看特定的 FPGA 和工具功能,看看是否有一些特定的方法可以将初始化值提供给 RAM,以便综合工具可以正确映射它。
我有一个 std_logic_vector(4096 downto 0) 信号,我想像下面这样初始化它:
architecture Behavioral of test is
type ram_type is array(4095 downto 0) of std_logic_vector(15 downto 0);
signal ram : ram_type;
ram(0) := "0010000000000100";
ram(1) := "0001000000000101";
ram(2) := "0011000000000110";
ram(3) := "0111000000000001";
ram(4) := "0000000000001100";
ram(5) := "0000000000000011";
ram(6) := "0000000000000000";
ram(4095 downto 7) := (others => (others => '0'));
begin
"some code"
end behavioral
出于某种原因,我需要使用这些值对其进行初始化(我无法将这些值分配给它,必须对其进行初始化) 甚至有什么办法吗?我试过上面的代码,但没有用
ram
可以像这样初始化:
architecture Behavioral of test is
type ram_type is array(4095 downto 0) of std_logic_vector(15 downto 0);
signal ram : ram_type := (0 => "0010000000000100",
1 => "0001000000000101",
2 => "0011000000000110",
3 => "0111000000000001",
4 => "0000000000001100",
5 => "0000000000000011",
6 => "0000000000000000",
others => (others => '0'));
begin
-- Concurrent code
end Behavioral;
但您可能想查看特定的 FPGA 和工具功能,看看是否有一些特定的方法可以将初始化值提供给 RAM,以便综合工具可以正确映射它。