]> git.zerfleddert.de Git - fpga-games/blob - galaxian/src/mc_top.v
360a2f4cfdba194dd7923a58a715813693254026
[fpga-games] / galaxian / src / mc_top.v
1 //===============================================================================
2 // FPGA GALAXIAN TOP
3 //
4 // Version : 2.50
5 //
6 // Copyright(c) 2004 Katsumi Degawa , All rights reserved
7 //
8 // Important !
9 //
10 // This program is freeware for non-commercial use.
11 // An author does no guarantee about this program.
12 // You can use this under your own risk.
13 //
14 // 2004- 4-30 galaxian modify by K.DEGAWA
15 // 2004- 5- 6 first release.
16 // 2004- 8-23 Improvement with T80-IP.
17 // 2004- 9-18 The description of ALTERA(CYCLONE) and XILINX(SPARTAN2E) was made one.
18 // 2004- 9-22 The problem which missile didn't sometimes come out from was improved.
19 //================================================================================
20
21 `include "src/mc_conf.v"
22
23 module mc_top(
24
25 // FPGA_USE
26 I_CLK_125M,
27
28 `ifdef PSPAD_USE
29 // PS_PAD interface
30 psCLK,
31 psSEL,
32 psTXD,
33 psRXD,
34 `endif
35
36 // ROM IF
37 //O_ROM_AB,
38 //I_ROM_DB,
39 //O_ROM_OEn,
40 //O_ROM_CSn,
41 //O_ROM_WEn,
42
43 // INPORT SW IF
44 I_PSW,
45
46 // SOUND OUT
47 O_SOUND_OUT_L,
48 O_SOUND_OUT_R,
49
50 // VGA (VIDEO) IF
51 O_VGA_R,
52 O_VGA_G,
53 O_VGA_B,
54 O_VGA_H_SYNCn,
55 O_VGA_V_SYNCn
56
57 );
58
59 // FPGA_USE
60 input I_CLK_125M;
61
62 // CPU ADDRESS BUS
63 wire [15:0]W_A;
64 // CPU IF
65 wire W_CPU_RDn;
66 wire W_CPU_WRn;
67 wire W_CPU_MREQn;
68 wire W_CPU_RFSHn;
69 wire W_CPU_BUSAKn;
70 wire W_CPU_IORQn;
71 wire W_CPU_M1n;
72 wire W_CPU_CLK;
73 wire W_CPU_HRDWR_RESETn;
74 wire W_CPU_WAITn;
75 wire W_CPU_NMIn;
76
77 `ifdef PSPAD_USE
78 // PS_PAD interface
79 input psRXD;
80 output psTXD,psCLK,psSEL;
81 `endif
82
83 // ROM IF
84 //output [18:0]O_ROM_AB;
85 //input [7:0]I_ROM_DB;
86 //output O_ROM_OEn;
87 //output O_ROM_CSn;
88 //output O_ROM_WEn;
89
90 // INPORT SW IF
91 input [8:0]I_PSW;
92
93 // SOUND OUT
94 output O_SOUND_OUT_L;
95 output O_SOUND_OUT_R;
96
97 // VGA (VIDEO) IF
98 output [3:0]O_VGA_R;
99 output [3:0]O_VGA_G;
100 output [3:0]O_VGA_B;
101 output O_VGA_H_SYNCn;
102 output O_VGA_V_SYNCn;
103
104 wire W_RESETn = |(~I_PSW[8:5]);
105 //------ CLOCK GEN ---------------------------
106 wire I_CLK_18432M;
107 wire W_CLK_12M,WB_CLK_12M;
108 wire W_CLK_6M,WB_CLK_6M;
109 wire W_STARS_CLK;
110 wire W_ROM_CLK;
111
112 mc_dcm clockgen(
113 .CLKIN_IN(I_CLK_125M),
114 .RST_IN(! W_RESETn),
115 .CLKFX_OUT(I_CLK_18432M),
116 .CLK0_OUT(W_ROM_CLK)
117 );
118
119 //------ H&V COUNTER -------------------------
120 wire [8:0]W_H_CNT;
121 wire [7:0]W_V_CNT;
122 wire W_H_BL;
123 wire W_V_BLn;
124 wire W_C_BLn;
125 wire W_H_SYNC;
126 wire W_V_SYNC;
127
128 //------ CPU RAM ----------------------------
129 wire [7:0]W_CPU_RAM_DO;
130
131 //------ ADDRESS DECDER ----------------------
132 wire W_CPU_ROM_CSn;
133 wire W_CPU_RAM_RDn;
134 wire W_CPU_RAM_WRn;
135 wire W_CPU_RAM_CSn;
136 wire W_OBJ_RAM_RDn;
137 wire W_OBJ_RAM_WRn;
138 wire W_OBJ_RAM_RQn;
139 wire W_VID_RAM_RDn;
140 wire W_VID_RAM_WRn;
141 wire W_SW0_OEn;
142 wire W_SW1_OEn;
143 wire W_DIP_OEn;
144 wire W_WDR_OEn;
145 wire W_LAMP_WEn;
146 wire W_SOUND_WEn;
147 wire W_PITCHn;
148 wire W_H_FLIP;
149 wire W_V_FLIP;
150 wire W_BD_G;
151 wire W_STARS_ON;
152
153 wire W_VID_RDn = W_OBJ_RAM_RDn & W_VID_RAM_RDn ;
154 wire W_SW_OEn = W_SW0_OEn & W_SW1_OEn & W_DIP_OEn ;
155 //------- INPORT -----------------------------
156 wire [7:0]W_SW_DO;
157 //------- VIDEO -----------------------------
158 wire [7:0]W_VID_DO;
159 //--------------------------------------------
160
161 mc_clock MC_CLK(
162
163 .I_CLK_18M(I_CLK_18432M),
164 .O_CLK_12M(WB_CLK_12M),
165 .O_CLK_06M(WB_CLK_6M)
166
167 );
168
169 `ifdef DEVICE_CYCLONE
170 assign W_CLK_12M = WB_CLK_12M;
171 assign W_CLK_6M = WB_CLK_6M;
172 `endif
173 `ifdef DEVICE_SPARTAN2E
174 BUFG BUFG_12MHz( .I(WB_CLK_12M),.O(W_CLK_12M) );
175 BUFG BUFG_6MHz ( .I(WB_CLK_6M ),.O(W_CLK_6M ) );
176 `endif
177 //--- DATA I/F -------------------------------------
178 reg [7:0]W_CPU_ROM_DO;
179 wire [7:0]W_CPU_ROM_DOB = W_CPU_ROM_CSn ? 8'h00: W_CPU_ROM_DO ;
180
181 wire [7:0]W_BDO = W_SW_DO | W_VID_DO | W_CPU_RAM_DO | W_CPU_ROM_DOB ;
182 wire [7:0]W_BDI;
183
184 //--- CPU I/F -------------------------------------
185 reg [3:0]rst_count;
186 always@(posedge W_H_CNT[0] or negedge W_RESETn)
187 begin
188 if(! W_RESETn) rst_count <= 0;
189 else begin
190 if( rst_count == 15)
191 rst_count <= rst_count;
192 else
193 rst_count <= rst_count+1;
194 end
195 end
196
197 assign W_CPU_RESETn = W_RESETn;
198 assign W_CPU_CLK = W_H_CNT[0];
199
200 Z80IP CPU(
201
202 .CLK(W_CPU_CLK),
203 .RESET_N(W_CPU_RESETn),
204 .INT_N(1'b1),
205 .NMI_N(W_CPU_NMIn),
206 .ADRS(W_A),
207 .DOUT(W_BDI),
208 .DINP(W_BDO),
209 .M1_N(),
210 .MREQ_N(W_CPU_MREQn),
211 .IORQ_N(),
212 .RD_N(W_CPU_RDn ),
213 .WR_N(W_CPU_WRn ),
214 .WAIT_N(W_CPU_WAITn),
215 .BUSWO(),
216 .RFSH_N(W_CPU_RFSHn),
217 .HALT_N()
218
219 );
220
221 wire W_CPU_RAM_CLK = W_CLK_12M & ~W_CPU_RAM_CSn;
222
223 mc_cpu_ram MC_CPU_RAM(
224
225 .I_CLK(W_CPU_RAM_CLK),
226 .I_ADDR(W_A[9:0]),
227 .I_D(W_BDI),
228 .I_WE(~W_CPU_WRn),
229 .I_OE(~W_CPU_RAM_RDn ),
230 .O_D(W_CPU_RAM_DO)
231
232 );
233
234
235 mc_adec MC_ADEC(
236
237 .I_CLK_12M(W_CLK_12M),
238 .I_CLK_6M(W_CLK_6M),
239 .I_CPU_CLK(W_H_CNT[0]),
240 .I_RSTn(W_RESETn),
241
242 .I_CPU_A(W_A),
243 .I_CPU_D(W_BDI[0]),
244 .I_MREQn(W_CPU_MREQn),
245 .I_RFSHn(W_CPU_RFSHn),
246 .I_RDn(W_CPU_RDn),
247 .I_WRn(W_CPU_WRn),
248 .I_H_BL(W_H_BL),
249 .I_V_BLn(W_V_BLn),
250
251 .O_WAITn(W_CPU_WAITn),
252 .O_NMIn(W_CPU_NMIn),
253 .O_CPU_ROM_CSn(W_CPU_ROM_CSn),
254 .O_CPU_RAM_RDn(W_CPU_RAM_RDn),
255 .O_CPU_RAM_WRn(W_CPU_RAM_WRn),
256 .O_CPU_RAM_CSn(W_CPU_RAM_CSn),
257 .O_OBJ_RAM_RDn(W_OBJ_RAM_RDn),
258 .O_OBJ_RAM_WRn(W_OBJ_RAM_WRn),
259 .O_OBJ_RAM_RQn(W_OBJ_RAM_RQn),
260 .O_VID_RAM_RDn(W_VID_RAM_RDn),
261 .O_VID_RAM_WRn(W_VID_RAM_WRn),
262 .O_SW0_OEn(W_SW0_OEn),
263 .O_SW1_OEn(W_SW1_OEn),
264 .O_DIP_OEn(W_DIP_OEn),
265 .O_WDR_OEn(W_WDR_OEn),
266 .O_LAMP_WEn(W_LAMP_WEn),
267 .O_SOUND_WEn(W_SOUND_WEn),
268 .O_PITCHn(W_PITCHn),
269 .O_H_FLIP(W_H_FLIP),
270 .O_V_FLIP(W_V_FLIP),
271 .O_BD_G(W_BD_G),
272 .O_STARS_ON(W_STARS_ON)
273
274 );
275
276 //-------- SOUND I/F -----------------------------
277 //--- Parts 9L ---------
278 reg [7:0]W_9L_Q;
279 always@(posedge W_CLK_12M or negedge W_RESETn)
280 begin
281 if(W_RESETn == 1'b0)begin
282 W_9L_Q <= 0;
283 end
284 else begin
285 if(W_SOUND_WEn == 1'b0)begin
286 case(W_A[2:0])
287 3'h0 : W_9L_Q[0] <= W_BDI[0];
288 3'h1 : W_9L_Q[1] <= W_BDI[0];
289 3'h2 : W_9L_Q[2] <= W_BDI[0];
290 3'h3 : W_9L_Q[3] <= W_BDI[0];
291 3'h4 : W_9L_Q[4] <= W_BDI[0];
292 3'h5 : W_9L_Q[5] <= W_BDI[0];
293 3'h6 : W_9L_Q[6] <= W_BDI[0];
294 3'h7 : W_9L_Q[7] <= W_BDI[0];
295 endcase
296 end
297 end
298 end
299 wire W_VOL1 = W_9L_Q[6];
300 wire W_VOL2 = W_9L_Q[7];
301 wire W_FIRE = W_9L_Q[5];
302 wire W_HIT = W_9L_Q[3];
303 wire W_FS3 = W_9L_Q[2];
304 wire W_FS2 = W_9L_Q[1];
305 wire W_FS1 = W_9L_Q[0];
306 //---------------------------------------------------
307 //---- CPU DATA WATCH -------------------------------
308 wire ZMWR = W_CPU_MREQn | W_CPU_WRn ;
309
310 reg [1:0]on_game;
311 always @(posedge W_CPU_CLK)
312 begin
313 if(~ZMWR)begin
314 if(W_A == 16'h4007)begin
315 if(W_BDI == 8'h00)
316 on_game[0] <= 1;
317 else
318 on_game[0] <= 0;
319 end
320 if(W_A == 16'h4005)begin
321 if(W_BDI == 8'h03 || W_BDI == 8'h04 )
322 on_game[1] <= 1;
323 else
324 on_game[1] <= 0;
325 end
326 end
327 end
328
329 `ifdef PSPAD_USE
330 reg died;
331 always @(posedge W_CPU_CLK)
332 begin
333 if(~ZMWR)begin
334 if(W_A == 16'h4206)begin
335 if(W_BDI == 8'h00)
336 died <= 0;
337 else
338 died <= 1;
339 end
340 end
341 end
342 //---- PS_PAD Interface -----------------------------
343 wire [8:0]ps_PSW;
344 wire VIB_SW = died & (&on_game[1:0]);
345
346 fpga_arcade_if pspad(
347
348 .CLK_18M432(I_CLK_18432M),
349 .I_RSTn(W_RESETn),
350 .psCLK(psCLK),
351 .psSEL(psSEL),
352 .psTXD(psTXD),
353 .psRXD(psRXD),
354 .ps_PSW(ps_PSW),
355 .I_VIB_SW(VIB_SW)
356
357 );
358 `endif
359 //---- SW Interface ---------------------------------
360 `ifdef PSPAD_USE
361 wire L1 = I_PSW[2] & ps_PSW[2];
362 wire R1 = I_PSW[3] & ps_PSW[3];
363 wire U1 = I_PSW[0];
364 wire D1 = I_PSW[1];
365 wire J1 = I_PSW[4] & ps_PSW[8];
366
367 wire S1 = (U1|J1) & ps_PSW[6];
368 wire S2 = (D1|J1) & ps_PSW[7];
369
370 wire C1 = (L1|R1|U1|~D1) & ps_PSW[4];
371 `else
372 wire L1 = ! I_PSW[2];
373 wire R1 = ! I_PSW[3];
374 wire U1 = ! I_PSW[0];
375 wire D1 = ! I_PSW[1];
376 wire J1 = ! I_PSW[4];
377
378 wire S1 = ! I_PSW[5];
379 wire S2 = ! I_PSW[7];
380
381 wire C1 = ! I_PSW[6];
382 `endif
383 wire C2 = ! I_PSW[8];
384
385 wire L2 = L1;
386 wire R2 = R1;
387 wire U2 = U1;
388 wire D2 = D1;
389 wire J2 = J1;
390
391 mc_inport MC_INPORT(
392
393 .I_COIN1(~C1), // ACTIVE HI
394 .I_COIN2(~C2), // ACTIVE HI
395 .I_1P_LE(~L1), // ACTIVE HI
396 .I_1P_RI(~R1), // ACTIVE HI
397 .I_1P_SH(~J1), // ACTIVE HI
398 .I_2P_LE(~L2), // ACTIVE HI
399 .I_2P_RI(~R2), // ACTIVE HI
400 .I_2P_SH(~J2), // ACTIVE HI
401 .I_1P_START(~S1), // ACTIVE HI
402 .I_2P_START(~S2), // ACTIVE HI
403
404 .I_SW0_OEn(W_SW0_OEn),
405 .I_SW1_OEn(W_SW1_OEn),
406 .I_DIP_OEn(W_DIP_OEn),
407
408 .O_D(W_SW_DO)
409
410 );
411
412 //-----------------------------------------------------------------------------
413 //------- ROM -------------------------------------------------------
414 reg [18:0]ROM_A;
415 wire [10:0]W_OBJ_ROM_A;
416 reg [7:0]W_OBJ_ROM_A_D;
417 reg [7:0]W_OBJ_ROM_B_D;
418
419 wire [18:0]W_WAV_A0,W_WAV_A1,W_WAV_A2;
420 reg [7:0]W_WAV_D0,W_WAV_D1,W_WAV_D2;
421
422 wire [7:0]ROM_D; // = I_ROM_DB;
423 //assign O_ROM_AB = ROM_A;
424
425 //assign O_ROM_OEn = 1'b0;
426 //assign O_ROM_CSn = 1'b0;
427 //assign O_ROM_WEn = 1'b1;
428
429 galaxian_roms ROMS(
430 .I_ROM_CLK(W_ROM_CLK),
431 .I_ADDR(ROM_A),
432 .O_DATA(ROM_D)
433 );
434
435
436 reg [1:0]clk_d;
437 reg [4:0]seq;
438 always @(posedge I_CLK_18432M)
439 begin
440 // 24 phase generator
441 clk_d[0] <= W_H_CNT[0] & W_H_CNT[1] & W_H_CNT[2];
442 clk_d[1] <= clk_d[0];
443 seq <= (~clk_d[1] & clk_d[0]) ? 0 : seq+1;
444 case(seq)
445 0:begin
446 //sound
447 ROM_A <= W_WAV_A0;
448 W_CPU_ROM_DO <= ROM_D;
449 end
450 2:begin
451 //sound
452 ROM_A <= W_WAV_A1;
453 W_WAV_D0 <= ROM_D;
454 end
455 4:begin
456 //sound
457 ROM_A <= {3'h0,W_A[15:0]};
458 W_WAV_D1 <= ROM_D;
459 end
460 6:begin
461 //sound
462 ROM_A <= W_WAV_A2;
463 W_CPU_ROM_DO <= ROM_D;
464 end
465 8:W_WAV_D2 <= ROM_D; //sound
466 10:ROM_A <= {3'h0,W_A[15:0]};
467 12:W_CPU_ROM_DO <= ROM_D;
468 16:ROM_A <= {3'h0,W_A[15:0]};
469 18:begin
470 ROM_A <= {3'h0,4'h4,1'b0,W_OBJ_ROM_A};
471 W_CPU_ROM_DO <= ROM_D;
472 end
473 20:begin
474 ROM_A <= {3'h0,4'h5,1'b0,W_OBJ_ROM_A};
475 W_OBJ_ROM_A_D <= ROM_D;
476 end
477 22:begin
478 ROM_A <= {3'h0,W_A[15:0]};
479 W_OBJ_ROM_B_D <= ROM_D;
480 end
481 default:;
482 endcase
483 end
484 //-----------------------------------------------------------------------------
485
486 wire W_V_BL2n;
487
488 mc_hv_count MC_HV(
489
490 .I_CLK(WB_CLK_6M),
491 .I_RSTn(W_RESETn),
492
493 .O_H_CNT(W_H_CNT),
494 .O_H_SYNC(W_H_SYNC),
495 .O_H_BL(W_H_BL),
496 .O_V_CNT(W_V_CNT),
497 .O_V_SYNC(W_V_SYNC),
498 .O_V_BL2n(W_V_BL2n),
499 .O_V_BLn(W_V_BLn),
500 .O_C_BLn(W_C_BLn)
501
502 );
503
504 //------ VIDEO -----------------------------
505 wire W_8HF;
506 wire W_1VF;
507 wire W_C_BLnX;
508 wire W_256HnX;
509 wire W_MISSILEn;
510 wire W_SHELLn;
511 wire [1:0]W_VID;
512 wire [2:0]W_COL;
513
514 mc_video MC_VID(
515 .I_CLK_18M(I_CLK_18432M),
516 .I_CLK_12M(W_CLK_12M),
517 .I_CLK_6M(W_CLK_6M),
518 .I_H_CNT(W_H_CNT),
519 .I_V_CNT(W_V_CNT),
520 .I_H_FLIP(W_H_FLIP),
521 .I_V_FLIP(W_V_FLIP),
522 .I_V_BLn(W_V_BLn),
523 .I_C_BLn(W_C_BLn),
524
525 .I_A(W_A[9:0]),
526 .I_OBJ_SUB_A(3'b000),
527 .I_BD(W_BDI),
528 .I_OBJ_RAM_RQn(W_OBJ_RAM_RQn),
529 .I_OBJ_RAM_RDn(W_OBJ_RAM_RDn),
530 .I_OBJ_RAM_WRn(W_OBJ_RAM_WRn),
531 .I_VID_RAM_RDn(W_VID_RAM_RDn),
532 .I_VID_RAM_WRn(W_VID_RAM_WRn),
533
534 .O_OBJ_ROM_A(W_OBJ_ROM_A),
535 .I_OBJ_ROM_A_D(W_OBJ_ROM_A_D),
536 .I_OBJ_ROM_B_D(W_OBJ_ROM_B_D),
537
538 .O_C_BLnX(W_C_BLnX),
539 .O_8HF(W_8HF),
540 .O_256HnX(W_256HnX),
541 .O_1VF(W_1VF),
542 .O_MISSILEn(W_MISSILEn),
543 .O_SHELLn(W_SHELLn),
544 .O_BD(W_VID_DO),
545 .O_VID(W_VID),
546 .O_COL(W_COL)
547
548 );
549
550 wire W_C_BLX;
551 wire W_STARS_OFFn;
552 wire [2:0]W_VIDEO_R;
553 wire [2:0]W_VIDEO_G;
554 wire [1:0]W_VIDEO_B;
555
556 mc_col_pal MC_COL_PAL(
557
558 .I_CLK_12M(W_CLK_12M),
559 .I_CLK_6M(W_CLK_6M),
560 .I_VID(W_VID),
561 .I_COL(W_COL),
562 .I_C_BLnX(W_C_BLnX),
563
564 .O_C_BLX(W_C_BLX),
565 .O_STARS_OFFn(W_STARS_OFFn),
566 .O_R(W_VIDEO_R),
567 .O_G(W_VIDEO_G),
568 .O_B(W_VIDEO_B)
569
570 );
571
572 wire [2:0]W_STARS_R;
573 wire [2:0]W_STARS_G;
574 wire [1:0]W_STARS_B;
575
576 mc_stars MC_STARS(
577
578 .I_CLK_18M(I_CLK_18432M),
579 `ifdef DEVICE_CYCLONE
580 .I_CLK_6M(~WB_CLK_6M),
581 `endif
582 `ifdef DEVICE_SPARTAN2E
583 .I_CLK_6M(WB_CLK_6M),
584 `endif
585 .I_H_FLIP(W_H_FLIP),
586 .I_V_SYNC(W_V_SYNC),
587 .I_8HF(W_8HF),
588 .I_256HnX(W_256HnX),
589 .I_1VF(W_1VF),
590 .I_2V(W_V_CNT[1]),
591 .I_STARS_ON(W_STARS_ON),
592 .I_STARS_OFFn(W_STARS_OFFn),
593
594 .O_R(W_STARS_R),
595 .O_G(W_STARS_G),
596 .O_B(W_STARS_B),
597 .O_NOISE()
598
599 );
600
601 wire [2:0]W_R;
602 wire [2:0]W_G;
603 wire [1:0]W_B;
604
605 mc_vedio_mix MIX(
606
607 .I_VID_R(W_VIDEO_R),
608 .I_VID_G(W_VIDEO_G),
609 .I_VID_B(W_VIDEO_B),
610 .I_STR_R(W_STARS_R),
611 .I_STR_G(W_STARS_G),
612 .I_STR_B(W_STARS_B),
613
614 .I_C_BLnXX(~W_C_BLX),
615 .I_C_BLX(W_C_BLX | ~W_V_BL2n),
616 .I_MISSILEn(W_MISSILEn),
617 .I_SHELLn(W_SHELLn),
618
619 .O_R(W_R),
620 .O_G(W_G),
621 .O_B(W_B)
622
623 );
624
625 wire [2:0]W_VGA_R;
626 wire [2:0]W_VGA_G;
627 wire [1:0]W_VGA_B;
628
629 `ifdef VGA_USE
630 mc_vga_if VGA(
631
632 // input
633 .I_CLK_1(W_CLK_6M),
634 .I_CLK_2(W_CLK_12M),
635 .I_R(W_R),
636 .I_G(W_G),
637 .I_B(W_B),
638 .I_H_SYNC(W_H_SYNC),
639 .I_V_SYNC(W_V_SYNC),
640 // output
641 .O_R(W_VGA_R),
642 .O_G(W_VGA_G),
643 .O_B(W_VGA_B),
644 .O_H_SYNCn(O_VGA_H_SYNCn),
645 .O_V_SYNCn(O_VGA_V_SYNCn)
646
647 );
648
649 `else
650
651 assign W_VGA_R[2:0] = W_R;
652
653 assign W_VGA_G[2:0] = W_G;
654
655 assign W_VGA_B[1:0] = W_B;
656
657 //assign O_VGA_H_SYNCn = W_H_SYNC | W_V_SYNC ; // AKIDUKI LCD USED
658 assign O_VGA_H_SYNCn = ~W_H_SYNC ;
659 assign O_VGA_V_SYNCn = ~W_V_SYNC ;
660
661 `endif
662
663 assign O_VGA_R[3:0] = {W_VGA_R[0], W_VGA_R[1], W_VGA_R[2], 1'b0};
664
665 assign O_VGA_G[3:0] = {W_VGA_G[0], W_VGA_G[1], W_VGA_G[2], 1'b0};
666
667 assign O_VGA_B[3:0] = {W_VGA_B[0], W_VGA_B[1], 2'b0};
668
669 wire [7:0]W_SDAT_A;
670
671 mc_sound_a MC_SOUND_A(
672
673 .I_CLK_12M(W_CLK_12M),
674 .I_CLK_6M(W_CLK_6M),
675 .I_H_CNT1(W_H_CNT[1]),
676 .I_BD(W_BDI),
677 .I_PITCHn(W_PITCHn),
678 .I_VOL1(W_VOL1),
679 .I_VOL2(W_VOL2),
680
681 .O_SDAT(W_SDAT_A),
682 .O_DO()
683
684 );
685
686 wire [7:0]W_SDAT_B;
687
688 mc_sound_b MC_SOUND_B(
689
690 .I_CLK1(I_CLK_18432M),
691 .I_CLK2(W_CLK_6M),
692 .I_RSTn(rst_count[3]),
693 .I_SW({&on_game[1:0],W_HIT,W_FIRE}),
694
695 .O_WAV_A0(W_WAV_A0),
696 .O_WAV_A1(W_WAV_A1),
697 .O_WAV_A2(W_WAV_A2),
698 .I_WAV_D0(W_WAV_D0),
699 .I_WAV_D1(W_WAV_D1),
700 .I_WAV_D2(W_WAV_D2),
701
702 .O_SDAT(W_SDAT_B)
703
704 );
705
706 wire W_DAC_A;
707 wire W_DAC_B;
708
709 assign O_SOUND_OUT_L = W_DAC_A;
710 assign O_SOUND_OUT_R = W_DAC_B;
711
712 dac wav_dac_a(
713
714 .Clk(I_CLK_18432M),
715 .Reset(~W_RESETn),
716 .DACin(W_SDAT_A),
717 .DACout(W_DAC_A)
718
719 );
720
721 dac wav_dac_b(
722
723 .Clk(I_CLK_18432M),
724 .Reset(~W_RESETn),
725 .DACin(W_SDAT_B),
726 .DACout(W_DAC_B)
727
728 );
729
730
731 endmodule
732
Impressum, Datenschutz