-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathram.vhd
More file actions
28 lines (28 loc) · 849 Bytes
/
ram.vhd
File metadata and controls
28 lines (28 loc) · 849 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
------------------------------------------------------------------------
entity ram is
port(
clk : in std_logic;
address : in unsigned(6 downto 0);
wr_en : in std_logic;
data_in : in unsigned(15 downto 0);
data_out : out unsigned(15 downto 0)
);
end entity;
------------------------------------------------------------------------
architecture a_ram of ram is
type mem is array (0 to 127) of unsigned(15 downto 0);
signal content_ram : mem;
begin
process(clk,wr_en)
begin
if rising_edge(clk) then
if wr_en='1' then
content_ram(to_integer(address)) <= data_in;
end if;
end if;
end process;
data_out <= content_ram(to_integer(address));
end architecture;