]> cvs.zerfleddert.de Git - fpga-games/blame_incremental - galaxian/src/mc_sound_a.v
impact 11 renamed the intel flash...
[fpga-games] / galaxian / src / mc_sound_a.v
... / ...
CommitLineData
1//===============================================================================\r
2// FPGA MOONCRESTA SOUND I/F\r
3//\r
4// Version : 1.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//================================================================================\r
15\r
16\r
17module mc_sound_a(\r
18\r
19I_CLK_12M,\r
20I_CLK_6M,\r
21I_H_CNT1,\r
22I_BD,\r
23I_PITCHn,\r
24I_VOL1,\r
25I_VOL2,\r
26\r
27O_SDAT,\r
28O_DO\r
29\r
30);\r
31\r
32input I_CLK_12M;\r
33input I_CLK_6M;\r
34input I_H_CNT1;\r
35input [7:0]I_BD;\r
36input I_PITCHn;\r
37input I_VOL1;\r
38input I_VOL2;\r
39\r
40output [3:0]O_DO;\r
41output [7:0]O_SDAT;\r
42\r
43reg W_PITCHn;\r
44reg W_89K_LDn;\r
45reg [7:0]W_89K_Q;\r
46reg [7:0]W_89K_LDATA;\r
47reg [3:0]W_6T_Q;\r
48\r
49always@(posedge I_CLK_12M) \r
50begin\r
51 W_PITCHn <= I_PITCHn;\r
52 W_89K_LDn <= ~(&W_89K_Q[7:0]);\r
53end\r
54\r
55// Parts 9J\r
56always@(posedge W_PITCHn) W_89K_LDATA <= I_BD;\r
57\r
58always@(posedge I_H_CNT1)\r
59begin\r
60 if(~W_89K_LDn)\r
61 W_89K_Q <= W_89K_LDATA;\r
62 else\r
63 W_89K_Q <= W_89K_Q + 1; \r
64end\r
65\r
66always@(negedge W_89K_LDn) W_6T_Q <= W_6T_Q + 1;\r
67assign O_DO = W_6T_Q;\r
68\r
69reg [7:0]W_SDAT0;\r
70reg [7:0]W_SDAT2;\r
71reg [7:0]W_SDAT3;\r
72always@(posedge I_CLK_6M)\r
73begin\r
74 W_SDAT0 <= W_6T_Q[0]==1'b0 ? 8'd0 : 8'd42 ;\r
75 W_SDAT2 <= W_6T_Q[2]==1'b0 ? 8'd0 : I_VOL1 ? 8'd105 : 8'd57 ;\r
76 W_SDAT3 <= W_6T_Q[3]==1'b0 ? 8'd0 : I_VOL2 ? 8'd72 : 8'd0 ;\r
77end\r
78\r
79assign O_SDAT = W_SDAT0 + W_SDAT2 + W_SDAT3 + 8'd20 ;\r
80\r
81\r
82endmodule
Impressum, Datenschutz