-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFlappy_Gate.vhd.bak
116 lines (82 loc) · 2.77 KB
/
Flappy_Gate.vhd.bak
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
104
105
106
107
108
109
110
111
112
113
114
115
116
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.numeric_std.all;
USE ieee.std_logic_unsigned.ALL;
-- Entity declaration
-- Defines the interface to the entity
ENTITY Flappy_Gate IS
PORT
(
-- Note: It is easier to identify individual ports and change their order
-- or types when their declarations are on separate lines.
-- This also helps the readability of your code.
-- Clocks
CLOCK_50 : IN STD_LOGIC; -- 50 MHz
-- Buttons
KEY : IN STD_LOGIC_VECTOR (3 downto 0); -- Push buttons
-- Input switches
SW : IN STD_LOGIC_VECTOR (17 downto 0); -- DPDT switches
-- VGA output
VGA_BLANK_N : out std_logic; -- BLANK
VGA_CLK : out std_logic; -- Clock
VGA_HS : out std_logic; -- H_SYNC
VGA_SYNC_N : out std_logic; -- SYNC
VGA_VS : out std_logic; -- V_SYNC
VGA_R : out unsigned(7 downto 0); -- Red[9:0]
VGA_G : out unsigned(7 downto 0); -- Green[9:0]
VGA_B : out unsigned(7 downto 0) -- Blue[9:0]
);
END VGA_Ball;
-- Architecture body
-- Describes the functionality or internal implementation of the entity
ARCHITECTURE structural OF Flappy_Gate IS
COMPONENT VGA_SYNC_module
PORT( clock_50Mhz, red, green, blue : IN STD_LOGIC;
red_out, green_out, blue_out, horiz_sync_out,
vert_sync_out, video_on, pixel_clock : OUT STD_LOGIC;
pixel_row, pixel_column: OUT STD_LOGIC_VECTOR(9 DOWNTO 0));
END COMPONENT;
COMPONENT ball
PORT(pixel_row, pixel_column : IN std_logic_vector(9 DOWNTO 0);
Red,Green,Blue : OUT std_logic;
Vert_sync : IN std_logic);
END COMPONENT;
SIGNAL red_int : STD_LOGIC;
SIGNAL green_int : STD_LOGIC;
SIGNAL blue_int : STD_LOGIC;
SIGNAL video_on_int : STD_LOGIC;
SIGNAL vert_sync_int : STD_LOGIC;
SIGNAL horiz_sync_int : STD_LOGIC;
SIGNAL pixel_clock_int : STD_LOGIC;
SIGNAL pixel_row_int :STD_LOGIC_VECTOR(9 DOWNTO 0);
SIGNAL pixel_column_int :STD_LOGIC_VECTOR(9 DOWNTO 0);
BEGIN
VGA_R(6 DOWNTO 0) <= "0000000";
VGA_G(6 DOWNTO 0) <= "0000000";
VGA_B(6 DOWNTO 0) <= "0000000";
VGA_HS <= horiz_sync_int;
VGA_VS <= vert_sync_int;
U1: VGA_SYNC_module PORT MAP
(clock_50Mhz => CLOCK_50,
red => red_int,
green => green_int,
blue => blue_int,
red_out => VGA_R(7),
green_out => VGA_G(7),
blue_out => VGA_B(7),
horiz_sync_out => horiz_sync_int,
vert_sync_out => vert_sync_int,
video_on => VGA_BLANK_N,
pixel_clock => VGA_CLK,
pixel_row => pixel_row_int,
pixel_column => pixel_column_int
);
U2: ball PORT MAP
(pixel_row => pixel_row_int,
pixel_column => pixel_column_int,
Red => red_int,
Green => green_int,
Blue => blue_int,
Vert_sync => vert_sync_int
);
END structural;