VHDL에 2 차원 블록 램을 추측하려고합니다. 그러나 정교한 회로는 레지스터와 MUX의 회로로 밝혀졌습니다. 램에 관한 코드의 주요 파일은 다음과 같습니다 사용하는 정수를 포함한자일링스 비바도 VHDL에 2 차원 블록 RAM을 추론
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use work.shared_resources.all;
entity weight_ram is
port (clk : in std_logic;
write_enable : in std_logic;
row_addr : in natural range 0 to max_NR-1;
data_in : in neuron_weight_array;
data_out : out neuron_weight_array);
end weight_ram;
architecture rtl of weight_ram is
signal ram : weight_ram_array;
begin
ram_process : process (clk)
variable f : integer;
begin
if (rising_edge (clk)) then
if (write_enable = '1') then
for f in 0 to n_feature-1 loop
ram (row_addr, f) <= data_in (f);
end loop;
end if;
for f in 0 to n_feature-1 loop
data_out (f) <= ram (row_addr, f);
end loop;
end if;
end process;
end rtl;
파일은 다음과 같습니다
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
package shared_resources is
constant n_feature : integer := 24;
constant max_NR : integer := 10; -- maximum number of neurons allowed
constant weightw : integer := 10; -- width of the weight (1:0:9)
subtype weight_type is signed (weightw-1 downto 0);
type neuron_weight_array is array (0 to n_feature-1) of weight_type;
type weight_ram_array is array (0 to max_NR-1, 0 to n_feature-1) of weight_type;
end shared_resources;
어떻게 코드 블록 RAM으로 추정됩니다 보장 할 수 있는가?
업데이트 : morten zilmer의 답변에 따라 2 차원 배열에서 단일 요소를 읽도록 코드가 업데이트되었습니다. 그러나 여전히 블록 RAM으로 추측되지는 않습니다. 블록 RAM에 액세스 할 때
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use work.shared_resources.all;
entity weight_ram is
port (clk : in std_logic;
write_enable : in std_logic;
row_addr : in natural range 0 to max_NR-1;
col_addr : in natural range 0 to n_feature-1;
data_in : in weight_type;
data_out : out weight_type);
end weight_ram;
architecture rtl of weight_ram is
signal ram : weight_ram_array;
begin
ram_process : process (clk)
variable f : integer;
begin
if (rising_edge (clk)) then
if (write_enable = '1') then
ram (row_addr, col_addr) <= data_in;
end if;
data_out <= ram (row_addr, col_addr);
end if;
end process;
end rtl;
. RAM 추론은 까다 롭습니다. 공급 업체 템플릿을 완벽하게 따르지 않으면 신디사이저가 원하는대로 작동 할 가능성이 거의 없습니다. –