-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVGAADAPTER.vhd
104 lines (98 loc) · 2.91 KB
/
VGAADAPTER.vhd
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
----------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 20:59:48 12/05/2017
-- Design Name:
-- Module Name: VGAADAPTER - Behavioral
-- Project Name:
-- Target Devices:
-- Tool versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;
-- Uncomment the following library declaration if instantiating
-- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity VGAADAPTER is
port(
CLKout : in std_logic; -- normal clock
CLKin : in std_logic; -- 50M
Reset : in std_logic; -- reset
hs,vs : out std_logic; -- connect to vga port
r,g,b : out std_logic_vector(2 downto 0); -- connect to vga
CharWea : in std_logic_vector(0 downto 0); -- VGAWE, if address > F800 and be in a write state
CharAddra : in std_logic_vector(10 downto 0); -- VGA address, address to write
CharDina : in std_logic_vector(7 downto 0); -- VGA data to write
CharDouta : out std_logic_vector(7 downto 0); -- open (no use?)
UpdateType : in std_logic_vector(1 downto 0) -- always "00", make EN = 1
);
end VGAADAPTER;
architecture Behavioral of VGAADAPTER is
component CHAR is
port(
CLKout : in std_logic;
CLKin : in std_logic;
Reset : in std_logic;
EN : in std_logic;
-- CharBufferA
CharAddra : in std_logic_vector(10 downto 0);
CharDina : in std_logic_vector(7 downto 0);
-- GRam
GRamAddra : out std_logic_vector(14 downto 0);
GRamDina : out std_logic_vector(15 downto 0);
CharWea : in std_logic_vector( 0 downto 0);
CharDouta : out std_logic_vector(7 downto 0)
);
end component;
component VGA is
port(
reset : in STD_LOGIC;
clk_0 : in STD_LOGIC;
hs,vs : out STD_LOGIC;
r,g,b : out STD_LOGIC_vector(2 downto 0);
GRamAddra : in std_logic_vector(14 downto 0);
GRamDina : in std_logic_vector(15 downto 0)
);
end component;
signal GRamAddra_in : std_logic_vector(14 downto 0);
signal GRamDina_in : std_logic_vector(15 downto 0);
signal CharAdapterEN : std_logic;
begin
CharAdapter_c : CHAR port map(
CLKout => CLKout,
CLKin => CLKin,
Reset => Reset,
CharAddra => CharAddra,
CharDina => CharDina,
CharWea => CharWea,
CharDouta => CharDouta,
GRamAddra => GRamAddra_in,
GRamDina => GRamDina_in,
EN => CharAdapterEN
);
VGACore_c: VGA port map(
reset => Reset,
clk_0 => CLKin,
hs => hs,
vs => vs,
r => r,
g => g,
b => b,
GRamAddra => GRamAddra_in,
GRamDina => GRamDina_in
);
CharAdapterEN <= '1' when UpdateType = "00" else '0';
end Behavioral;