Quartus初始化RAM [英] Quartus initializing RAM
本文介绍了Quartus初始化RAM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建了一个实体,Quartus在其中成功识别了RAM,并为其实例化了RAM宏功能.如果可以从文件初始化该RAM,那就太好了.我找到了制作此类文件(.mif文件)的教程.现在,我已经创建了该文件,现在我不知道如何使quartus初始化该模块.感谢您的帮助.
I made an entity in which quartus successfully recognizes RAM, and instantiates a RAM megafunction for it. It would be nice if I could initialize that RAM from a file. I found tutorials for making such file (.mif file). Now that I have created that file, i don't know how to make quartus initialize that module. Any help is appreciated.
这是我的RAM实体:
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity RAM is
port (
clk: in std_logic;
we: in std_logic;
data_in: in std_logic_vector (7 downto 0);
read_addr: in integer range 0 to 65535;
write_addr: in integer range 0 to 65535;
data_out: out std_logic_vector (7 downto 0)
);
end entity RAM;
architecture RAM_arch of RAM is
type memory is array (65535 downto 0) of std_logic_vector (7 downto 0);
signal content: memory;
begin
process(clk)
begin
if (RISING_EDGE(clk)) then
if (we = '1') then
content(write_addr) <= data_in;
end if;
data_out <= content(read_addr);
end if;
end process;
end architecture;
推荐答案
在此文档,这是从文件初始化内存的正确方法:
As specified in this document this is the proper way to init memory from file:
signal content: memory;
attribute ram_init_file : string;
attribute ram_init_file of content:
signal is "init.mif";
这篇关于Quartus初始化RAM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文