]>
Commit | Line | Data |
---|---|---|
782690d0 MG |
1 | //===============================================================================\r |
2 | // FPGA MOONCRESTA & GALAXIAN \r | |
3 | // FPGA BLOCK RAM I/F (ALTERA-CYCLONE & XILINX SPARTAN2E)\r | |
4 | //\r | |
5 | // Version : 2.50\r | |
6 | //\r | |
7 | // Copyright(c) 2004 Katsumi Degawa , All rights reserved\r | |
8 | //\r | |
9 | // Important !\r | |
10 | //\r | |
11 | // This program is freeware for non-commercial use. \r | |
12 | // An author does no guarantee about this program.\r | |
13 | // You can use this under your own risk.\r | |
14 | //\r | |
15 | // mc_col_rom(6L) added by k.Degawa\r | |
16 | //\r | |
17 | // 2004- 5- 6 first release.\r | |
18 | // 2004- 8-23 Improvement with T80-IP. K.Degawa\r | |
19 | // 2004- 9-18 added Xilinx Device K.Degawa\r | |
20 | //================================================================================\r | |
21 | `include "src/mc_conf.v"\r | |
22 | \r | |
23 | // mc_top.v use\r | |
24 | module mc_cpu_ram (\r | |
25 | \r | |
26 | I_CLK,\r | |
27 | I_ADDR,\r | |
28 | I_D,\r | |
29 | I_WE,\r | |
30 | I_OE,\r | |
31 | O_D\r | |
32 | \r | |
33 | );\r | |
34 | \r | |
35 | input I_CLK;\r | |
36 | input [9:0]I_ADDR;\r | |
37 | input [7:0]I_D;\r | |
38 | input I_WE;\r | |
39 | input I_OE;\r | |
40 | output [7:0]O_D;\r | |
41 | \r | |
42 | wire [7:0]W_D;\r | |
43 | assign O_D = I_OE ? W_D : 8'h00 ;\r | |
44 | \r | |
45 | `ifdef DEVICE_CYCLONE\r | |
46 | alt_ram_1024_8 CPURAM_ALT(\r | |
47 | \r | |
48 | .clock(I_CLK),\r | |
49 | .address(I_ADDR),\r | |
50 | .data(I_D),\r | |
51 | .wren(I_WE),\r | |
52 | .q(W_D)\r | |
53 | \r | |
54 | );\r | |
55 | `endif\r | |
56 | `ifdef DEVICE_SPARTAN2E \r | |
57 | RAMB4_S4 CPURAM_X1(\r | |
58 | \r | |
59 | .CLK(I_CLK),\r | |
60 | .ADDR(I_ADDR[9:0]),\r | |
61 | .DI(I_D[7:4]),\r | |
62 | .DO(W_D[7:4]),\r | |
63 | .EN(1'b1),\r | |
64 | .WE(I_WE),\r | |
65 | .RST(1'b0)\r | |
66 | \r | |
67 | );\r | |
68 | \r | |
69 | RAMB4_S4 CPURAM_X0(\r | |
70 | \r | |
71 | .CLK(I_CLK),\r | |
72 | .ADDR(I_ADDR[9:0]),\r | |
73 | .DI(I_D[3:0]),\r | |
74 | .DO(W_D[3:0]),\r | |
75 | .EN(1'b1),\r | |
76 | .WE(I_WE),\r | |
77 | .RST(1'b0)\r | |
78 | \r | |
79 | );\r | |
80 | `endif\r | |
81 | \r | |
82 | endmodule\r | |
83 | \r | |
84 | // mc_video.v use\r | |
85 | module mc_obj_ram(\r | |
86 | \r | |
87 | I_CLKA,\r | |
88 | I_ADDRA,\r | |
89 | I_WEA,\r | |
90 | I_CEA,\r | |
91 | I_DA,\r | |
92 | O_DA,\r | |
93 | \r | |
94 | I_CLKB,\r | |
95 | I_ADDRB,\r | |
96 | I_WEB,\r | |
97 | I_CEB,\r | |
98 | I_DB,\r | |
99 | O_DB\r | |
100 | \r | |
101 | );\r | |
102 | \r | |
103 | input I_CLKA,I_CLKB;\r | |
104 | input [7:0]I_ADDRA,I_ADDRB;\r | |
105 | input I_WEA,I_WEB;\r | |
106 | input I_CEA,I_CEB;\r | |
107 | input [7:0]I_DA,I_DB;\r | |
108 | output [7:0]O_DA,O_DB;\r | |
109 | \r | |
110 | `ifdef DEVICE_CYCLONE\r | |
111 | alt_ram_256_8_8 OBJRAM(\r | |
112 | \r | |
113 | .clock_a(I_CLKA),\r | |
114 | .address_a(I_ADDRA),\r | |
115 | .wren_a(I_WEA),\r | |
116 | .enable_a(I_CEA),\r | |
117 | .data_a(I_DA),\r | |
118 | .q_a(O_DA),\r | |
119 | \r | |
120 | .clock_b(I_CLKB),\r | |
121 | .address_b(I_ADDRB),\r | |
122 | .wren_b(I_WEB),\r | |
123 | .enable_b(I_CEB),\r | |
124 | .data_b(I_DB),\r | |
125 | .q_b(O_DB)\r | |
126 | \r | |
127 | );\r | |
128 | `endif\r | |
129 | `ifdef DEVICE_SPARTAN2E \r | |
130 | RAMB4_S8_S8 OBJRAM(\r | |
131 | \r | |
132 | .CLKA(I_CLKA),\r | |
133 | .ADDRA({1'b0,I_ADDRA[7:0]}),\r | |
134 | .DIA(I_DA),\r | |
135 | .DOA(O_DA),\r | |
136 | .ENA(I_CEA),\r | |
137 | .WEA(I_WEA),\r | |
138 | .RSTA(1'b0),\r | |
139 | \r | |
140 | .CLKB(I_CLKB),\r | |
141 | .ADDRB({1'b0,I_ADDRB[7:0]}),\r | |
142 | .DIB(I_DB),\r | |
143 | .DOB(O_DB),\r | |
144 | .ENB(I_CEB),\r | |
145 | .WEB(I_WEB),\r | |
146 | .RSTB(1'b0)\r | |
147 | );\r | |
148 | `endif\r | |
149 | \r | |
150 | endmodule\r | |
151 | \r | |
152 | \r | |
153 | // mc_video.v use\r | |
154 | module mc_vid_ram (\r | |
155 | \r | |
156 | I_CLKA,\r | |
157 | I_ADDRA,\r | |
158 | I_DA,\r | |
159 | I_WEA,\r | |
160 | I_CEA,\r | |
161 | O_DA,\r | |
162 | \r | |
163 | I_CLKB,\r | |
164 | I_ADDRB,\r | |
165 | I_DB,\r | |
166 | I_WEB,\r | |
167 | I_CEB,\r | |
168 | O_DB\r | |
169 | \r | |
170 | );\r | |
171 | \r | |
172 | input I_CLKA,I_CLKB;\r | |
173 | input [9:0]I_ADDRA,I_ADDRB;\r | |
174 | input [7:0]I_DA,I_DB;\r | |
175 | input I_WEA,I_WEB;\r | |
176 | input I_CEA,I_CEB;\r | |
177 | output [7:0]O_DA,O_DB;\r | |
178 | \r | |
179 | `ifdef DEVICE_CYCLONE\r | |
180 | alt_ram_1024_8_8 VIDRAM(\r | |
181 | \r | |
182 | .clock_a(I_CLKA),\r | |
183 | .address_a(I_ADDRA),\r | |
184 | .data_a(I_DA),\r | |
185 | .wren_a(I_WEA),\r | |
186 | .enable_a(I_CEA),\r | |
187 | .q_a(O_DA),\r | |
188 | \r | |
189 | .clock_b(I_CLKB),\r | |
190 | .address_b(I_ADDRB),\r | |
191 | .data_b(I_DB),\r | |
192 | .wren_b(I_WEB),\r | |
193 | .enable_b(I_CEB),\r | |
194 | .q_b(O_DB)\r | |
195 | \r | |
196 | );\r | |
197 | `endif\r | |
198 | `ifdef DEVICE_SPARTAN2E \r | |
199 | RAMB4_S4_S4 VIDRAM_X1(\r | |
200 | \r | |
201 | .CLKA(I_CLKA),\r | |
202 | .ADDRA(I_ADDRA[9:0]),\r | |
203 | .DIA(I_DA[7:4]),\r | |
204 | .DOA(O_DA[7:4]),\r | |
205 | .ENA(I_CEA),\r | |
206 | .WEA(I_WEA),\r | |
207 | .RSTA(1'b0),\r | |
208 | \r | |
209 | .CLKB(I_CLKB),\r | |
210 | .ADDRB(I_ADDRB[9:0]),\r | |
211 | .DIB(I_DB[7:4]),\r | |
212 | .DOB(O_DB[7:4]),\r | |
213 | .ENB(I_CEB),\r | |
214 | .WEB(I_WEB),\r | |
215 | .RSTB(1'b0)\r | |
216 | \r | |
217 | );\r | |
218 | \r | |
219 | RAMB4_S4_S4 VIDRAM_X0(\r | |
220 | \r | |
221 | .CLKA(I_CLKA),\r | |
222 | .ADDRA(I_ADDRA[9:0]),\r | |
223 | .DIA(I_DA[3:0]),\r | |
224 | .DOA(O_DA[3:0]),\r | |
225 | .ENA(I_CEA),\r | |
226 | .WEA(I_WEA),\r | |
227 | .RSTA(1'b0),\r | |
228 | \r | |
229 | .CLKB(I_CLKB),\r | |
230 | .ADDRB(I_ADDRB[9:0]),\r | |
231 | .DIB(I_DB[3:0]),\r | |
232 | .DOB(O_DB[3:0]),\r | |
233 | .ENB(I_CEB),\r | |
234 | .WEB(I_WEB),\r | |
235 | .RSTB(1'b0)\r | |
236 | \r | |
237 | );\r | |
238 | `endif\r | |
239 | \r | |
240 | endmodule\r | |
241 | \r | |
242 | // mc_video.v use\r | |
243 | module mc_lram(\r | |
244 | \r | |
245 | I_CLK,\r | |
246 | I_ADDR,\r | |
247 | I_WE,\r | |
248 | I_D,\r | |
249 | O_Dn\r | |
250 | \r | |
251 | );\r | |
252 | \r | |
253 | input I_CLK;\r | |
254 | input [7:0]I_ADDR;\r | |
255 | input [4:0]I_D;\r | |
256 | input I_WE;\r | |
257 | output [4:0]O_Dn;\r | |
258 | wire [4:0]W_D;\r | |
259 | \r | |
260 | `ifdef DEVICE_CYCLONE\r | |
261 | assign O_Dn = ~W_D;\r | |
262 | \r | |
263 | alt_ram_256_5 LRAM(\r | |
264 | \r | |
265 | .inclock(I_CLK),\r | |
266 | .outclock(~I_CLK),\r | |
267 | .address(I_ADDR),\r | |
268 | .data(I_D),\r | |
269 | .wren(I_WE),\r | |
270 | .q(W_D)\r | |
271 | \r | |
272 | );\r | |
273 | `endif\r | |
274 | `ifdef DEVICE_SPARTAN2E\r | |
275 | reg [4:0]O_Dn;\r | |
276 | always@(negedge I_CLK) O_Dn <= ~W_D[4:0] ;\r | |
277 | \r | |
278 | RAMB4_S8 LRAM(\r | |
279 | \r | |
280 | .CLK(I_CLK),\r | |
281 | .ADDR({1'b0,I_ADDR[7:0]}),\r | |
282 | .DI({3'b000,I_D}),\r | |
283 | .DO(W_D),\r | |
284 | .EN(1'b1),\r | |
285 | .WE(I_WE),\r | |
286 | .RST(1'b0)\r | |
287 | \r | |
288 | );\r | |
289 | `endif\r | |
290 | \r | |
291 | endmodule\r | |
292 | \r | |
293 | // mc_col_pal.v use\r | |
294 | `ifdef DEVICE_CYCLONE\r | |
295 | module mc_col_rom(\r | |
296 | \r | |
297 | I_CLK,\r | |
298 | I_ADDR,\r | |
299 | I_OEn,\r | |
300 | O_DO\r | |
301 | \r | |
302 | );\r | |
303 | \r | |
304 | input I_CLK;\r | |
305 | input [4:0]I_ADDR;\r | |
306 | input I_OEn;\r | |
307 | output [7:0]O_DO;\r | |
308 | wire [7:0]W_DO;\r | |
309 | \r | |
310 | assign O_DO = I_OEn ? 8'h00 : W_DO ;\r | |
311 | alt_rom_6l U_6L(\r | |
312 | \r | |
313 | .clock(I_CLK),\r | |
314 | .address(I_ADDR),\r | |
315 | .q(W_DO)\r | |
316 | \r | |
317 | );\r | |
318 | \r | |
319 | \r | |
320 | endmodule\r | |
321 | `endif\r |