네, 물론 가능합니다. Xilinx Synthesis Tool (XST) User guide, 특히 187 쪽을보십시오.
이렇게하기 위해 권장하는 코드는 다음과 같습니다. 사용자 가이드에는 읽을 파일 형식에 관한 메모가 있습니다. 이 코드를 직접 제네릭을 사용하지 않습니다,하지만 난 당신이 가능하게 파일 이름의 이름을 개최 일정 또는 일반을 설정할 수 있다는 것을 상상할 수 ...
--
-- Initializing Block RAM from external data file
--
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use std.textio.all;
entity rams_20c is
port(clk : in std_logic;
we : in std_logic;
addr : in std_logic_vector(5 downto 0);
din : in std_logic_vector(31 downto 0);
dout : out std_logic_vector(31 downto 0));
end rams_20c;
architecture syn of rams_20c is
type RamType is array(0 to 63) of bit_vector(31 downto 0);
impure function InitRamFromFile (RamFileName : in string) return RamType is
FILE RamFile : text is in RamFileName;
variable RamFileLine : line;
variable RAM : RamType;
begin
for I in RamType’range loop
readline (RamFile, RamFileLine);
read (RamFileLine, RAM(I));
end loop;
return RAM;
end function;
signal RAM : RamType := InitRamFromFile("rams_20c.data");
begin
process (clk)
begin
if clk’event and clk = ’1’ then
if we = ’1’ then
RAM(conv_integer(addr)) <= to_bitvector(din);
end if;
dout <= to_stdlogicvector(RAM(conv_integer(addr)));
end if;
end process;
end syn;
감사를 보여줍니다. 필자는 파일 이름으로 일반 문자열을 사용하도록 관리했습니다. – boffin