forked from gardners/c65gs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ghdl_videobuffer.vhdl
41 lines (35 loc) · 1023 Bytes
/
ghdl_videobuffer.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
41
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use ieee.numeric_std.all;
use work.debugtools.all;
ENTITY videobuffer IS
PORT (
clka : IN STD_LOGIC;
wea : IN STD_LOGIC_VECTOR(0 DOWNTO 0);
addra : IN STD_LOGIC_VECTOR(11 DOWNTO 0);
dina : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
clkb : IN STD_LOGIC;
addrb : IN STD_LOGIC_VECTOR(11 DOWNTO 0);
doutb : OUT STD_LOGIC_VECTOR(7 DOWNTO 0)
);
END videobuffer;
architecture behavioural of videobuffer is
type ram_t is array (0 to 4095) of std_logic_vector(7 downto 0);
signal ram : ram_t := (
others => x"65" );
begin
PROCESS(Clka,addrb,ram)
BEGIN
--report "viciv reading charrom address $"
-- & to_hstring(address)
-- & " = " & integer'image(to_integer(address))
-- & " -> $" & to_hstring(ram(to_integer(address)))
-- severity note;
doutb <= ram(to_integer(unsigned(addrb)));
if(rising_edge(Clka)) then
if(wea(0)='1') then
ram(to_integer(unsigned(addra))) <= dina;
end if;
end if;
END PROCESS;
end Behavioural;