YM2203 uses less audio bits due to half amount of channels.

This commit is contained in:
sorgelig
2018-06-03 04:24:05 +08:00
parent a38f4945c1
commit 6be6ec230f
2 changed files with 8 additions and 6 deletions

View File

@@ -57,7 +57,7 @@ end
wire [7:0] psg_ch_a_0;
wire [7:0] psg_ch_b_0;
wire [7:0] psg_ch_c_0;
wire [11:0] opn_0;
wire [10:0] opn_0;
wire [7:0] DO_0;
wire WE_0 = ~ay_select & BDIR;
@@ -87,7 +87,7 @@ ym2203 ym2203_0
wire [7:0] psg_ch_a_1;
wire [7:0] psg_ch_b_1;
wire [7:0] psg_ch_c_1;
wire [11:0] opn_1;
wire [10:0] opn_1;
wire [7:0] DO_1;
wire WE_1 = ay_select & BDIR;
@@ -129,7 +129,7 @@ wire [7:0] psg_c = ~ay0_playing ? psg_ch_c_1 : sum_ch_c[8:1];
wire signed [11:0] psg_l = {3'b000, psg_a, 1'd0} + {4'b0000, psg_b};
wire signed [11:0] psg_r = {3'b000, psg_c, 1'd0} + {4'b0000, psg_b};
wire signed [11:0] opn_s = {opn_0[11], opn_0[11:1]} + {opn_1[11], opn_1[11:1]};
wire signed [11:0] opn_s = {{2{opn_0[10]}}, opn_0[10:1]} + {{2{opn_1[10]}}, opn_1[10:1]};
assign CHANNEL_L = fm_ena ? opn_s + psg_l : psg_l;
assign CHANNEL_R = fm_ena ? opn_s + psg_r : psg_r;

View File

@@ -33,7 +33,7 @@ module ym2203
output [7:0] CHANNEL_A, // PSG Output channel A
output [7:0] CHANNEL_B, // PSG Output channel B
output [7:0] CHANNEL_C, // PSG Output channel C
output [11:0] CHANNEL_FM,// FM Output channel
output [10:0] CHANNEL_FM,// FM Output channel
output PSG_ACTIVE,
input FM_ENA
@@ -59,7 +59,7 @@ always @(posedge CLK) begin
endcase
end
end
if(~A0) psg_ena <= ~|DI[7:4] | ~FM_ENA;
if(~A0) psg_ena <= (~|DI[7:4]) | (~FM_ENA);
end
end
@@ -110,6 +110,7 @@ ym2149 ym2149
);
wire [7:0] opn_dout;
wire [11:0] opn_audio;
jt12 jt12
(
.rst(RESET),
@@ -123,10 +124,11 @@ jt12 jt12
.syn_clk(CLK & ce_opn),
.cpu_limiter_en(1'b1),
.syn_snd_right(CHANNEL_FM)
.syn_snd_right(opn_audio)
);
assign DO = A0 ? psg_dout : opn_dout;
assign PSG_ACTIVE = |psg_active;
assign CHANNEL_FM = opn_audio[10:0];
endmodule