forked from MiSTer-devel/Arcade-Scramble_MiSTer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscramble_top.vhd
186 lines (170 loc) · 6.04 KB
/
scramble_top.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
--
-- A simulation model of Scramble hardware
-- Copyright (c) MikeJ - Feb 2007
--
-- All rights reserved
--
-- Redistribution and use in source and synthezised forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- Redistributions of source code must retain the above copyright notice,
-- this list of conditions and the following disclaimer.
--
-- Redistributions in synthesized form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
--
-- Neither the name of the author nor the names of other contributors may
-- be used to endorse or promote products derived from this software without
-- specific prior written permission.
--
-- THIS CODE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
--
-- You are responsible for any legal issues arising from your use of this code.
--
-- The latest version of this file can be found at: www.fpgaarcade.com
--
-- Email [email protected]
--
-- Revision list
--
-- version 001 initial release
--
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity SCRAMBLE_TOP is
port (
O_VIDEO_R : out std_logic_vector(3 downto 0);
O_VIDEO_G : out std_logic_vector(3 downto 0);
O_VIDEO_B : out std_logic_vector(3 downto 0);
O_HSYNC : out std_logic;
O_VSYNC : out std_logic;
O_HBLANK : out std_logic;
O_VBLANK : out std_logic;
O_AUDIO : out std_logic_vector(9 downto 0);
ip_dip_switch : in std_logic_vector(5 downto 1);
ip_1p : std_logic_vector(6 downto 0);
ip_2p : std_logic_vector(6 downto 0);
ip_service : std_logic;
ip_coin1 : std_logic;
ip_coin2 : std_logic;
dn_addr : in std_logic_vector(15 downto 0);
dn_data : in std_logic_vector(7 downto 0);
dn_wr : in std_logic;
RESET : in std_logic;
clk : in std_logic; -- 25
ena_12 : in std_logic; -- 6.25 x 2
ena_6 : in std_logic; -- 6.25 (inverted)
ena_6b : in std_logic; -- 6.25
ena_1_79 : in std_logic -- 1.786
);
end;
architecture RTL of SCRAMBLE_TOP is
-- this MUST be set true for frogger
-- this MUST be set false for scramble, the_end, amidar
constant I_HWSEL_FROGGER : boolean := false;
-- ties to audio board
signal audio_addr : std_logic_vector(15 downto 0);
signal audio_data_out : std_logic_vector(7 downto 0);
signal audio_data_in : std_logic_vector(7 downto 0);
signal audio_data_oe_l : std_logic;
signal audio_rd_l : std_logic;
signal audio_wr_l : std_logic;
signal audio_iopc7 : std_logic;
signal audio_reset_l : std_logic;
begin
u_scramble : entity work.SCRAMBLE
port map (
I_HWSEL_FROGGER => I_HWSEL_FROGGER,
--
O_VIDEO_R => O_VIDEO_R,
O_VIDEO_G => O_VIDEO_G,
O_VIDEO_B => O_VIDEO_B,
O_HSYNC => O_HSYNC,
O_VSYNC => O_VSYNC,
O_HBLANK => O_HBLANK,
O_VBLANK => O_VBLANK,
--
-- to audio board
--
O_ADDR => audio_addr,
O_DATA => audio_data_out,
I_DATA => audio_data_in,
I_DATA_OE_L => audio_data_oe_l,
O_RD_L => audio_rd_l,
O_WR_L => audio_wr_l,
O_IOPC7 => audio_iopc7,
O_RESET_WD_L => audio_reset_l,
--
dn_addr => dn_addr,
dn_data => dn_data,
dn_wr => dn_wr,
--
ENA => ena_6,
ENAB => ena_6b,
ENA_12 => ena_12,
--
RESET => reset,
CLK => clk
);
--
--
-- audio subsystem
--
u_audio : entity work.SCRAMBLE_AUDIO
port map (
I_HWSEL_FROGGER => I_HWSEL_FROGGER,
--
I_ADDR => audio_addr,
I_DATA => audio_data_out,
O_DATA => audio_data_in,
O_DATA_OE_L => audio_data_oe_l,
--
I_RD_L => audio_rd_l,
I_WR_L => audio_wr_l,
I_IOPC7 => audio_iopc7,
--
O_AUDIO => O_AUDIO,
--
I_1P_CTRL => ip_1p, -- start, shoot1, shoot2, left,right,up,down
I_2P_CTRL => ip_2p, -- start, shoot1, shoot2, left,right,up,down
I_SERVICE => ip_service,
I_COIN1 => ip_coin1,
I_COIN2 => ip_coin2,
O_COIN_COUNTER => open,
--
I_DIP => ip_dip_switch,
--
dn_addr => dn_addr,
dn_data => dn_data,
dn_wr => dn_wr,
--
I_RESET_L => audio_reset_l,
ENA => ena_6,
ENA_1_79 => ena_1_79,
CLK => clk
);
--button_in(0) = Joystick Up
--button_in(1) = Joystick Down
--button_in(2) = Joystick Left
--button_in(3) = Joystick Right
--button_in(4) = Button Left
--button_in(5) = Button Down
--button_in(6) = Joystick Fire
--button_in(7) = Button Right
--Buttons are connected to ground and connect to 3.3V when pressed
--Joystick has internal pullup resistor and connects to ground when pressed
--A '0' on the input is active. Inputs are active low.
end RTL;