⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 my_ram_vhdl.vhd

📁 how to infer ram for fpga altera xilinx
💻 VHD
字号:
-- Quartus II VHDL Template-- Single port RAM with single read/write address library ieee;use ieee.std_logic_1164.all;entity my_ram_vhdl is	generic 	(		DATA_WIDTH : natural := 8;		ADDR_WIDTH : natural := 6	);	port 	(		clk		: in std_logic;		addr	: in natural range 0 to 2**ADDR_WIDTH - 1;		data	: in std_logic_vector((DATA_WIDTH-1) downto 0);		we		: in std_logic := '1';		q		: out std_logic_vector((DATA_WIDTH -1) downto 0)	);end entity;architecture rtl of my_ram_vhdl is	-- Build a 2-D array type for the RAM	subtype word_t is std_logic_vector((DATA_WIDTH-1) downto 0);	type memory_t is array(2**ADDR_WIDTH-1 downto 0) of word_t;	-- Declare the RAM signal.		signal ram : memory_t;	-- Register to hold the address 	signal addr_reg : natural range 0 to 2**ADDR_WIDTH-1;begin	process(clk)	begin	if(rising_edge(clk)) then		if(we = '1') then			ram(addr) <= data;		end if;		-- Register the address for reading		addr_reg <= addr;	end if;	end process;	q <= ram(addr_reg);end rtl;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -