FPGA에서 BRAM 초기화는 CORE 생성기를 사용하여 수행 할 수 있지만 합성 도구가 BRAM 또는 조회 테이블 (LUT)을 추론하도록 VHDL을 작성하는 것을 선호합니다. 참고로, 나는 RAM 생성/초기화에 Core Gen을 사용하지 않습니다.
데이터의 형식이 확실하지 않지만 각 행에 바이너리 문자열이 들어있는 텍스트 파일을 읽는 방법에 대한 VHDL 코드 스 니펫은 파일 내용과 함께 신호를 생성합니다. 미리 파일의 형식과 길이를 알아야합니다.
-- define a type for the lookup table (LUT)
type lut_type is array(0 to 2**12-1) of std_logic_vector(15 downto 0);
impure function init_lut_from_file(lut_file_name : in string)
return lut_type is
FILE lut_file : TEXT open READ_MODE is lut_file_name;
variable lut_line : line;
variable bv_temp : bit_vector(15 downto 0);
variable lut : lut_type;
begin
for i in lut_type'range loop
readline(lut_file, lut_line);
read(lut_line, bv_temp);
lut(i) := to_stdlogicvector(bv_temp);
end loop;
return lut;
end function;
signal lut : lut_type := init_lut_from_file("c:\data.txt");
상기 불순한 함수 2^12 = 4096 개의 엔트리를 LUT에 파일의 각 라인에 포함 c:\data.txt
16 비트 이진 문자열을 읽을 것이다.
평소와 같이 을 쓰려면 추가 코드를 작성하여 lut
에 쓰십시오.
[COE 파일 구문] (http://www.xilinx.com/itp/xilinx10/isehelp/cgn_r_coe_file_syntax.htm) 및 [AR # 11744 CORE Generator - 메모리 코어 용 COE 파일 생성을위한 힌트 (블록 메모리, Dist 메모리, ROM, RAM 등)] (http://www.xilinx.com/support/answers/11744.html). [자일링스 FPGA를위한 COE 파일로 BRAM을 초기화하는 방법] (http://tipsarea.com/2014/05/21/how-to-initialize-bram-with-coe-file-for-xilinx-fpga/) ISE 버전이 GUI에서 메모리 편집기 액세스를 차단하는 경우. 인터넷 검색 * COE 자일링스 ISE *를 발견했습니다. – user1155120
[COGen v0.01 - 자일링스 FPGA 블록 RAM 용 바이너리 파일에서 .coe 파일 생성 (https://wornwinter.wordpress.com/2015/02/07/coegen-v0-01-generate-coe-files-from) -binary-files-for-xilinx-fpga-block-ram /)을 사용하십시오. 검색 용어 * 바이너리를 COE 형식의 Xilinx *로 검색합니다. – user1155120
[SRecord 1.64] (http://srecord.sourceforge.net/download.html)에는 동일한 검색 용어 인 libboost (COEGen도 필요)가 필요합니다. – user1155120