blob: f600fcf8b5902d8525d3b6fb96e003b9be8b2d6a (
plain)
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
|
library ieee;
use ieee.std_logic_1164.all,
ieee.numeric_std.all;
entity ent is
port (
clk : in std_logic;
addr : in std_logic_vector(2 downto 0);
wr_data : in std_logic_vector(3 downto 0);
rd_data : out std_logic_vector(3 downto 0)
);
end ent;
architecture a of ent is
type ram_type is array (0 to 7) of std_logic_vector(3 downto 0);
signal ram : ram_type := (others => (others => '0'));
begin
process(clk)
begin
if rising_edge(clk) then
ram(to_integer(unsigned(addr))) <= wr_data;
rd_data <= ram(to_integer(unsigned(addr)));
end if;
end process;
end;
|