首页 | 新闻 | 新品 | 文库 | 方案 | 视频 | 下载 | 商城 | 开发板 | 数据中心 | 座谈新版 | 培训 | 工具 | 博客 | 论坛 | 百科 | GEC | 活动 | 主题月 | 电子展
返回列表 回复 发帖

急求8位ROM的VHDL程序!

给你一个简单的 希望对你有帮助

Library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;


Entity Rams is
Port (
Writeen : in std_logic;
Wclk : in std_logic;
Datain : in std_logic_vector(7 downto 0);
Dataout : out std_logic_vector(7 downto 0);
Addr : in std_logic_vector(3 downto 0)
);
END Rams;-- Entity Ends

Architecture Behave of Rams is
Type Mem is array ( 15 downto 0) of std_logic_vector( 7 downto 0);
Signal Memory : Mem;

Begin
Write_Process : Process(Wclk)
Begin
if (Wclk'event and Wclk = '1') then
if ( Writeen = '1') then
Memory(Conv_Integer(Addr)) <= Datain;
end if;
end if;
end process; -- Write Process Ends

Dataout <= Memory(Conv_Integer(Addr));

End Behave;-- Architecture Ends
返回列表