Update turbosound.

This commit is contained in:
sorgelig
2020-05-11 23:43:24 +08:00
parent 5a66d5ec1c
commit c08d8479be
51 changed files with 4523 additions and 3446 deletions

View File

@ -20,18 +20,28 @@
`timescale 1ns / 1ps
/* The input is {op[1:0], ch[2:0]}
it adds 1 to the channel and overflow to the operator correctly */
module jt12_sumch
(
input [4:0] chin,
output reg [4:0] chout
);
parameter num_ch=6;
reg [2:0] aux;
always @(*) begin
aux <= chin[2:0] + 3'd1;
chout[2:0] <= aux[1:0]==2'b11 ? aux+3'd1 : aux;
chout[4:3] <= chin[2:0]==3'd6 ? chin[4:3]+2'd1 : chin[4:3];
aux = chin[2:0] + 3'd1;
if( num_ch==6 ) begin
chout[2:0] = aux[1:0]==2'b11 ? aux+3'd1 : aux;
chout[4:3] = chin[2:0]==3'd6 ? chin[4:3]+2'd1 : chin[4:3]; // next operator
end else begin // 3 channels
chout[2:0] = aux[1:0]==2'b11 ? 3'd0 : aux;
chout[4:3] = chin[2:0]==3'd2 ? chin[4:3]+2'd1 : chin[4:3]; // next operator
end
end
endmodule