]>
Commit | Line | Data |
---|---|---|
1 | //===============================================================================\r | |
2 | // FPGA MOONCRESTA STARS\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 \r | |
15 | //================================================================================\r | |
16 | \r | |
17 | \r | |
18 | module mc_stars(\r | |
19 | \r | |
20 | I_CLK_18M,\r | |
21 | I_CLK_6M,\r | |
22 | I_H_FLIP,\r | |
23 | I_V_SYNC,\r | |
24 | I_8HF,\r | |
25 | I_256HnX,\r | |
26 | I_1VF,\r | |
27 | I_2V,\r | |
28 | I_STARS_ON,\r | |
29 | I_STARS_OFFn,\r | |
30 | \r | |
31 | O_R,\r | |
32 | O_G,\r | |
33 | O_B,\r | |
34 | O_NOISE\r | |
35 | \r | |
36 | );\r | |
37 | \r | |
38 | input I_CLK_18M;\r | |
39 | input I_CLK_6M;\r | |
40 | input I_H_FLIP;\r | |
41 | input I_V_SYNC;\r | |
42 | input I_8HF;\r | |
43 | input I_256HnX;\r | |
44 | input I_1VF;\r | |
45 | input I_2V;\r | |
46 | input I_STARS_ON;\r | |
47 | input I_STARS_OFFn;\r | |
48 | \r | |
49 | output [2:0]O_R;\r | |
50 | output [2:0]O_G;\r | |
51 | output [1:0]O_B;\r | |
52 | output O_NOISE;\r | |
53 | \r | |
54 | wire W_V_SYNCn = ~I_V_SYNC;\r | |
55 | \r | |
56 | wire CLK_1C = ~(I_CLK_18M & I_CLK_6M & W_V_SYNCn & I_256HnX);\r | |
57 | \r | |
58 | reg W_1C_Q1,W_1C_Q2;\r | |
59 | always@(posedge CLK_1C or negedge W_V_SYNCn)\r | |
60 | begin\r | |
61 | if(W_V_SYNCn==1'b0)begin\r | |
62 | W_1C_Q1 <= 1'b0;\r | |
63 | W_1C_Q2 <= 1'b0;\r | |
64 | end\r | |
65 | else begin\r | |
66 | W_1C_Q1 <= 1'b1;\r | |
67 | W_1C_Q2 <= W_1C_Q1;\r | |
68 | end\r | |
69 | end\r | |
70 | \r | |
71 | wire CLK_1AB = ~(CLK_1C |(~(I_H_FLIP|W_1C_Q2))) ;\r | |
72 | \r | |
73 | reg [15:0]W_1AB_Q;\r | |
74 | reg W_2D_Qn;\r | |
75 | wire W_3B = W_2D_Qn^W_1AB_Q[4];\r | |
76 | \r | |
77 | always@(posedge CLK_1AB or negedge I_STARS_ON)\r | |
78 | begin\r | |
79 | if(I_STARS_ON==1'b0)begin\r | |
80 | W_1AB_Q <= 0;\r | |
81 | W_2D_Qn <= 1'b1;\r | |
82 | end\r | |
83 | else begin\r | |
84 | W_1AB_Q <= {W_1AB_Q[14:0],W_3B};\r | |
85 | W_2D_Qn <= ~W_1AB_Q[15];\r | |
86 | end\r | |
87 | end\r | |
88 | \r | |
89 | wire W_2A = ~(& W_1AB_Q[7:0]);\r | |
90 | wire W_4P = ~(( I_8HF ^ I_1VF ) & W_2D_Qn & I_STARS_OFFn);\r | |
91 | \r | |
92 | assign O_R[2] = 1'b0 ; \r | |
93 | assign O_R[1] = (W_2A|W_4P) ? 1'b0 : W_1AB_Q[8] ; \r | |
94 | assign O_R[0] = (W_2A|W_4P) ? 1'b0 : W_1AB_Q[9] ; \r | |
95 | \r | |
96 | assign O_G[2] = 1'b0 ; \r | |
97 | assign O_G[1] = (W_2A|W_4P) ? 1'b0 : W_1AB_Q[10] ; \r | |
98 | assign O_G[0] = (W_2A|W_4P) ? 1'b0 : W_1AB_Q[11] ; \r | |
99 | \r | |
100 | assign O_B[1] = (W_2A|W_4P) ? 1'b0 : W_1AB_Q[12] ; \r | |
101 | assign O_B[0] = (W_2A|W_4P) ? 1'b0 : W_1AB_Q[13] ; \r | |
102 | \r | |
103 | reg noise;\r | |
104 | always@(posedge I_2V) noise <= W_2D_Qn ;\r | |
105 | assign O_NOISE = noise ;\r | |
106 | \r | |
107 | \r | |
108 | endmodule |