1
+ /* This file is part of JT12.
2
+
3
+
4
+ JT12 program is free software: you can redistribute it and/or modify
5
+ it under the terms of the GNU General Public License as published by
6
+ the Free Software Foundation, either version 3 of the License, or
7
+ (at your option) any later version.
8
+
9
+ JT12 program is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ GNU General Public License for more details.
13
+
14
+ You should have received a copy of the GNU General Public License
15
+ along with JT12. If not, see <http://www.gnu.org/licenses/>.
16
+
17
+ Author: Jose Tejada Gomez. Twitter: @topapate
18
+ Version: 1.0
19
+ Date: 27-1-2017
20
+
21
+ Each channel can use the full range of the DAC as they do not
22
+ get summed in the real chip.
23
+
24
+ Operator data is summed up without adding extra bits. This is
25
+ the case of real YM3438, which was used on Megadrive 2 models.
26
+
27
+
28
+ */
29
+
30
+
31
+
32
+ module top (
33
+ input rst, // rst should be at least 6 clk&cen cycles long
34
+ input clk, // CPU clock
35
+ input cen, // optional clock enable, it not needed leave as 1'b1
36
+ input [7 :0 ] din,
37
+ input [1 :0 ] addr,
38
+ input cs_n,
39
+ input wr_n,
40
+ input limiter_en,
41
+
42
+ output [7 :0 ] dout,
43
+ output irq_n,
44
+ // combined output
45
+ output signed [15 :0 ] snd_right,
46
+ output signed [15 :0 ] snd_left,
47
+ output snd_sample,
48
+ // multiplexed output
49
+ output signed [8 :0 ] mux_right,
50
+ output signed [8 :0 ] mux_left,
51
+ output mux_sample
52
+ );
53
+
54
+ `ifdef YM2203
55
+ localparam use_lfo= 0 , use_ssg= 1 , num_ch= 3 , use_pcm= 0 , use_lr= 0 ;
56
+ `else // YM2612
57
+ localparam use_lfo= 1 , use_ssg= 0 , num_ch= 6 , use_pcm= 1 , use_lr= 1 ;
58
+ `endif
59
+
60
+
61
+ jt12 #(.use_lfo(use_lfo),.use_ssg(use_ssg),
62
+ .num_ch(num_ch), .use_pcm(use_pcm), .use_lr(use_lr) )
63
+ u_jt12 (
64
+ .rst ( rst ), // rst should be at least 6 clk&cen cycles long
65
+ .clk ( clk ), // CPU clock
66
+ .cen ( cen ), // optional clock enable, it not needed leave as 1'b1
67
+ .din ( din ),
68
+ .addr ( addr ),
69
+ .cs_n ( cs_n ),
70
+ .wr_n ( wr_n ),
71
+ .limiter_en ( limiter_en),
72
+
73
+ .dout ( dout ),
74
+ .irq_n ( irq_n ),
75
+
76
+ .snd_right ( snd_right ),
77
+ .snd_left ( snd_left ),
78
+ .snd_sample ( snd_sample ),
79
+ .mux_right ( mux_right ),
80
+ .mux_left ( mux_left ),
81
+ .mux_sample ( mux_sample )
82
+ );
83
+
84
+ endmodule // jt03
0 commit comments