1 Star 0 Fork 2

RehemChan/VHDL Coding

forked from 寇小凯/VHDL Coding 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
ram.vhd 863 Bytes
一键复制 编辑 原始数据 按行查看 历史
寇小凯 提交于 2016-09-24 18:13 . Upload ram.vhd rom.vhd
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity ram is
port (
addr:in std_logic_vector(4 downto 0);
wr:in std_logic;
rd:in std_logic;
cs:in std_logic;
datain:in std_logic_vector(7 downto 0);
dataout:out std_logic_vector(7 downto 0));
end ram;
architecture one of ram is
type memory is array(0 to 31)of std_logic_vector(7 downto 0);
signal data1:memory;
signal addr1:integer range 0 to 31;
begin
addr1<=conv_integer(addr);
process(wr,cs,addr1,data1,datain)
begin
if cs='0' and wr='1' then
data1(addr1)<=datain;
end if;
end process;
process(rd,cs,addr1,data1)
begin
if cs='0' and rd='1' then
dataout<=data1(addr1);
else
dataout<=(others=>'Z');
end if;
end process;
end one;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
VHDL
1
https://gitee.com/RehemChan/VHDL-Coding.git
git@gitee.com:RehemChan/VHDL-Coding.git
RehemChan
VHDL-Coding
VHDL Coding
master

搜索帮助