]> cvs.zerfleddert.de Git - fpga-games/blame - galaxian/src/mc_missile.v
picture getting better again
[fpga-games] / galaxian / src / mc_missile.v
CommitLineData
782690d0
MG
1//===============================================================================\r
2// FPGA MOONCRESTA VIDEO-MISSILE\r
3//\r
4// Version : 2.00\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- 9-22 The problem which missile didn't sometimes come out from was improved.\r
15//================================================================================\r
16\r
17\r
18module mc_missile(\r
19\r
20I_CLK_18M,\r
21I_CLK_6M,\r
22I_C_BLn_X,\r
23I_MLDn,\r
24I_SLDn,\r
25I_HPOS,\r
26\r
27O_MISSILEn,\r
28O_SHELLn\r
29\r
30);\r
31\r
32input I_CLK_6M,I_CLK_18M;\r
33input I_C_BLn_X;\r
34input I_MLDn;\r
35input I_SLDn;\r
36input [7:0]I_HPOS;\r
37\r
38output O_MISSILEn;\r
39output O_SHELLn;\r
40\r
41reg [7:0]W_45R_Q;\r
42\r
43always@(posedge I_CLK_6M)\r
44begin\r
45 if(I_MLDn==1'b0)\r
46 W_45R_Q <= I_HPOS;\r
47 else begin\r
48 if(I_C_BLn_X)\r
49 W_45R_Q <= W_45R_Q +1;\r
50 else\r
51 W_45R_Q <= W_45R_Q ;\r
52 end\r
53end\r
54\r
55reg W_5P1_Q;\r
56reg W_5P1_CLK; \r
57\r
58always@(posedge I_CLK_18M)\r
59 W_5P1_CLK <= ~((&W_45R_Q[7:2])&W_5P1_Q);\r
60\r
61always@(posedge W_5P1_CLK or negedge I_MLDn)\r
62begin\r
63 if(I_MLDn==1'b0)\r
64 W_5P1_Q <= 1'b1;\r
65 else\r
66 W_5P1_Q <= 1'b0;\r
67end\r
68\r
69assign O_MISSILEn = W_5P1_CLK;\r
70\r
71reg [7:0]W_45S_Q;\r
72always@(posedge I_CLK_6M)\r
73begin\r
74 if(I_SLDn==1'b0)\r
75 W_45S_Q <= I_HPOS;\r
76 else begin\r
77 if(I_C_BLn_X)\r
78 W_45S_Q <= W_45S_Q +1;\r
79 else\r
80 W_45S_Q <= W_45S_Q ;\r
81 end\r
82end\r
83\r
84reg W_5P2_Q;\r
85reg W_5P2_CLK;\r
86\r
87always@(posedge I_CLK_18M)\r
88 W_5P2_CLK <= ~((&W_45S_Q[7:2])&W_5P2_Q);\r
89\r
90always@(posedge W_5P2_CLK or negedge I_SLDn)\r
91begin\r
92 if(I_SLDn==1'b0)\r
93 W_5P2_Q <= 1'b1;\r
94 else\r
95 W_5P2_Q <= 1'b0;\r
96end\r
97\r
98assign O_SHELLn = W_5P2_CLK;\r
99\r
100\r
101endmodule
Impressum, Datenschutz