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