forked from gardners/c65gs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ghdl_ram18x2k.vhdl
40 lines (32 loc) · 888 Bytes
/
ghdl_ram18x2k.vhdl
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
29
30
31
32
33
34
35
36
37
38
39
40
use WORK.ALL;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use ieee.numeric_std.all;
use Std.TextIO.all;
use work.debugtools.all;
ENTITY ram18x2k IS
PORT (
clkl : IN STD_LOGIC;
wel : IN STD_LOGIC_VECTOR(0 DOWNTO 0);
addrl : IN STD_LOGIC_VECTOR(10 DOWNTO 0);
dinl : IN STD_LOGIC_VECTOR(17 DOWNTO 0);
clkr : IN STD_LOGIC;
addrr : IN STD_LOGIC_VECTOR(10 DOWNTO 0);
doutr : OUT STD_LOGIC_VECTOR(17 DOWNTO 0)
);
END ram18x2k;
architecture behavioural of ram18x2k is
type ram_t is array (0 to 2047) of std_logic_vector(17 downto 0);
signal ram : ram_t;
begin -- behavioural
process(clkl)
variable theram : ram_t;
begin
if(rising_edge(Clkl)) then
if wel(0)='1' then
ram(to_integer(unsigned(addrl))) <= dinl;
end if;
doutr <= ram(to_integer(unsigned(addrr)));
end if;
end process;
end behavioural;