OpenCores
URL https://opencores.org/ocsvn/jt51/jt51/trunk

Subversion Repositories jt51

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 1 to Rev 2
    Reverse comparison

Rev 1 → Rev 2

/jt51/trunk/jt51/exp_lut.vh
0,0 → 1,276
/* This file is part of JT51.
 
JT51 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
 
JT51 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with JT51. If not, see <http://www.gnu.org/licenses/>.
Author: Jose Tejada Gomez. Twitter: @topapate
Version: 1.0
Date: 27-10-2016
*/
 
8'd0: pow_val <= 13'd8168;
8'd1: pow_val <= 13'd8148;
8'd2: pow_val <= 13'd8124;
8'd3: pow_val <= 13'd8104;
8'd4: pow_val <= 13'd8080;
8'd5: pow_val <= 13'd8060;
8'd6: pow_val <= 13'd8040;
8'd7: pow_val <= 13'd8016;
8'd8: pow_val <= 13'd7996;
8'd9: pow_val <= 13'd7972;
8'd10: pow_val <= 13'd7952;
8'd11: pow_val <= 13'd7932;
8'd12: pow_val <= 13'd7908;
8'd13: pow_val <= 13'd7888;
8'd14: pow_val <= 13'd7864;
8'd15: pow_val <= 13'd7844;
8'd16: pow_val <= 13'd7824;
8'd17: pow_val <= 13'd7804;
8'd18: pow_val <= 13'd7780;
8'd19: pow_val <= 13'd7760;
8'd20: pow_val <= 13'd7740;
8'd21: pow_val <= 13'd7720;
8'd22: pow_val <= 13'd7696;
8'd23: pow_val <= 13'd7676;
8'd24: pow_val <= 13'd7656;
8'd25: pow_val <= 13'd7636;
8'd26: pow_val <= 13'd7616;
8'd27: pow_val <= 13'd7592;
8'd28: pow_val <= 13'd7572;
8'd29: pow_val <= 13'd7552;
8'd30: pow_val <= 13'd7532;
8'd31: pow_val <= 13'd7512;
8'd32: pow_val <= 13'd7492;
8'd33: pow_val <= 13'd7472;
8'd34: pow_val <= 13'd7452;
8'd35: pow_val <= 13'd7432;
8'd36: pow_val <= 13'd7412;
8'd37: pow_val <= 13'd7392;
8'd38: pow_val <= 13'd7372;
8'd39: pow_val <= 13'd7352;
8'd40: pow_val <= 13'd7332;
8'd41: pow_val <= 13'd7312;
8'd42: pow_val <= 13'd7292;
8'd43: pow_val <= 13'd7272;
8'd44: pow_val <= 13'd7252;
8'd45: pow_val <= 13'd7232;
8'd46: pow_val <= 13'd7212;
8'd47: pow_val <= 13'd7192;
8'd48: pow_val <= 13'd7176;
8'd49: pow_val <= 13'd7156;
8'd50: pow_val <= 13'd7136;
8'd51: pow_val <= 13'd7116;
8'd52: pow_val <= 13'd7096;
8'd53: pow_val <= 13'd7076;
8'd54: pow_val <= 13'd7060;
8'd55: pow_val <= 13'd7040;
8'd56: pow_val <= 13'd7020;
8'd57: pow_val <= 13'd7000;
8'd58: pow_val <= 13'd6984;
8'd59: pow_val <= 13'd6964;
8'd60: pow_val <= 13'd6944;
8'd61: pow_val <= 13'd6928;
8'd62: pow_val <= 13'd6908;
8'd63: pow_val <= 13'd6888;
8'd64: pow_val <= 13'd6868;
8'd65: pow_val <= 13'd6852;
8'd66: pow_val <= 13'd6832;
8'd67: pow_val <= 13'd6816;
8'd68: pow_val <= 13'd6796;
8'd69: pow_val <= 13'd6776;
8'd70: pow_val <= 13'd6760;
8'd71: pow_val <= 13'd6740;
8'd72: pow_val <= 13'd6724;
8'd73: pow_val <= 13'd6704;
8'd74: pow_val <= 13'd6688;
8'd75: pow_val <= 13'd6668;
8'd76: pow_val <= 13'd6652;
8'd77: pow_val <= 13'd6632;
8'd78: pow_val <= 13'd6616;
8'd79: pow_val <= 13'd6596;
8'd80: pow_val <= 13'd6580;
8'd81: pow_val <= 13'd6560;
8'd82: pow_val <= 13'd6544;
8'd83: pow_val <= 13'd6524;
8'd84: pow_val <= 13'd6508;
8'd85: pow_val <= 13'd6492;
8'd86: pow_val <= 13'd6472;
8'd87: pow_val <= 13'd6456;
8'd88: pow_val <= 13'd6436;
8'd89: pow_val <= 13'd6420;
8'd90: pow_val <= 13'd6404;
8'd91: pow_val <= 13'd6384;
8'd92: pow_val <= 13'd6368;
8'd93: pow_val <= 13'd6352;
8'd94: pow_val <= 13'd6336;
8'd95: pow_val <= 13'd6316;
8'd96: pow_val <= 13'd6300;
8'd97: pow_val <= 13'd6284;
8'd98: pow_val <= 13'd6264;
8'd99: pow_val <= 13'd6248;
8'd100: pow_val <= 13'd6232;
8'd101: pow_val <= 13'd6216;
8'd102: pow_val <= 13'd6200;
8'd103: pow_val <= 13'd6180;
8'd104: pow_val <= 13'd6164;
8'd105: pow_val <= 13'd6148;
8'd106: pow_val <= 13'd6132;
8'd107: pow_val <= 13'd6116;
8'd108: pow_val <= 13'd6100;
8'd109: pow_val <= 13'd6080;
8'd110: pow_val <= 13'd6064;
8'd111: pow_val <= 13'd6048;
8'd112: pow_val <= 13'd6032;
8'd113: pow_val <= 13'd6016;
8'd114: pow_val <= 13'd6000;
8'd115: pow_val <= 13'd5984;
8'd116: pow_val <= 13'd5968;
8'd117: pow_val <= 13'd5952;
8'd118: pow_val <= 13'd5936;
8'd119: pow_val <= 13'd5920;
8'd120: pow_val <= 13'd5904;
8'd121: pow_val <= 13'd5888;
8'd122: pow_val <= 13'd5872;
8'd123: pow_val <= 13'd5856;
8'd124: pow_val <= 13'd5840;
8'd125: pow_val <= 13'd5824;
8'd126: pow_val <= 13'd5808;
8'd127: pow_val <= 13'd5792;
8'd128: pow_val <= 13'd5776;
8'd129: pow_val <= 13'd5760;
8'd130: pow_val <= 13'd5744;
8'd131: pow_val <= 13'd5732;
8'd132: pow_val <= 13'd5716;
8'd133: pow_val <= 13'd5700;
8'd134: pow_val <= 13'd5684;
8'd135: pow_val <= 13'd5668;
8'd136: pow_val <= 13'd5652;
8'd137: pow_val <= 13'd5636;
8'd138: pow_val <= 13'd5624;
8'd139: pow_val <= 13'd5608;
8'd140: pow_val <= 13'd5592;
8'd141: pow_val <= 13'd5576;
8'd142: pow_val <= 13'd5564;
8'd143: pow_val <= 13'd5548;
8'd144: pow_val <= 13'd5532;
8'd145: pow_val <= 13'd5516;
8'd146: pow_val <= 13'd5504;
8'd147: pow_val <= 13'd5488;
8'd148: pow_val <= 13'd5472;
8'd149: pow_val <= 13'd5456;
8'd150: pow_val <= 13'd5444;
8'd151: pow_val <= 13'd5428;
8'd152: pow_val <= 13'd5412;
8'd153: pow_val <= 13'd5400;
8'd154: pow_val <= 13'd5384;
8'd155: pow_val <= 13'd5368;
8'd156: pow_val <= 13'd5356;
8'd157: pow_val <= 13'd5340;
8'd158: pow_val <= 13'd5328;
8'd159: pow_val <= 13'd5312;
8'd160: pow_val <= 13'd5296;
8'd161: pow_val <= 13'd5284;
8'd162: pow_val <= 13'd5268;
8'd163: pow_val <= 13'd5256;
8'd164: pow_val <= 13'd5240;
8'd165: pow_val <= 13'd5228;
8'd166: pow_val <= 13'd5212;
8'd167: pow_val <= 13'd5200;
8'd168: pow_val <= 13'd5184;
8'd169: pow_val <= 13'd5168;
8'd170: pow_val <= 13'd5156;
8'd171: pow_val <= 13'd5144;
8'd172: pow_val <= 13'd5128;
8'd173: pow_val <= 13'd5116;
8'd174: pow_val <= 13'd5100;
8'd175: pow_val <= 13'd5088;
8'd176: pow_val <= 13'd5072;
8'd177: pow_val <= 13'd5060;
8'd178: pow_val <= 13'd5044;
8'd179: pow_val <= 13'd5032;
8'd180: pow_val <= 13'd5020;
8'd181: pow_val <= 13'd5004;
8'd182: pow_val <= 13'd4992;
8'd183: pow_val <= 13'd4976;
8'd184: pow_val <= 13'd4964;
8'd185: pow_val <= 13'd4952;
8'd186: pow_val <= 13'd4936;
8'd187: pow_val <= 13'd4924;
8'd188: pow_val <= 13'd4912;
8'd189: pow_val <= 13'd4896;
8'd190: pow_val <= 13'd4884;
8'd191: pow_val <= 13'd4872;
8'd192: pow_val <= 13'd4856;
8'd193: pow_val <= 13'd4844;
8'd194: pow_val <= 13'd4832;
8'd195: pow_val <= 13'd4820;
8'd196: pow_val <= 13'd4804;
8'd197: pow_val <= 13'd4792;
8'd198: pow_val <= 13'd4780;
8'd199: pow_val <= 13'd4768;
8'd200: pow_val <= 13'd4752;
8'd201: pow_val <= 13'd4740;
8'd202: pow_val <= 13'd4728;
8'd203: pow_val <= 13'd4716;
8'd204: pow_val <= 13'd4704;
8'd205: pow_val <= 13'd4688;
8'd206: pow_val <= 13'd4676;
8'd207: pow_val <= 13'd4664;
8'd208: pow_val <= 13'd4652;
8'd209: pow_val <= 13'd4640;
8'd210: pow_val <= 13'd4628;
8'd211: pow_val <= 13'd4616;
8'd212: pow_val <= 13'd4600;
8'd213: pow_val <= 13'd4588;
8'd214: pow_val <= 13'd4576;
8'd215: pow_val <= 13'd4564;
8'd216: pow_val <= 13'd4552;
8'd217: pow_val <= 13'd4540;
8'd218: pow_val <= 13'd4528;
8'd219: pow_val <= 13'd4516;
8'd220: pow_val <= 13'd4504;
8'd221: pow_val <= 13'd4492;
8'd222: pow_val <= 13'd4480;
8'd223: pow_val <= 13'd4468;
8'd224: pow_val <= 13'd4456;
8'd225: pow_val <= 13'd4444;
8'd226: pow_val <= 13'd4432;
8'd227: pow_val <= 13'd4420;
8'd228: pow_val <= 13'd4408;
8'd229: pow_val <= 13'd4396;
8'd230: pow_val <= 13'd4384;
8'd231: pow_val <= 13'd4372;
8'd232: pow_val <= 13'd4360;
8'd233: pow_val <= 13'd4348;
8'd234: pow_val <= 13'd4336;
8'd235: pow_val <= 13'd4324;
8'd236: pow_val <= 13'd4312;
8'd237: pow_val <= 13'd4300;
8'd238: pow_val <= 13'd4288;
8'd239: pow_val <= 13'd4276;
8'd240: pow_val <= 13'd4264;
8'd241: pow_val <= 13'd4256;
8'd242: pow_val <= 13'd4244;
8'd243: pow_val <= 13'd4232;
8'd244: pow_val <= 13'd4220;
8'd245: pow_val <= 13'd4208;
8'd246: pow_val <= 13'd4196;
8'd247: pow_val <= 13'd4184;
8'd248: pow_val <= 13'd4176;
8'd249: pow_val <= 13'd4164;
8'd250: pow_val <= 13'd4152;
8'd251: pow_val <= 13'd4140;
8'd252: pow_val <= 13'd4128;
8'd253: pow_val <= 13'd4120;
8'd254: pow_val <= 13'd4108;
8'd255: pow_val <= 13'd4096;
/jt51/trunk/jt51/jt51.v
0,0 → 1,361
/* This file is part of JT51.
 
JT51 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
 
JT51 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with JT51. If not, see <http://www.gnu.org/licenses/>.
Author: Jose Tejada Gomez. Twitter: @topapate
Version: 1.0
Date: 27-10-2016
*/
 
`timescale 1ns / 1ps
 
module jt51(
input clk, // main clock
input rst, // reset
input cs_n, // chip select
input wr_n, // write
input a0,
input [7:0] d_in, // data in
output [7:0] d_out, // data out
output ct1,
output ct2,
output irq_n, // I do not synchronize this signal
output reg p1,
// Low resolution output (same as real chip)
output sample, // marks new output sample
output signed [15:0] left,
output signed [15:0] right,
// Full resolution output
output signed [15:0] xleft,
output signed [15:0] xright,
// unsigned outputs for sigma delta converters, full resolution
output [15:0] dacleft,
output [15:0] dacright
);
 
reg rst_p1, rst_p1_aux;
 
assign dacleft = { ~xleft [15], xleft[14:0] };
assign dacright = { ~xright[15], xright[14:0] };
 
 
// Generate internal clock and synchronous reset for it.
always @(posedge clk or posedge rst)
if( rst )
p1 <= 1'b0;
else
p1 <= ~p1;
 
always @(posedge p1 or posedge rst)
if( rst ) begin
rst_p1_aux <= 1'b1;
rst_p1 <= 1'b1;
end
else begin
rst_p1_aux <= 1'b0;
rst_p1 <= rst_p1_aux;
end
 
// Timers
wire [9:0] value_A;
wire [7:0] value_B;
wire load_A, load_B;
wire enable_irq_A, enable_irq_B;
wire clr_flag_A, clr_flag_B;
wire flag_A, flag_B, overflow_A;
wire set_run_A, set_run_B;
wire clr_run_A, clr_run_B;
 
jt51_timers timers(
.clk ( clk ),
.rst ( rst_p1 ),
.value_A ( value_A ),
.value_B ( value_B ),
.load_A ( load_A ),
.load_B ( load_B ),
.enable_irq_A( enable_irq_A ),
.enable_irq_B( enable_irq_B ),
.clr_flag_A ( clr_flag_A ),
.clr_flag_B ( clr_flag_B ),
.set_run_A ( set_run_A ),
.set_run_B ( set_run_B ),
.clr_run_A ( clr_run_A ),
.clr_run_B ( clr_run_B ),
.flag_A ( flag_A ),
.flag_B ( flag_B ),
.overflow_A ( overflow_A ),
.irq_n ( irq_n )
);
 
`define YM_TIMER_CTRL 8'h14
 
wire [1:0] rl_out;
wire [2:0] fb_out;
wire [2:0] con_out;
wire [6:0] kc_out;
wire [5:0] kf_out;
wire [2:0] pms_out;
wire [1:0] ams_out;
wire [2:0] dt1_out;
wire [3:0] mul_out;
wire [6:0] tl_out;
wire [1:0] ks_out;
wire [4:0] ar_out;
wire amsen_out;
wire [4:0] d1r_out;
wire [1:0] dt2_out;
wire [4:0] d2r_out;
wire [3:0] d1l_out;
wire [3:0] rr_out;
 
wire [1:0] cur_op;
wire zero;
assign sample =zero;
wire koff_out, kon_out;
 
wire [7:0] lfo_freq;
wire [1:0] lfo_w;
wire lfo_rst;
wire [6:0] am;
wire [7:0] pm;
wire [6:0] amd, pmd;
 
jt51_lfo u_lfo(
.rst ( rst_p1),
.clk ( clk ),
.zero ( zero ),
.lfo_rst( lfo_rst ),
.lfo_freq(lfo_freq),
.lfo_w ( lfo_w ),
.lfo_amd( amd ),
.lfo_pmd( pmd ),
.am ( am ),
.pm_u ( pm )
);
 
wire [ 4:0] keycode_III;
wire [19:0] phase_now;
 
jt51_phasegen u_pg(
.clk ( p1 ), // P1
// Channel frequency
.kc ( kc_out ),
.kf ( kf_out ),
// Operator multiplying
.mul ( mul_out ),
// Operator detuning
.dt1 ( dt1_out ),
.dt2 ( dt2_out ),
// phase modulation from LFO
.pms ( pms_out ),
.pm ( pm ),
// phase operation
.keyon ( kon_out ),
.keycode_III(keycode_III), // produced in stage II
.phase_now(phase_now)
);
 
`ifdef TEST_SUPPORT
wire test_eg, test_op0;
`endif
wire [9:0] eg;
 
jt51_envelope u_eg(
`ifdef TEST_SUPPORT
.test_eg ( test_eg ),
`endif
.rst ( rst_p1 ),
.clk ( p1 ),
.zero ( zero ),
// envelope configuration
.keycode_III(keycode_III), // used in stage III
.arate ( ar_out ),
.rate1 ( d1r_out ),
.rate2 ( d2r_out ),
.rrate ( rr_out ),
.d1l ( d1l_out ),
.ks ( ks_out ),
// envelope operation
.keyon ( kon_out ),
.keyoff ( koff_out ),
// envelope number
.tl ( tl_out ),
.am ( am ),
.ams ( ams_out ),
.amsen ( amsen_out ),
.eg ( eg )
);
 
wire signed [13:0] op_out;
 
jt51_op u_op(
`ifdef TEST_SUPPORT
.test_eg ( test_eg ),
.test_op0( test_op0 ),
`endif
.clk ( p1 ),
.con ( con_out ),
.fb ( fb_out ),
.phase_cnt(phase_now),
.cur_op ( cur_op ),
// volume
.eg ( eg ),
// output data
.out ( op_out )
);
 
wire [4:0] nfrq;
wire [9:0] noise_out;
wire ne, op31_acc;
 
jt51_noise u_noise(
.rst ( rst_p1 ),
.clk ( p1 ),
.zero ( zero ),
.ne ( ne ),
.nfrq ( nfrq ),
.eg ( eg ),
.out ( noise_out ),
.op31_acc(op31_acc )
);
 
jt51_acc u_acc(
.clk ( p1 ),
.zero ( zero ),
.ne ( ne ),
.noise ( noise_out ),
.op31_acc(op31_acc ),
.rl ( rl_out ),
.op_out ( op_out ),
.left ( left ),
.right ( right ),
.xleft ( xleft ),
.xright ( xright )
);
 
reg busy;
wire busy_mmr;
reg [1:0] busy_mmr_sh;
 
reg flag_B_s, flag_A_s;
assign d_out = { busy, 5'h0, flag_B_s, flag_A_s };
 
always @(posedge clk )
{ flag_B_s, flag_A_s } <= { flag_B, flag_A };
 
 
wire write = !cs_n && !wr_n;
 
reg [7:0] d_in_copy;
reg a0_copy;
reg write_copy;
 
always @(posedge clk) begin : cpu_interface
if( rst ) begin
busy <= 1'b0;
a0_copy <= 1'b0;
d_in_copy <= 8'd0;
write_copy <= 1'b0;
end
else begin
busy_mmr_sh <= { busy_mmr_sh[0], busy_mmr };
if( write && !busy ) begin
busy <= 1'b1;
write_copy <= 1'b1;
a0_copy <= a0;
d_in_copy <= d_in;
end
else begin
if( busy_mmr ) write_copy <= 1'b0;
if( busy && busy_mmr_sh==2'b10 ) busy <= 1'b0;
end
end
end
 
reg write_s, a0_s;
reg [7:0] d_in_s;
 
always @(posedge p1 )
{ write_s, a0_s, d_in_s } <= { write_copy, a0_copy, d_in_copy };
 
 
jt51_mmr u_mmr(
.clk ( p1 ),
.rst ( rst_p1 ),
.a0 ( a0_s ),
.write ( write_s ),
.d_in ( d_in_s ),
.busy ( busy_mmr ),
 
// CT
.ct1 ( ct1 ),
.ct2 ( ct2 ),
// LFO
.lfo_freq(lfo_freq),
.lfo_w ( lfo_w ),
.lfo_amd( amd ),
.lfo_pmd( pmd ),
.lfo_rst( lfo_rst ),
// Noise
.ne ( ne ),
.nfrq ( nfrq ),
// Timers
.value_A ( value_A ),
.value_B ( value_B ),
.load_A ( load_A ),
.load_B ( load_B ),
.enable_irq_A( enable_irq_A ),
.enable_irq_B( enable_irq_B ),
.clr_flag_A ( clr_flag_A ),
.clr_flag_B ( clr_flag_B ),
.clr_run_A ( clr_run_A ),
.clr_run_B ( clr_run_B ),
.set_run_A ( set_run_A ),
.set_run_B ( set_run_B ),
.flag_A ( overflow_A ),
`ifdef TEST_SUPPORT
// Test
.test_eg ( test_eg ),
.test_op0 ( test_op0 ),
`endif
// REG
.rl_out( rl_out ),
.fb_out( fb_out ),
.con_out( con_out ),
.kc_out( kc_out ),
.kf_out( kf_out ),
.pms_out( pms_out ),
.ams_out( ams_out ),
.dt1_out( dt1_out ),
.mul_out( mul_out ),
.tl_out( tl_out ),
.ks_out( ks_out ),
.ar_out( ar_out ),
.amsen_out( amsen_out ),
.d1r_out( d1r_out ),
.dt2_out( dt2_out ),
.d2r_out( d2r_out ),
.d1l_out( d1l_out ),
.rr_out( rr_out ),
.kon_out(kon_out),
.koff_out(koff_out),
 
.cur_op(cur_op),
.zero(zero)
);
 
endmodule
 
/jt51/trunk/jt51/jt51_acc.v
0,0 → 1,117
/* This file is part of JT51.
 
JT51 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
 
JT51 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with JT51. If not, see <http://www.gnu.org/licenses/>.
Author: Jose Tejada Gomez. Twitter: @topapate
Version: 1.0
Date: 27-10-2016
*/
 
`timescale 1ns / 1ps
 
module jt51_acc(
input clk,
input zero,
input op31_acc,
input [1:0] rl,
input signed [13:0] op_out,
input ne,
input signed [ 9:0] noise,
output signed [15:0] left,
output signed [15:0] right,
output signed [15:0] xleft, // exact outputs
output signed [15:0] xright
);
 
wire [1:0] rl_out;
wire zero_out;
reg [13:0] op_value;
 
always @(*) begin
if( ne && op31_acc ) // cambiar a OP 31
op_value <= { noise, 4'd0 };
else
op_value <= op_out;
end
 
jt51_sum_op u_left(
.clk(clk),
.zero(zero_out),
.en_ch(rl_out[0]),
.op_out(op_value),
.out(xleft)
);
 
jt51_sum_op u_right(
.clk(clk),
.zero(zero_out),
.en_ch(rl_out[1]),
.op_out(op_value),
.out(xright)
);
 
jt51_sh #( .width(2), .stages(14) ) u_rlsh(
.clk ( clk ),
.din ( rl ),
.drop ( rl_out )
);
 
jt51_sh #( .width(1), .stages(22) ) u_zerosh(
.clk ( clk ),
.din ( zero ),
.drop ( zero_out )
);
 
wire signed [9:0] left_man, right_man;
wire [2:0] left_exp, right_exp;
 
jt51_exp2lin left_reconstruct(
.lin( left ),
.man( left_man ),
.exp( left_exp )
);
 
jt51_exp2lin right_reconstruct(
.lin( right ),
.man( right_man ),
.exp( right_exp )
);
 
jt51_lin2exp left2exp(
.lin( xleft ),
.man( left_man ),
.exp( left_exp ) );
 
jt51_lin2exp right2exp(
.lin( xright ),
.man( right_man ),
.exp( right_exp ) );
 
`ifdef DUMPLEFT
 
reg skip;
 
wire signed [15:0] dump = left;
 
initial skip=1;
 
always @(posedge clk)
if( zero_out && (!skip || dump) ) begin
$display("%d", dump );
skip <= 0;
end
 
`endif
 
endmodule
/jt51/trunk/jt51/jt51_envelope.v
0,0 → 1,381
/* This file is part of JT51.
 
JT51 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
 
JT51 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with JT51. If not, see <http://www.gnu.org/licenses/>.
Author: Jose Tejada Gomez. Twitter: @topapate
Version: 1.0
Date: 27-10-2016
*/
 
`timescale 1ns / 1ps
 
/*
 
tab size 4
 
*/
 
module jt51_envelope(
`ifdef TEST_SUPPORT
input test_eg,
`endif
input rst,
input clk,
input zero,
// envelope configuration
input [4:0] keycode_III,
input [4:0] arate,
input [4:0] rate1,
input [4:0] rate2,
input [3:0] rrate,
input [3:0] d1l,
input [1:0] ks,
// envelope operation
input keyon,
input keyoff,
// envelope number
input [6:0] tl,
input [6:0] am,
input [1:0] ams,
input amsen,
output reg [9:0] eg
);
 
// eg[9:6] -> direct attenuation (divide by 2)
// eg[5:0] -> mantisa attenuation (uses LUT)
// 1 LSB of eg is -0.09257 dB
 
parameter ATTACK=2'd0, DECAY1=2'd1, DECAY2=2'd2, RELEASE=2'd3;
 
reg [4:0] d1level;
reg [2:0] cnt_V;
reg [5:0] rate_IV;
wire [6:0] tl_out;
wire [1:0] ams_out;
wire amsen_out;
reg [9:0] eg_in, eg_out_III, eg_out_IV, eg_out_V, eg_out_VI;
wire [9:0] eg_out;
reg [11:0] sum_eg_tl;
 
reg step_V, step_VI;
reg sum_up;
reg keyon_II, keyon_III, keyon_IV, keyon_V, keyon_VI;
reg keyoff_II;
reg [5:0] rate_V;
reg [5:1] rate_VI;
 
reg [4:0] rate1_II, rate2_II, arate_II;
reg [3:0] rrate_II;
 
// remember: { log_msb, pow_addr } <= log_val[11:0] + { tl, 5'd0 } + { eg, 2'd0 };
 
reg [1:0] eg_cnt_base;
reg [14:0] eg_cnt;
 
reg [8:0] am_final;
 
always @(*) begin : sum_eg_and_tl
casex( {amsen_out, ams_out } )
3'b0xx,3'b100: am_final <= 9'd0;
3'b101: am_final <= { 2'b00, am };
3'b110: am_final <= { 1'b0, am, 1'b0};
3'b111: am_final <= { am, 2'b0 };
endcase
`ifdef TEST_SUPPORT
if( test_eg && tl_out!=7'd0 )
sum_eg_tl <= 11'd0;
else
`endif
sum_eg_tl <= { tl_out, 3'd0 }
+ eg_in
+ { am_final, 1'b0 };
end
 
always @(posedge clk) begin : envelope_counter
if( rst ) begin
eg_cnt_base <= 2'd0;
eg_cnt <=15'd0;
end
else begin
if( zero ) begin
// envelope counter increases every 3 output samples,
// there is one sample every 32 clock ticks
if( eg_cnt_base == 2'd2 ) begin
eg_cnt <= eg_cnt + 1'b1;
eg_cnt_base <= 2'd0;
end
else eg_cnt_base <= eg_cnt_base + 1'b1;
end
end
end
 
wire cnt_out; // = all_cnt_last[3*31-1:3*30];
 
reg [6:0] pre_rate_III;
reg [4:0] cfg_III;
wire [1:0] ks_III;
 
always @(*) begin : pre_rate_calc
if( cfg_III == 5'd0 )
pre_rate_III <= 6'd0;
else
case( ks_III )
2'd3: pre_rate_III <= { cfg_III, 1'b0 } + keycode_III;
2'd2: pre_rate_III <= { cfg_III, 1'b0 } + { 1'b0, keycode_III[4:1] };
2'd1: pre_rate_III <= { cfg_III, 1'b0 } + { 2'b0, keycode_III[4:2] };
2'd0: pre_rate_III <= { cfg_III, 1'b0 } + { 3'b0, keycode_III[4:3] };
endcase
end
 
 
 
reg [7:0] step_idx;
reg [1:0] state_in_III, state_in_IV, state_in_V, state_in_VI;
wire [1:0] state_out;
 
always @(*) begin : rate_step
if( rate_V[5:4]==2'b11 ) begin // 0 means 1x, 1 means 2x
if( rate_V[5:2]==4'hf && state_in_V == ATTACK)
step_idx <= 8'b11111111; // Maximum attack speed, rates 60&61
else
case( rate_V[1:0] )
2'd0: step_idx <= 8'b00000000;
2'd1: step_idx <= 8'b10001000; // 2
2'd2: step_idx <= 8'b10101010; // 4
2'd3: step_idx <= 8'b11101110; // 6
endcase
end
else begin
if( rate_V[5:2]==4'd0 && state_in_V != ATTACK)
step_idx <= 8'b11111110; // limit slowest decay rate_IV
else
case( rate_V[1:0] )
2'd0: step_idx <= 8'b10101010; // 4
2'd1: step_idx <= 8'b11101010; // 5
2'd2: step_idx <= 8'b11101110; // 6
2'd3: step_idx <= 8'b11111110; // 7
endcase
end
// a rate_IV of zero keeps the level still
step_V <= rate_V[5:1]==5'd0 ? 1'b0 : step_idx[ cnt_V ];
end
 
 
 
wire ar_off_VI;
reg ar_off_III;
 
reg [8:0] ar_sum0;
reg [9:0] ar_result, ar_sum;
 
always @(*) begin : ar_calculation
casex( rate_VI[5:2] )
default: ar_sum0 <= eg_out_VI[9:4] + 1'd1;
4'b1100: ar_sum0 <= eg_out_VI[9:4] + 1'd1;
4'b1101: ar_sum0 <= eg_out_VI[9:3] + 1'd1;
4'b111x: ar_sum0 <= eg_out_VI[9:2] + 1'd1;
endcase
if( rate_VI[5:4] == 2'b11 )
ar_sum <= step_VI ? { ar_sum0, 1'b0 } : { 1'b0, ar_sum0 };
else
ar_sum <= step_VI ? { 1'b0, ar_sum0 } : 10'd0;
ar_result <= ar_sum<eg_out_VI ? eg_out_VI-ar_sum : 10'd0;
end
 
always @(posedge clk) begin
// I
if( d1l == 4'd15 )
d1level <= 5'h10; // 48dB
else
d1level <= d1l;
keyon_II <= keyon;
keyoff_II<= keyoff;
{ arate_II, rate1_II, rate2_II, rrate_II } <= { arate, rate1, rate2, rrate };
// II
ar_off_III <= arate_II == 5'h1f;
// trigger release
if( keyoff_II ) begin
cfg_III <= { rrate_II, 1'b1 };
state_in_III <= RELEASE;
end
else begin
// trigger 1st decay
if( keyon_II ) begin
cfg_III <= arate_II;
state_in_III <= ATTACK;
end
else begin : sel_rate
case ( state_out )
ATTACK: begin
if( eg_out==10'd0 ) begin
state_in_III <= DECAY1;
cfg_III <= rate1_II;
end
else begin
state_in_III <= state_out; // attack
cfg_III <= arate_II;
end
end
DECAY1: begin
if( eg_out[9:5] >= d1level ) begin
cfg_III <= rate2_II;
state_in_III <= DECAY2;
end
else begin
cfg_III <= rate1_II;
state_in_III <= state_out; // decay1
end
end
DECAY2: begin
cfg_III <= rate2_II;
state_in_III <= state_out; // decay2
end
RELEASE: begin
cfg_III <= { rrate_II, 1'b1 };
state_in_III <= state_out; // release
end
endcase
end
end
 
keyon_III <= keyon_II;
eg_out_III <= eg_out;
 
// III
state_in_IV <= state_in_III;
eg_out_IV <= eg_out_III;
rate_IV <= pre_rate_III[6] ? 6'd63 : pre_rate_III[5:0];
keyon_IV <= keyon_III;
 
// IV
state_in_V <= state_in_IV;
rate_V <= rate_IV;
keyon_V <= keyon_IV;
eg_out_V <= eg_out_IV;
if( state_in_IV == ATTACK )
casex( rate_IV[5:2] )
4'h0: cnt_V <= eg_cnt[13:11];
4'h1: cnt_V <= eg_cnt[12:10];
4'h2: cnt_V <= eg_cnt[11: 9];
4'h3: cnt_V <= eg_cnt[10: 8];
4'h4: cnt_V <= eg_cnt[ 9: 7];
4'h5: cnt_V <= eg_cnt[ 8: 6];
4'h6: cnt_V <= eg_cnt[ 7: 5];
4'h7: cnt_V <= eg_cnt[ 6: 4];
4'h8: cnt_V <= eg_cnt[ 5: 3];
4'h9: cnt_V <= eg_cnt[ 4: 2];
4'ha: cnt_V <= eg_cnt[ 3: 1];
default: cnt_V <= eg_cnt[ 2: 0];
endcase
else
casex( rate_IV[5:2] )
4'h0: cnt_V <= eg_cnt[14:12];
4'h1: cnt_V <= eg_cnt[13:11];
4'h2: cnt_V <= eg_cnt[12:10];
4'h3: cnt_V <= eg_cnt[11: 9];
4'h4: cnt_V <= eg_cnt[10: 8];
4'h5: cnt_V <= eg_cnt[ 9: 7];
4'h6: cnt_V <= eg_cnt[ 8: 6];
4'h7: cnt_V <= eg_cnt[ 7: 5];
4'h8: cnt_V <= eg_cnt[ 6: 4];
4'h9: cnt_V <= eg_cnt[ 5: 3];
4'ha: cnt_V <= eg_cnt[ 4: 2];
4'hb: cnt_V <= eg_cnt[ 3: 1];
default: cnt_V <= eg_cnt[ 2: 0];
endcase
 
// V
state_in_VI <= state_in_V;
rate_VI <= rate_V[5:1];
keyon_VI <= keyon_V;
eg_out_VI <= eg_out_V;
sum_up <= cnt_V[0] != cnt_out;
step_VI <= step_V;
// VI
if( keyon_VI ) begin
if( ar_off_VI )
eg_in <= 10'd0;
/*else // todo: verify in silicon
eg_in <= 10'h3ff;*/
end
else
if( state_in_VI == ATTACK ) begin
if( sum_up && eg_out_VI != 10'd0 )
if( rate_VI[5:1]==5'd31 )
eg_in <= 10'd0;
else
eg_in <= ar_result;
else
eg_in <= eg_out_VI;
end
else begin : DECAY_SUM
if( sum_up ) begin
if ( eg_out_VI<= (10'd1023-10'd8) )
case( rate_VI[5:2] )
4'b1100: eg_in <= eg_out_VI + { step_VI, ~step_VI }; // 12
4'b1101: eg_in <= eg_out_VI + { step_VI, ~step_VI, 1'b0 }; // 13
4'b1110: eg_in <= eg_out_VI + { step_VI, ~step_VI, 2'b0 }; // 14
4'b1111: eg_in <= eg_out_VI + 4'd8;// 15
default: eg_in <= eg_out_VI + { step_VI, 1'b0 };
endcase
else eg_in <= 10'h3FF;
end
else eg_in <= eg_out_VI;
end
// VII
eg <= sum_eg_tl[11:10] > 2'b0 ? {10{1'b1}} : sum_eg_tl[9:0];
end
 
// Shift registers
 
jt51_sh #( .width(1), .stages(3) ) u_aroffsh(
.clk ( clk ),
.din ( ar_off_III),
.drop ( ar_off_VI )
);
 
jt51_sh #( .width(2), .stages(2) ) u_kssh(
.clk ( clk ),
.din ( ks ),
.drop ( ks_III )
);
 
 
jt51_sh #( .width(10), .stages(6) ) u_tlsh(
.clk ( clk ),
.din ( { tl, amsen, ams } ),
.drop ( { tl_out, amsen_out, ams_out } )
);
 
jt51_sh #( .width(10), .stages(27) ) u_egsh(
.clk ( clk ),
.din ( eg_in ),
.drop ( eg_out )
);
 
jt51_sh #( .width(1), .stages(32) ) u_cntsh(
.clk ( clk ),
.din ( cnt_V[0] ),
.drop ( cnt_out )
);
 
jt51_sh #( .width(2), .stages(31) ) u_statesh(
.clk ( clk ),
.din ( state_in_III ),
.drop ( state_out )
);
 
endmodule
 
/jt51/trunk/jt51/jt51_exp2lin.v
0,0 → 1,42
/* This file is part of JT51.
 
JT51 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
 
JT51 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with JT51. If not, see <http://www.gnu.org/licenses/>.
Author: Jose Tejada Gomez. Twitter: @topapate
Version: 1.0
Date: 27-10-2016
*/
 
`timescale 1ns / 1ps
 
module jt51_exp2lin(
output reg signed [15:0] lin,
input signed [9:0] man,
input [2:0] exp
);
 
always @(*) begin
case( exp )
3'd7: lin <= { man, 6'b0 };
3'd6: lin <= { {1{man[9]}}, man, 5'b0 };
3'd5: lin <= { {2{man[9]}}, man, 4'b0 };
3'd4: lin <= { {3{man[9]}}, man, 3'b0 };
3'd3: lin <= { {4{man[9]}}, man, 2'b0 };
3'd2: lin <= { {5{man[9]}}, man, 1'b0 };
3'd1: lin <= { {6{man[9]}}, man };
3'd0: lin <= 16'd0;
endcase
end
 
endmodule
/jt51/trunk/jt51/jt51_exptable.v
0,0 → 1,34
/* This file is part of JT51.
 
JT51 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
 
JT51 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with JT51. If not, see <http://www.gnu.org/licenses/>.
Author: Jose Tejada Gomez. Twitter: @topapate
Version: 1.0
Date: 27-10-2016
*/
 
`timescale 1ns / 1ps
 
module jt51_exptable(
input [7:0] pow_addr,
output reg [12:0] pow_val
);
 
always @(*) begin : read_lut
case( pow_addr )
`include "exp_lut.vh"
endcase
end
 
endmodule
/jt51/trunk/jt51/jt51_lfo.v
0,0 → 1,258
/* This file is part of JT51.
 
JT51 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
 
JT51 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with JT51. If not, see <http://www.gnu.org/licenses/>.
Author: Jose Tejada Gomez. Twitter: @topapate
Version: 1.0
Date: 27-10-2016
*/
 
`timescale 1ns / 1ps
 
/*
 
tab size 4
 
*/
 
module jt51_lfo(
input rst,
input clk,
input zero,
input lfo_rst,
input [7:0] lfo_freq,
input [6:0] lfo_amd,
input [6:0] lfo_pmd,
input [1:0] lfo_w,
output reg [6:0] am,
output reg [7:0] pm_u
);
 
reg signed [7:0] pm;
 
always @(*) begin: signed_to_unsigned
if( pm[7] ) begin
pm_u[7] <= pm[7];
pm_u[6:0] <= ~pm[6:0];
end
else pm_u <= pm;
end
 
wire [6:0] noise_am;
wire [7:0] noise_pm;
 
parameter b0=3;
reg [15+b0:0] base;
 
always @(posedge clk) begin : base_counter
if( rst ) begin
base <= {b0+15{1'b0}};
end
else begin
if( zero ) base <= base + 1'b1;
end
end
 
reg sel_base;
reg [4:0] freq_sel;
 
always @(*) begin : base_mux
freq_sel <= lfo_freq[7:4]
+ ( lfo_w==2'd2 ? 1'b1 : 1'b0 );
case( freq_sel )
5'h10: sel_base <= base[b0-1];
5'hf: sel_base <= base[b0+0];
5'he: sel_base <= base[b0+1];
5'hd: sel_base <= base[b0+2];
5'hc: sel_base <= base[b0+3];
5'hb: sel_base <= base[b0+4];
5'ha: sel_base <= base[b0+5];
5'h9: sel_base <= base[b0+6];
5'h8: sel_base <= base[b0+7];
5'h7: sel_base <= base[b0+8];
5'h6: sel_base <= base[b0+9];
5'h5: sel_base <= base[b0+10];
5'h4: sel_base <= base[b0+11];
5'h3: sel_base <= base[b0+12];
5'h2: sel_base <= base[b0+13];
5'h1: sel_base <= base[b0+14];
5'h0: sel_base <= base[b0+15];
default: sel_base <= base[b0-1];
endcase
end
 
reg [7:0] cnt, cnt_lim;
 
reg signed [10:0] am_bresenham;
reg signed [ 9:0] pm_bresenham;
 
always @(*) begin : counter_limit
case( lfo_freq[3:0] )
4'hf: cnt_lim <= 8'd66;
4'he: cnt_lim <= 8'd68;
4'hd: cnt_lim <= 8'd70;
4'hc: cnt_lim <= 8'd73;
4'hb: cnt_lim <= 8'd76;
4'ha: cnt_lim <= 8'd79;
4'h9: cnt_lim <= 8'd82;
4'h8: cnt_lim <= 8'd85;
4'h7: cnt_lim <= 8'd89;
4'h6: cnt_lim <= 8'd93;
4'h5: cnt_lim <= 8'd98;
4'h4: cnt_lim <= 8'd102;
4'h3: cnt_lim <= 8'd108;
4'h2: cnt_lim <= 8'd114;
4'h1: cnt_lim <= 8'd120;
4'h0: cnt_lim <= 8'd128;
endcase
end
 
wire signed [7:0] pmd_min = (~{1'b0, lfo_pmd[6:0]})+8'b1;
 
reg lfo_clk, last_base, am_up, pm_up;
 
always @(posedge clk) begin : modulator
if( rst || lfo_rst ) begin
last_base <= 1'd0;
lfo_clk <= 1'b0;
cnt <= 8'd0;
am <= 7'd0;
pm <= 8'd0;
am_up <= 1'b1;
pm_up <= 1'b1;
am_bresenham <= 11'd0;
pm_bresenham <= 10'd0;
end
else begin
last_base <= sel_base;
if( last_base != sel_base ) begin
case( lfo_w )
2'd0: begin // AM sawtooth
if( am_bresenham > 0 ) begin
if( am == lfo_amd ) begin
am <= 7'd0;
am_bresenham <= 11'd0;
end
else begin
am <= am + 1'b1;
am_bresenham <= am_bresenham
- { cnt_lim, 1'b0} + lfo_amd;
end
end
else am_bresenham <= am_bresenham + lfo_amd;
 
if( pm_bresenham > 0 ) begin
if( pm == { 1'b0, lfo_pmd } ) begin
pm <= pmd_min;
pm_bresenham <= 10'd0;
end
else begin
pm <= pm + 1'b1;
pm_bresenham <= pm_bresenham
- cnt_lim + lfo_pmd;
end
end
else pm_bresenham <= pm_bresenham + lfo_pmd;
end
2'd1: // AM square waveform
if( cnt == cnt_lim ) begin
cnt <= 8'd0;
lfo_clk <= ~lfo_clk;
am <= lfo_clk ? lfo_amd : 7'd0;
pm <= lfo_clk ? {1'b0, lfo_pmd } : pmd_min;
end
else cnt <= cnt + 1'd1;
2'd2: begin // AM triangle
if( am_bresenham > 0 ) begin
if( am == lfo_amd && am_up) begin
am_up <= 1'b0;
am_bresenham <= 11'd0;
end
else if( am == 8'd0 && !am_up) begin
am_up <= 1'b1;
am_bresenham <= 11'd0;
end
else begin
am <= am_up ? am+1'b1 : am-1'b1;
am_bresenham <= am_bresenham
- { cnt_lim, 1'b0} + lfo_amd;
end
end
else am_bresenham <= am_bresenham + lfo_amd;
if( pm_bresenham > 0 ) begin
if( pm == {1'b0, lfo_pmd} && pm_up) begin
pm_up <= 1'b0;
pm_bresenham <= 10'd0;
end
else if( pm == pmd_min && !pm_up) begin
pm_up <= 1'b1;
pm_bresenham <= 10'd0;
end
else begin
pm <= pm_up ? pm+1'b1 : pm-1'b1;
pm_bresenham <= pm_bresenham
- cnt_lim + lfo_pmd;
end
end
else pm_bresenham <= pm_bresenham + lfo_pmd;
end
2'd3: begin
casex( lfo_amd ) // same as real chip
7'b1xxxxxx: am <= noise_am[6:0];
7'b01xxxxx: am <= { 1'b0, noise_am[5:0] };
7'b001xxxx: am <= { 2'b0, noise_am[4:0] };
7'b0001xxx: am <= { 3'b0, noise_am[3:0] };
7'b00001xx: am <= { 4'b0, noise_am[2:0] };
7'b000001x: am <= { 5'b0, noise_am[1:0] };
7'b0000001: am <= { 6'b0, noise_am[0] };
default: am <= 7'd0;
endcase
casex( lfo_pmd )
7'b1xxxxxx: pm <= noise_pm;
7'b01xxxxx: pm <= { {2{noise_pm[7]}}, noise_pm[5:0] };
7'b001xxxx: pm <= { {3{noise_pm[7]}}, noise_pm[4:0] };
7'b0001xxx: pm <= { {4{noise_pm[7]}}, noise_pm[3:0] };
7'b00001xx: pm <= { {5{noise_pm[7]}}, noise_pm[2:0] };
7'b000001x: pm <= { {6{noise_pm[7]}}, noise_pm[1:0] };
7'b0000001: pm <= { {7{noise_pm[7]}}, noise_pm[0] };
default: pm <= 8'd0;
endcase
end
endcase
end
end
end
 
genvar aux;
generate
for( aux=0; aux<7; aux=aux+1 ) begin : amnoise
jt51_lfo_lfsr #(.init(aux*aux+aux) ) u_noise_am(
.rst( rst ),
.clk( clk ),
.base(sel_base),
.out( noise_am[aux] )
);
end
for( aux=0; aux<8; aux=aux+1 ) begin : pmnoise
jt51_lfo_lfsr #(.init(4*aux*aux-3*aux+40) ) u_noise_pm(
.rst( rst ),
.clk( clk ),
.base(sel_base),
.out( noise_pm[aux] )
);
end
endgenerate
endmodule
/jt51/trunk/jt51/jt51_lfo_lfsr.v
0,0 → 1,55
/* This file is part of JT51.
 
JT51 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
 
JT51 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with JT51. If not, see <http://www.gnu.org/licenses/>.
Author: Jose Tejada Gomez. Twitter: @topapate
Version: 1.0
Date: 27-10-2016
*/
 
`timescale 1ns / 1ps
 
/*
 
tab size 4
 
*/
 
module jt51_lfo_lfsr #(parameter init=220 )(
input rst,
input clk,
input base,
output out
);
 
reg [18:0] bb;
assign out = bb[18];
 
reg last_base;
 
always @(posedge clk) begin : base_counter
if( rst ) begin
bb <= init[18:0];
last_base <= 1'b0;
end
else begin
last_base <= base;
if( last_base != base ) begin
bb[18:1] <= bb[17:0];
bb[0] <= ^{bb[0],bb[1],bb[14],bb[15],bb[17],bb[18]};
end
end
end
 
endmodule
/jt51/trunk/jt51/jt51_lin2exp.v
0,0 → 1,97
/* This file is part of JT51.
 
JT51 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
 
JT51 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with JT51. If not, see <http://www.gnu.org/licenses/>.
Author: Jose Tejada Gomez. Twitter: @topapate
Version: 1.0
Date: 27-10-2016
*/
 
`timescale 1ns / 1ps
 
module jt51_lin2exp(
input [15:0] lin,
output reg [9:0] man,
output reg [2:0] exp
);
 
always @(*) begin
casex( lin[15:9] )
// negative numbers
7'b10XXXXX: begin
man <= lin[15:6];
exp <= 3'd7;
end
7'b110XXXX: begin
man <= lin[14:5];
exp <= 3'd6;
end
7'b1110XXX: begin
man <= lin[13:4];
exp <= 3'd5;
end
7'b11110XX: begin
man <= lin[12:3];
exp <= 3'd4;
end
7'b111110X: begin
man <= lin[11:2];
exp <= 3'd3;
end
7'b1111110: begin
man <= lin[10:1];
exp <= 3'd2;
end
7'b1111111: begin
man <= lin[ 9:0];
exp <= 3'd1;
end
// positive numbers
7'b01XXXXX: begin
man <= lin[15:6];
exp <= 3'd7;
end
7'b001XXXX: begin
man <= lin[14:5];
exp <= 3'd6;
end
7'b0001XXX: begin
man <= lin[13:4];
exp <= 3'd5;
end
7'b00001XX: begin
man <= lin[12:3];
exp <= 3'd4;
end
7'b000001X: begin
man <= lin[11:2];
exp <= 3'd3;
end
7'b0000001: begin
man <= lin[10:1];
exp <= 3'd2;
end
7'b0000000: begin
man <= lin[ 9:0];
exp <= 3'd1;
end
default: begin
man <= lin[9:0];
exp <= 3'd1;
end
endcase
end
 
endmodule
/jt51/trunk/jt51/jt51_mmr.v
0,0 → 1,276
/* This file is part of JT51.
 
JT51 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
 
JT51 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with JT51. If not, see <http://www.gnu.org/licenses/>.
Author: Jose Tejada Gomez. Twitter: @topapate
Version: 1.0
Date: 27-10-2016
*/
 
`timescale 1ns / 1ps
 
module jt51_mmr(
input rst,
input clk, // P1
input [7:0] d_in,
input write,
input a0,
output reg busy,
// CT
output reg ct1,
output reg ct2,
// Noise
output reg ne,
output reg [4:0] nfrq,
 
// LFO
output reg [7:0] lfo_freq,
output reg [1:0] lfo_w,
output reg [6:0] lfo_amd,
output reg [6:0] lfo_pmd,
output reg lfo_rst,
// Timers
output reg [9:0] value_A,
output reg [7:0] value_B,
output reg load_A,
output reg load_B,
output reg enable_irq_A,
output reg enable_irq_B,
output reg clr_flag_A,
output reg clr_flag_B,
output reg clr_run_A,
output reg clr_run_B,
output reg set_run_A,
output reg set_run_B,
input flag_A,
 
`ifdef TEST_SUPPORT
// Test
output reg test_eg,
output reg test_op0,
`endif
// REG
output [1:0] rl_out,
output [2:0] fb_out,
output [2:0] con_out,
output [6:0] kc_out,
output [5:0] kf_out,
output [2:0] pms_out,
output [1:0] ams_out,
output [2:0] dt1_out,
output [3:0] mul_out,
output [6:0] tl_out,
output [1:0] ks_out,
output [4:0] ar_out,
output amsen_out,
output [4:0] d1r_out,
output [1:0] dt2_out,
output [4:0] d2r_out,
output [3:0] d1l_out,
output [3:0] rr_out,
output kon_out,
output koff_out,
 
output [1:0] cur_op,
 
output zero
);
 
reg [7:0] selected_register;
 
reg up_clr;
reg up_rl, up_kc, up_kf, up_pms,
up_dt1, up_tl, up_ks, up_dt2,
up_d1l, up_kon, up_amsen;
 
wire busy_reg;
 
parameter REG_TEST = 8'h01,
REG_TEST2 = 8'h02,
REG_KON = 8'h08,
REG_NOISE = 8'h0f,
REG_CLKA1 = 8'h10,
REG_CLKA2 = 8'h11,
REG_CLKB = 8'h12,
REG_TIMER = 8'h14,
REG_LFRQ = 8'h18,
REG_PMDAMD = 8'h19,
REG_CTW = 8'h1b;
 
reg csm;
 
always @(posedge clk) begin : memory_mapped_registers
if( rst ) begin
selected_register <= 8'h0;
busy <= 1'b0;
{ up_rl, up_kc, up_kf, up_pms, up_dt1, up_tl,
up_ks, up_amsen, up_dt2, up_d1l, up_kon } <= 11'd0;
`ifdef TEST_SUPPORT
{ test_eg, test_op0 } <= 2'd0;
`endif
// timers
{ value_A, value_B } <= 18'd0;
{ clr_flag_B, clr_flag_A,
enable_irq_B, enable_irq_A, load_B, load_A } <= 6'd0;
{ clr_run_A, clr_run_B, set_run_A, set_run_B } <= 4'b1100;
up_clr <= 1'b0;
// LFO
{ lfo_amd, lfo_pmd } <= 14'h0;
lfo_freq <= 8'd0;
lfo_w <= 2'd0;
lfo_rst <= 1'b0;
{ ct2, ct1 } <= 2'd0;
csm <= 1'b0;
end else begin
// WRITE IN REGISTERS
if( write && !busy ) begin
busy <= 1'b1;
if( !a0 )
selected_register <= d_in;
else begin
// Global registers
if( selected_register < 8'h20 ) begin
case( selected_register)
// registros especiales
REG_TEST: lfo_rst <= 1'b1; // regardless of d_in
`ifdef TEST_SUPPORT
REG_TEST2: { test_op0, test_eg } <= d_in[1:0];
`endif
REG_KON: up_kon <= 1'b1;
REG_NOISE: { ne, nfrq } <= { d_in[7], d_in[4:0] };
REG_CLKA1: value_A[9:2]<= d_in;
REG_CLKA2: value_A[1:0]<= d_in[1:0];
REG_CLKB: value_B <= d_in;
REG_TIMER: begin
csm <= d_in[7];
{ clr_flag_B, clr_flag_A,
enable_irq_B, enable_irq_A,
load_B, load_A } <= d_in[5:0];
clr_run_A <= ~d_in[0];
set_run_A <= d_in[0];
clr_run_B <= ~d_in[1];
set_run_B <= d_in[1];
end
REG_LFRQ: lfo_freq <= d_in;
REG_PMDAMD: begin
if( !d_in[7] )
lfo_amd <= d_in[6:0];
else
lfo_pmd <= d_in[6:0];
end
REG_CTW: begin
{ ct2, ct1 } <= d_in[7:6];
lfo_w <= d_in[1:0];
end
endcase
end else
// channel registers
if( selected_register < 8'h40 ) begin
case( selected_register[4:3] )
2'h0: up_rl <= 1'b1;
2'h1: up_kc <= 1'b1;
2'h2: up_kf <= 1'b1;
2'h3: up_pms<= 1'b1;
endcase
end
else
// operator registers
begin
case( selected_register[7:5] )
3'h2: up_dt1 <= 1'b1;
3'h3: up_tl <= 1'b1;
3'h4: up_ks <= 1'b1;
3'h5: up_amsen <= 1'b1;
3'h6: up_dt2 <= 1'b1;
3'h7: up_d1l <= 1'b1;
endcase
end
end
end
else begin /* clear once-only bits */
csm <= 1'b0;
lfo_rst <= 1'b0;
{ clr_flag_B, clr_flag_A, load_B, load_A } <= 4'd0;
{ clr_run_A, clr_run_B, set_run_A, set_run_B } <= 4'd0;
if( |{ up_rl, up_kc, up_kf, up_pms, up_dt1, up_tl,
up_ks, up_amsen, up_dt2, up_d1l, up_kon } == 1'b0 )
busy <= busy_reg;
else
busy <= 1'b1;
if( busy_reg ) begin
up_clr <= 1'b1;
end
else begin
up_clr <= 1'b0;
if( up_clr )
{ up_rl, up_kc, up_kf, up_pms, up_dt1, up_tl,
up_ks, up_amsen, up_dt2, up_d1l, up_kon } <= 11'd0;
end
end
end
end
 
jt51_reg u_reg(
.rst ( rst ),
.clk ( clk ), // P1
.d_in ( d_in ),
 
.up_rl( up_rl ),
.up_kc( up_kc ),
.up_kf( up_kf ),
.up_pms( up_pms ),
.up_dt1( up_dt1 ),
.up_tl( up_tl ),
.up_ks( up_ks ),
.up_amsen( up_amsen ),
.up_dt2( up_dt2 ),
.up_d1l( up_d1l ),
.up_kon( up_kon ),
.op( selected_register[4:3] ), // operator to update
.ch( selected_register[2:0] ), // channel to update
.csm ( csm ),
.flag_A ( flag_A ),
 
.busy( busy_reg ),
.rl_out( rl_out ),
.fb_out( fb_out ),
.con_out( con_out ),
.kc_out( kc_out ),
.kf_out( kf_out ),
.pms_out( pms_out ),
.ams_out( ams_out ),
.dt1_out( dt1_out ),
.mul_out( mul_out ),
.tl_out( tl_out ),
.ks_out( ks_out ),
.ar_out( ar_out ),
.amsen_out( amsen_out ),
.d1r_out( d1r_out ),
.dt2_out( dt2_out ),
.d2r_out( d2r_out ),
.d1l_out( d1l_out ),
.rr_out( rr_out ),
.kon_out(kon_out),
.koff_out(koff_out),
 
.cur_op(cur_op),
.zero(zero)
);
 
endmodule
/jt51/trunk/jt51/jt51_noise.v
0,0 → 1,126
/* This file is part of JT51.
 
JT51 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
 
JT51 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with JT51. If not, see <http://www.gnu.org/licenses/>.
Author: Jose Tejada Gomez. Twitter: @topapate
Version: 1.0
Date: 27-10-2016
*/
 
`timescale 1ns / 1ps
 
/*
 
tab size 4
See xapp052.pdf from Xilinx
The NFRQ formula in the App. Note does not make sense:
Output rate is 55kHz but for NFRQ=1 the formula states that
the noise is 111kHz, twice the output rate per channel.
That would suggest that the noise for LEFT and RIGHT are
different but the rest of the system suggest that LEFT and
RIGHT outputs are calculated at the same time, based on the
same OP output.
Also, the block diagram states a 1 bit serial input from
EG to NOISE and that seems unnecessary too.
I have not been able to measure noise in actual chip because
operator 31 does not produce any output on my two chips.
 
*/
 
module jt51_noise(
input rst,
input clk,
input zero,
input ne,
input [4:0] nfrq,
input [9:0] eg,
output [9:0] out,
output op31_acc
);
 
reg [9:0] limit;
wire zero_out;
 
always @(posedge clk)
if( ne ) begin
if( zero_out )
casex ( ~eg )
10'b1xxxxxxxxx: limit <= 10'h3FF;
10'b01xxxxxxxx: limit <= 10'h1FF;
10'b001xxxxxxx: limit <= 10'h0FF;
10'b0001xxxxxx: limit <= 10'h07F;
10'b00001xxxxx: limit <= 10'h03F;
10'b000001xxxx: limit <= 10'h01F;
10'b0000001xxx: limit <= 10'h00F;
10'b00000001xx: limit <= 10'h007;
10'b000000001x: limit <= 10'h003;
10'b0000000001: limit <= 10'h001;
endcase
end
else limit <= 10'd0;
 
 
reg base;
reg [4:0] cnt;
 
always @(posedge clk)
if( rst ) begin
base <= 1'b0;
cnt <= 5'b1;
end
else begin
if( zero_out ) begin
if ( cnt==nfrq && nfrq!=5'd0 ) begin
base <= ~base;
cnt <= 5'b1;
end
else cnt <= cnt + 1'b1;
end
end
 
wire [9:0] pre;
 
assign out = pre & limit;
 
genvar aux;
generate
for( aux=0; aux<10; aux=aux+1) begin : noise_lfsr
jt51_noise_lfsr #(.init(aux*29+97*aux*aux*aux)) u_lfsr (
.rst ( rst ),
.clk ( clk ),
.base ( base ),
.out ( pre[aux] )
);
end
endgenerate
 
// shift ZERO to make it match the output of OP31 from EG
jt51_sh #( .width(1), .stages(5) ) u_zerosh(
.clk ( clk ),
.din ( zero ),
.drop ( zero_out )
);
 
jt51_sh #( .width(1), .stages(7) ) u_op31sh(
.clk ( clk ),
.din ( zero_out ),
.drop ( op31_acc )
);
 
endmodule
/jt51/trunk/jt51/jt51_noise_lfsr.v
0,0 → 1,57
/* This file is part of JT51.
 
JT51 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
 
JT51 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with JT51. If not, see <http://www.gnu.org/licenses/>.
Author: Jose Tejada Gomez. Twitter: @topapate
Version: 1.0
Date: 27-10-2016
*/
 
`timescale 1ns / 1ps
 
/*
 
tab size 4
See xapp052.pdf from Xilinx
 
*/
 
module jt51_noise_lfsr #(parameter init=14220 )(
input rst,
input clk,
input base,
output out
);
 
reg [16:0] bb;
assign out = bb[16];
 
reg last_base;
 
always @(posedge clk) begin : base_counter
if( rst ) begin
bb <= init[16:0];
last_base <= 1'b0;
end
else begin
last_base <= base;
if( last_base != base ) begin
bb[16:1] <= bb[15:0];
bb[0] <= ~(bb[16]^bb[13]);
end
end
end
 
endmodule
/jt51/trunk/jt51/jt51_op.v
0,0 → 1,240
/* This file is part of JT51.
 
JT51 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
 
JT51 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with JT51. If not, see <http://www.gnu.org/licenses/>.
Author: Jose Tejada Gomez. Twitter: @topapate
Version: 1.0
Date: 27-10-2016
*/
 
`timescale 1ns / 1ps
 
/*
 
Pipeline operator
 
*/
 
module jt51_op(
`ifdef TEST_SUPPORT
input test_eg,
input test_op0,
`endif
input clk, // P1
input [19:0] phase_cnt,
input [2:0] con,
input [1:0] cur_op,
input [2:0] fb,
// volume
input [9:0] eg,
// output data
output reg signed [13:0] out
);
 
 
reg [ 9:0] phase;
reg [ 4:0] log_msb, log_msb2;
reg [12:0] pre; // preattenuation value
reg [3:0] sign;
reg [12:0] out_abs;
 
reg [7:0] phase_addr;
wire [11:0] log_val; // sine mantisa, in 2's complement
 
jt51_sintable u_sintable(
.phase ( phase_addr ),
.log_val ( log_val )
);
 
 
reg [7:0] pow_addr;
wire [12:0] pow_val;
 
jt51_exptable u_exptable(
.pow_addr( pow_addr ),
.pow_val ( pow_val )
);
 
reg [9:0] eg_II, eg_III;
`ifdef TEST_SUPPORT
reg [9:0] eg_IV, eg_V, eg_VI;
`endif
reg signed [19:0] modulation;
wire [2:0] con_I, con_VII;
wire [1:0] cur_op_VII, cur_op_I;
wire [2:0] fb_I;
 
parameter mod_lat = 5; /* latency */
parameter mod_stg = 5*8-mod_lat; /* stages */
reg [14*mod_stg-1:0] mod;
 
wire signed [13:0] mod1 = mod[ (16-mod_lat)*14-1: (15-mod_lat)*14 ];
wire signed [13:0] mod2 = mod[ (24-mod_lat)*14-1: (23-mod_lat)*14 ];
wire signed [13:0] mod3 = mod[ (32-mod_lat)*14-1: (31-mod_lat)*14 ];
wire signed [13:0] mod4 = mod[ (40-mod_lat)*14-1: (39-mod_lat)*14 ];
wire signed [13:0] mod7;
 
wire mod7_en = cur_op_I==2'd0;
 
jt51_sh2 #( .width(14), .stages(8) ) u_mod7sh(
.clk ( clk ),
.en ( mod7_en ),
.ld ( 1'b1 ),
.din ( mod3 ),
.drop ( mod7 )
);
 
 
parameter M1=2'd0, M2=2'd1, C1=02'd2, C2=2'd3;
 
always @(*) begin
case( cur_op_I )
default: // M1, FL
case( fb_I )
3'd0: modulation <= 20'd0;
3'd1: modulation <= (mod3+mod7)<<1;
3'd2: modulation <= (mod3+mod7)<<2;
3'd3: modulation <= (mod3+mod7)<<3;
3'd4: modulation <= (mod3+mod7)<<4;
3'd5: modulation <= (mod3+mod7)<<5;
3'd6: modulation <= (mod3+mod7)<<6;
3'd7: modulation <= (mod3+mod7)<<7;
endcase
C1: case(con_I)
3'd7, 3'd2, 3'd1:
modulation <= 20'd0;
default:
modulation <= mod1<<9; // M1
endcase
C2: case(con_I)
default: // 3'd4, 3'd1, 3'd0:
modulation <= mod1<<9; // M2
3'd2:
modulation <= (mod1+mod2)<<9; // M2+M1
3'd3:
modulation <= (mod1+mod4)<<9; // M2+C1
3'd5:
modulation <= mod2<<9; // M1
3'd7, 3'd6:
modulation <= 20'd0;
endcase
M2: case(con_I)
default: // 3'd2, 3'd0:
modulation <= mod2<<9; // C1
3'd1:
modulation <= (mod2+mod4)<<9; // C1+M1
3'd5:
modulation <= mod4<<9; // M1
3'd7, 3'd6, 3'd4, 3'd3:
modulation <= 20'd0;
endcase
endcase
end
 
 
always @(posedge clk) begin
// I
phase <= (phase_cnt + modulation)>>10;
eg_II <= eg;
// II
phase_addr <= phase[8]? ~phase[7:0]:phase[7:0];
sign[0] <= phase[9];
eg_III <= eg_II;
// III
{ log_msb, pow_addr } <= log_val[11:0] + { eg_III, 2'b0};
sign[1] <= sign[0];
`ifdef TEST_SUPPORT
eg_IV <= eg_III;
`endif
// IV
pre <= pow_val;
log_msb2<= log_msb;
sign[2] <= sign[1];
`ifdef TEST_SUPPORT
eg_V <= eg_IV;
`endif
// V
case( log_msb2 )
5'h0: out_abs <= pre;
5'h1: out_abs <= pre >> 1;
5'h2: out_abs <= pre >> 2;
5'h3: out_abs <= pre >> 3;
5'h4: out_abs <= pre >> 4;
5'h5: out_abs <= pre >> 5;
5'h6: out_abs <= pre >> 6;
5'h7: out_abs <= pre >> 7;
5'h8: out_abs <= pre >> 8;
5'h9: out_abs <= pre >> 9;
5'hA: out_abs <= pre >> 10;
5'hB: out_abs <= pre >> 11;
5'hC: out_abs <= pre >> 12;
default: out_abs <= 13'd0;
endcase
sign[3] <= sign[2];
`ifdef TEST_SUPPORT
eg_VI <= eg_V;
`endif
// VI
mod[14*mod_stg-1:14] <= mod[14*(mod_stg-1)-1:0];
`ifdef TEST_SUPPORT
if( test_eg)
mod[14-1:0] <= eg_VI;
else
`endif
mod[14-1:0] <= sign[3] ? ~{1'b0,out_abs}+1'b1 : {1'b0,out_abs} ;
// VII
`ifdef TEST_SUPPORT
if( test_op0 ) begin
if( cur_op_VII==3'd0)
out <= mod[14-1:0];
else
out <= 14'd0;
end
else
`endif
case( con_VII )
3'd0, 3'd1, 3'd2, 3'd3:
if( cur_op_VII!=2'd3 )
out <= 14'd0;
else
out <= mod[14-1:0];
3'd4:
if( cur_op_VII==2'd0 || cur_op_VII==2'd1 )
out <= 14'd0;
else
out <= mod[14-1:0];
3'd5, 3'd6:
if( cur_op_VII==2'd0 )
out <= 14'd0;
else
out <= mod[14-1:0];
3'd7: out <= mod[14-1:0];
endcase
end
 
jt51_sh #( .width(8), .stages(7) ) u_con1sh(
.clk ( clk ),
.din ( { con, cur_op, fb } ),
.drop ( { con_I, cur_op_I, fb_I } )
);
 
 
jt51_sh #( .width(5), .stages(6) ) u_con7sh(
.clk ( clk ),
.din ( { con_I, cur_op_I } ),
.drop ( { con_VII, cur_op_VII } )
);
 
 
endmodule
/jt51/trunk/jt51/jt51_phasegen.v
0,0 → 1,233
/* This file is part of JT51.
 
JT51 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
 
JT51 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with JT51. If not, see <http://www.gnu.org/licenses/>.
Author: Jose Tejada Gomez. Twitter: @topapate
Version: 1.0
Date: 27-10-2016
*/
 
`timescale 1ns / 1ps
 
/*
 
tab size 4
 
*/
 
module jt51_phasegen(
input clk,
// Channel frequency
input [6:0] kc,
input [5:0] kf,
// Operator multiplying
input [3:0] mul,
// Operator detuning
input [2:0] dt1,
input [1:0] dt2,
// phase modulation from LFO
input [7:0] pm,
input [2:0] pms,
// phase operation
input keyon,
output reg [ 4:0] keycode_III,
output [19:0] phase_now
);
 
wire [19:0] phase_drop;
 
reg [19:0] phase_base_VI, phase_step, phase_step_VII;
reg [17:0] phase_base_IV, phase_base_V;
wire keyon_VII;
assign phase_now = keyon_VII ? 20'd0 : phase_drop + phase_step;
 
wire [11:0] phinc_III;
 
reg [ 9:0] phinc_addr_III;
 
reg [13:0] keycode_II;
reg [5:0] dt1_kf_III;
reg [ 2:0] dt1_kf_IV;
 
reg [4:0] pow2;
reg [4:0] dt1_offset_V;
reg [2:0] pow2ind_IV;
 
wire [3:0] mul_V;
reg [2:0] dt1_II, dt1_III, dt1_IV, dt1_V;
 
jt51_phinc_rom u_phinctable(
// .clk ( clk ),
.keycode( phinc_addr_III[9:0] ),
.phinc ( phinc_III )
);
 
always @(*) begin : calcpow2
case( pow2ind_IV )
3'd0: pow2 <= 5'd16;
3'd1: pow2 <= 5'd17;
3'd2: pow2 <= 5'd19;
3'd3: pow2 <= 5'd20;
3'd4: pow2 <= 5'd22;
3'd5: pow2 <= 5'd24;
3'd6: pow2 <= 5'd26;
3'd7: pow2 <= 5'd29;
endcase
end
 
reg [5:0] dt1_limit, dt1_unlimited;
reg [4:0] dt1_limited_IV;
 
always @(*) begin : dt1_limit_mux
case( dt1_IV[1:0] )
default: dt1_limit <= 5'd8;
2'd1: dt1_limit <= 5'd8;
2'd2: dt1_limit <= 5'd16;
2'd3: dt1_limit <= 5'd22;
endcase
case( dt1_kf_IV )
3'd0: dt1_unlimited <= { 5'd0, pow2[4] }; // <2
3'd1: dt1_unlimited <= { 4'd0, pow2[4:3] }; // <4
3'd2: dt1_unlimited <= { 3'd0, pow2[4:2] }; // <8
3'd3: dt1_unlimited <= { 2'd0, pow2[4:1] };
3'd4: dt1_unlimited <= { 1'd0, pow2[4:0] };
3'd5: dt1_unlimited <= { pow2[4:0], 1'd0 };
default:dt1_unlimited <= 6'd0;
endcase
dt1_limited_IV <= dt1_unlimited > dt1_limit ?
dt1_limit : dt1_unlimited[4:0];
end
 
reg signed [8:0] mod;
 
always @(*) begin
case( pms ) // comprobar en silicio
3'd0: mod <= 9'd0;
3'd1: mod <= { 7'd0, pm[6:5] };
3'd2: mod <= { 6'd0, pm[6:4] };
3'd3: mod <= { 5'd0, pm[6:3] };
3'd4: mod <= { 4'd0, pm[6:2] };
3'd5: mod <= { 3'd0, pm[6:1] };
3'd6: mod <= { 1'd0, pm[6:0], 1'b0 };
3'd7: mod <= { pm[6:0], 2'b0 };
endcase
end
 
 
reg [3:0] octave_III;
 
wire [12:0] keycode_I;
 
jt51_pm u_pm(
// Channel frequency
.kc(kc),
.kf(kf),
.add(~pm[7]),
.mod(mod),
.kcex(keycode_I)
);
 
// limit value at which we add +64 to the keycode
// I assume this is to avoid the note==3 violation somehow
parameter dt2_lim2 = 8'd11 + 8'd64;
parameter dt2_lim3 = 8'd31 + 8'd64;
 
always @(posedge clk) begin : phase_calculation
// I
case ( dt2 )
2'd0: keycode_II <= { 1'b0, keycode_I } +
(keycode_I[7:6]==2'd3 ? 14'd64:14'd0);
2'd1: keycode_II <= { 1'b0, keycode_I } + 14'd512 +
(keycode_I[7:6]==2'd3 ? 14'd64:14'd0);
2'd2: keycode_II <= { 1'b0, keycode_I } + 14'd628 +
(keycode_I[7:0]>dt2_lim2 ? 14'd64:14'd0);
2'd3: keycode_II <= { 1'b0, keycode_I } + 14'd800 +
(keycode_I[7:0]>dt2_lim3 ? 14'd64:14'd0);
endcase
dt1_II <= dt1;
// II
phinc_addr_III <= keycode_II[9:0];
octave_III <= keycode_II[13:10];
keycode_III <= keycode_II[12:8];
case( dt1_II[1:0] )
2'd1: dt1_kf_III <= keycode_II[13:8] - (6'b1<<2);
2'd2: dt1_kf_III <= keycode_II[13:8] + (6'b1<<2);
2'd3: dt1_kf_III <= keycode_II[13:8] + (6'b1<<3);
default:dt1_kf_III <= keycode_II[13:8];
endcase
dt1_III <= dt1_II;
// III
case( octave_III )
4'd0: phase_base_IV <= { 8'd0, phinc_III[11:2] };
4'd1: phase_base_IV <= { 7'd0, phinc_III[11:1] };
4'd2: phase_base_IV <= { 6'd0, phinc_III[11:0] };
4'd3: phase_base_IV <= { 5'd0, phinc_III[11:0], 1'b0 };
4'd4: phase_base_IV <= { 4'd0, phinc_III[11:0], 2'b0 };
4'd5: phase_base_IV <= { 3'd0, phinc_III[11:0], 3'b0 };
4'd6: phase_base_IV <= { 2'd0, phinc_III[11:0], 4'b0 };
4'd7: phase_base_IV <= { 1'd0, phinc_III[11:0], 5'b0 };
4'd8: phase_base_IV <= { phinc_III[11:0], 6'b0 };
default:phase_base_IV <= 18'd0;
endcase
pow2ind_IV <= dt1_kf_III[2:0];
dt1_IV <= dt1_III;
dt1_kf_IV <= dt1_kf_III[5:3];
// IV LIMIT_BASE
if( phase_base_IV > 18'd82976 )
phase_base_V <= 18'd82976;
else
phase_base_V <= phase_base_IV;
dt1_offset_V <= dt1_limited_IV;
dt1_V <= dt1_IV;
// V APPLY_DT1
if( dt1_V[1:0]==2'd0 )
phase_base_VI <= phase_base_V;
else begin
if( !dt1_V[2] )
phase_base_VI <= phase_base_V + dt1_offset_V;
else
phase_base_VI <= phase_base_V - dt1_offset_V;
end
// VI APPLY_MUL
if( mul_V==4'd0 )
phase_step_VII <= { 1'b0, phase_base_VI[19:1] };
else
phase_step_VII <= phase_base_VI * mul_V;
// VII have same number of stages as jt51_envelope
phase_step <= phase_step_VII;
`ifdef DISPLAY_STEP
$display( "%d", phase_step );
`endif
end
 
jt51_sh #( .width(4), .stages(5) ) u_mulsh(
.clk ( clk ),
.din ( mul ),
.drop ( mul_V )
);
 
jt51_sh #( .width(20), .stages(32) ) u_phsh(
.clk ( clk ),
.din ( phase_now ),
.drop ( phase_drop)
);
 
jt51_sh #( .width(1), .stages(7) ) u_kosh(
.clk ( clk ),
.din ( keyon ),
.drop ( keyon_VII)
);
 
endmodule
 
/jt51/trunk/jt51/jt51_phinc_rom.v
0,0 → 1,35
/* This file is part of JT51.
 
JT51 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
 
JT51 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with JT51. If not, see <http://www.gnu.org/licenses/>.
Author: Jose Tejada Gomez. Twitter: @topapate
Version: 1.0
Date: 27-10-2016
*/
 
`timescale 1ns / 1ps
 
module jt51_phinc_rom(
// input clk,
input [9:0] keycode,
output reg [11:0] phinc
);
 
always @(* ) begin : read_lut
case( keycode )
`include "phinc_lut.vh"
endcase
end
 
endmodule
/jt51/trunk/jt51/jt51_pm.v
0,0 → 1,95
/* This file is part of JT51.
 
JT51 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
 
JT51 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with JT51. If not, see <http://www.gnu.org/licenses/>.
Author: Jose Tejada Gomez. Twitter: @topapate
Version: 1.0
Date: 27-10-2016
*/
 
`timescale 1ns / 1ps
 
module jt51_pm(
input [6:0] kc,
input [5:0] kf,
input [8:0] mod,
input add,
output reg [12:0] kcex
);
 
reg [9:0] lim;
reg [13:0] kcex0, kcex1;
reg [1:0] extra;
 
reg [6:0] kcin;
reg carry;
 
always @(*) begin: kc_input_cleaner
{ carry, kcin } <= kc[1:0]==3'd3 ? { 1'b0, kc } + 8'd1 : {1'b0,kc};
end
 
always @(*) begin : addition
lim <= { 1'd0, mod } + { 4'd0, kf };
case( kcin[3:0] )
default:
if( lim>=10'd448 ) extra <= 2'd2;
else if( lim>=10'd256 ) extra <= 2'd1;
else extra <= 2'd0;
4'd1,4'd5,4'd9,4'd13:
if( lim>=10'd384 ) extra <= 2'd2;
else if( lim>=10'd192 ) extra <= 2'd1;
else extra <= 2'd0;
4'd2,4'd6,4'd10,4'd14:
if( lim>=10'd512 ) extra <= 2'd3;
else if( lim>=10'd320 ) extra <= 2'd2;
else if( lim>=10'd128 ) extra <= 2'd1;
else extra <= 2'd0;
endcase
kcex0 <= {1'b0,kcin,kf} + { 4'd0, extra, 6'd0 } + { 1'd0, mod };
kcex1 <= kcex0[7:6]==2'd3 ? kcex0 + 14'd64 : kcex0;
end
 
reg signed [9:0] slim;
reg [1:0] sextra;
reg [13:0] skcex0, skcex1;
 
always @(*) begin : subtraction
slim <= { 1'd0, mod } - { 4'd0, kf };
case( kcin[3:0] )
default:
if( slim>=10'sd449 ) sextra <= 2'd3;
else if( slim>=10'sd257 ) sextra <= 2'd2;
else if( slim>=10'sd65 ) sextra <= 2'd1;
else sextra <= 2'd0;
4'd1,4'd5,4'd9,4'd13:
if( slim>=10'sd321 ) sextra <= 2'd2;
else if( slim>=10'sd129 ) sextra <= 2'd1;
else sextra <= 2'd0;
4'd2,4'd6,4'd10,4'd14:
if( slim>=10'sd385 ) sextra <= 2'd2;
else if( slim>=10'sd193 ) sextra <= 2'd1;
else sextra <= 2'd0;
endcase
skcex0 <= {1'b0,kcin,kf} - { 4'd0, sextra, 6'd0 } - { 1'd0, mod };
skcex1 <= skcex0[7:6]==2'd3 ? skcex0 - 14'd64 : skcex0;
end
 
always @(*) begin : mux
if ( add )
kcex <= kcex1[13] | carry ? {3'd7, 4'd14, 6'd63} : kcex1[12:0];
else
kcex <= carry ? {3'd7, 4'd14, 6'd63} : (skcex1[13] ? 13'd0 : skcex1[12:0]);
end
 
endmodule
/jt51/trunk/jt51/jt51_reg.v
0,0 → 1,273
/* This file is part of JT51.
 
JT51 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
 
JT51 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with JT51. If not, see <http://www.gnu.org/licenses/>.
Author: Jose Tejada Gomez. Twitter: @topapate
Version: 1.0
Date: 27-10-2016
*/
 
`timescale 1ns / 1ps
 
module jt51_reg(
input rst,
input clk, // P1
input [7:0] d_in,
 
input up_rl,
input up_kc,
input up_kf,
input up_pms,
input up_dt1,
input up_tl,
input up_ks,
input up_amsen,
input up_dt2,
input up_d1l,
input up_kon,
input [1:0] op, // operator to update
input [2:0] ch, // channel to update
input csm,
input flag_A,
 
output busy,
output [1:0] rl_out,
output [2:0] fb_out,
output [2:0] con_out,
output [6:0] kc_out,
output [5:0] kf_out,
output [2:0] pms_out,
output [1:0] ams_out,
output [2:0] dt1_out,
output [3:0] mul_out,
output [6:0] tl_out,
output [1:0] ks_out,
output [4:0] ar_out,
output amsen_out,
output [4:0] d1r_out,
output [1:0] dt2_out,
output [4:0] d2r_out,
output [3:0] d1l_out,
output [3:0] rr_out,
output kon_out,
output koff_out,
 
output [1:0] cur_op,
 
output reg zero
);
 
reg kon, koff;
reg [1:0] csm_state;
reg [4:0] csm_cnt;
 
wire csm_kon = csm_state[0];
wire csm_koff = csm_state[1];
 
assign kon_out = kon | csm_kon;
assign koff_out = koff | csm_koff;
 
wire [1:0] rl_in = d_in[7:6];
wire [2:0] fb_in = d_in[5:3];
wire [2:0] con_in = d_in[2:0];
wire [6:0] kc_in = d_in[6:0];
wire [5:0] kf_in = d_in[7:2];
wire [2:0] pms_in = d_in[6:4];
wire [1:0] ams_in = d_in[1:0];
wire [2:0] dt1_in = d_in[6:4];
wire [3:0] mul_in = d_in[3:0];
wire [6:0] tl_in = d_in[6:0];
wire [1:0] ks_in = d_in[7:6];
wire [4:0] ar_in = d_in[4:0];
wire amsen_in= d_in[7];
wire [4:0] d1r_in = d_in[4:0];
wire [1:0] dt2_in = d_in[7:6];
wire [4:0] d2r_in = d_in[4:0];
wire [3:0] d1l_in = d_in[7:4];
wire [3:0] rr_in = d_in[3:0];
 
wire up = up_rl | up_kc | up_kf | up_pms | up_dt1 | up_tl |
up_ks | up_amsen | up_dt2 | up_d1l;
 
reg [4:0] cnt, next, cur;
reg last, last_kon;
reg [1:0] cnt_kon;
reg busy_op, busy_kon;
 
assign busy = busy_op | busy_kon;
 
assign cur_op = cur[4:3];
 
always @(*) begin
next <= cur +1'b1;
end
 
wire [4:0] abs = { op, ch };
wire update_op = abs == cur;
wire update_ch = ch == cur[2:0];
 
wire up_rl_ch = up_rl & update_ch;
wire up_kc_ch = up_kc & update_ch;
wire up_kf_ch = up_kf & update_ch;
wire up_pms_ch = up_pms & update_ch;
wire up_dt1_op = up_dt1 & update_op;
wire up_tl_op = up_tl & update_op;
wire up_ks_op = up_ks & update_op;
wire up_amsen_op= up_amsen & update_op;
wire up_dt2_op = up_dt2 & update_op;
wire up_d1l_op = up_d1l & update_op;
 
 
 
always @(posedge clk) begin : up_counter
if( rst ) begin
cnt <= 5'h0;
cur <= 5'h0;
last <= 1'b0;
zero <= 1'b0;
busy_op <= 1'b0;
end
else begin
cur <= next;
zero <= cur== 5'd0;
last <= up;
if( up && !last ) begin
cnt <= cur;
busy_op <= 1'b1;
end
else if( cnt == cur ) busy_op <= 1'b0;
end
end
 
 
always @(posedge clk) begin : keyon_csm
if( rst ) begin
csm_state <= 2'b0;
csm_cnt <= 5'd0;
end
else begin
if( csm && flag_A ) begin
csm_state <= 2'b1;
csm_cnt <= 5'd0;
end
else begin
if( csm_cnt==5'd31 ) begin
if( csm_state==2'b1 ) begin
csm_state <= 2'b10;
csm_cnt <= 5'd0;
end
else csm_state <= 2'b0;
end
else csm_cnt <= csm_cnt+1'b1;
end
end
end
 
reg [3:0] kon_op;
 
always @(posedge clk) begin : keyon
if( rst ) begin
last_kon <= 1'b0;
busy_kon <= 1'b0;
kon_op <= 4'd0;
{ kon, koff } <= 2'd0;
end
else begin
last_kon<= up_kon;
if( up_kon && !last_kon ) begin
busy_kon <= 1'b1;
kon_op[0] <= d_in[5]; // M2
kon_op[1] <= d_in[4]; // C1
kon_op[2] <= d_in[6]; // C2
kon_op[3] <= d_in[3]; // M1
cnt_kon <= 2'd0;
{ kon, koff } <= 2'd0;
end
else
if( busy_kon && next[2:0]==d_in[2:0]) begin
case( cnt_kon )
2'd0: // M2
if(next[4:3]==2'd1) begin
{ kon, koff } <= { kon_op[0], ~kon_op[0] };
cnt_kon <= 2'd1;
end
2'd1: // C1
if(next[4:3]==2'd2) begin
{ kon, koff } <= { kon_op[1], ~kon_op[1] };
cnt_kon <= 2'd2;
end
2'd2: // C2
if(next[4:3]==2'd3) begin
{ kon, koff } <= { kon_op[2], ~kon_op[2] };
cnt_kon <= 2'd3;
end
2'd3: // M1
if(next[4:3]==2'd0) begin
{ kon, koff } <= { kon_op[3], ~kon_op[3] };
busy_kon <= 1'b0;
end
endcase
end
else { kon, koff } <= 2'd0;
end
end
 
// memory for OP registers
 
reg [41:0] reg_op[31:0];
reg [41:0] reg_out;
 
assign { dt1_out, mul_out, tl_out, ks_out, ar_out, amsen_out, d1r_out,
dt2_out, d2r_out, d1l_out, rr_out } = reg_out;
 
wire [41:0] reg_in = {
up_dt1_op ? { dt1_in, mul_in} : { dt1_out, mul_out },
up_tl_op ? tl_in : tl_out,
up_ks_op ? { ks_in, ar_in } : { ks_out, ar_out },
up_amsen_op ? { amsen_in, d1r_in } : { amsen_out, d1r_out },
up_dt2_op ? { dt2_in, d2r_in } : { dt2_out, d2r_out },
up_d1l_op ? { d1l_in, rr_in } : { d1l_out, rr_out } };
 
wire opdata_wr = |{ up_dt1_op, up_tl_op, up_ks_op, up_amsen_op, up_dt2_op, up_d1l_op };
 
always @(posedge clk) begin
reg_out <= reg_op[next];
if( opdata_wr )
reg_op[cur] <= reg_in;
end
 
// memory for CH registers
 
reg [25:0] reg_ch[7:0];
reg [25:0] reg_ch_out;
wire [25:0] reg_ch_in = {
up_rl_ch ? { rl_in, fb_in, con_in } : { rl_out, fb_out, con_out },
up_kc_ch ? kc_in : kc_out,
up_kf_ch ? kf_in : kf_out,
up_pms_ch ? { pms_in, ams_in } : { pms_out, ams_out } };
assign { rl_out, fb_out, con_out, kc_out, kf_out, pms_out, ams_out } = reg_ch_out;
 
wire [2:0] next_ch = next[2:0];
wire [2:0] cur_ch = cur[2:0];
wire chdata_wr = |{up_rl_ch, up_kc_ch, up_kf_ch, up_pms_ch };
 
always @(posedge clk) begin
reg_ch_out <= reg_ch[next_ch];
if( chdata_wr )
reg_ch[cur_ch] <= reg_ch_in;
end
 
endmodule
/jt51/trunk/jt51/jt51_sh.v
0,0 → 1,41
/* This file is part of JT51.
 
JT51 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
 
JT51 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with JT51. If not, see <http://www.gnu.org/licenses/>.
Author: Jose Tejada Gomez. Twitter: @topapate
Version: 1.0
Date: 27-10-2016
*/
 
`timescale 1ns / 1ps
 
module jt51_sh #(parameter width=5, stages=32 )
(
input clk,
input [width-1:0] din,
output [width-1:0] drop
);
 
reg [stages-1:0] bits[width-1:0];
 
genvar i;
generate
for (i=0; i < width; i=i+1) begin: bit_shifter
always @(posedge clk)
bits[i] <= {bits[i][stages-2:0], din[i]};
assign drop[i] = bits[i][stages-1];
end
endgenerate
 
endmodule
/jt51/trunk/jt51/jt51_sh2.v
0,0 → 1,64
/* This file is part of JT51.
 
JT51 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
 
JT51 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with JT51. If not, see <http://www.gnu.org/licenses/>.
Author: Jose Tejada Gomez. Twitter: @topapate
Version: 1.0
Date: 27-10-2016
*/
`timescale 1ns / 1ps
 
module jt51_sh2 #(parameter width=5, stages=32 )
(
input clk,
input en,
input ld,
input [width-1:0] din,
output [width-1:0] drop
);
 
genvar i;
generate
for( i=0; i<width; i=i+1) begin: shifter
jt51_sh1 #(.stages(stages)) u_sh1(
.clk ( clk ),
.en ( en ),
.ld ( ld ),
.din ( din[i] ),
.drop ( drop[i])
);
end
endgenerate
 
endmodule
 
module jt51_sh1 #(parameter stages=32)
(
input clk,
input en,
input ld,
input din,
output drop
);
 
reg [stages-1:0] shift;
assign drop = shift[0];
wire next = ld ? din : drop;
 
always @(posedge clk )
if( en )
shift <= {next, shift[stages-1:1]};
 
endmodule
/jt51/trunk/jt51/jt51_sintable.v
0,0 → 1,33
/* This file is part of JT51.
 
JT51 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
 
JT51 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with JT51. If not, see <http://www.gnu.org/licenses/>.
Author: Jose Tejada Gomez. Twitter: @topapate
Version: 1.0
Date: 27-10-2016
*/
`timescale 1ns / 1ps
 
module jt51_sintable(
input [7:0] phase,
output reg [11:0] log_val
);
 
always @(*) begin : read_lut
case( phase )
`include "sin_lut.vh"
endcase
end
 
endmodule
/jt51/trunk/jt51/jt51_sum_op.v
0,0 → 1,44
/* This file is part of JT51.
 
JT51 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
 
JT51 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with JT51. If not, see <http://www.gnu.org/licenses/>.
Author: Jose Tejada Gomez. Twitter: @topapate
Version: 1.0
Date: 27-10-2016
*/
`timescale 1ns / 1ps
 
module jt51_sum_op(
input clk,
input zero,
input en_ch,
input signed [13:0] op_out,
output reg signed [15:0] out
);
 
reg signed [18:0] sum;
 
always @(posedge clk)
if( zero ) begin
sum <= en_ch ? op_out : 19'd0;
if( sum[18:16]==3'd0 || sum[18:16]==3'b111 )
out <= sum[15:0];
else
out<={ sum[18], {15{~sum[18]}}};
end
else
if( en_ch ) sum <= sum + op_out;
 
 
endmodule
/jt51/trunk/jt51/jt51_timers.v
0,0 → 1,114
/* This file is part of JT51.
 
JT51 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
 
JT51 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with JT51. If not, see <http://www.gnu.org/licenses/>.
Author: Jose Tejada Gomez. Twitter: @topapate
Version: 1.0
Date: 27-10-2016
*/
`timescale 1ns / 1ps
 
module jt51_timers(
input clk,
input rst,
input [9:0] value_A,
input [7:0] value_B,
input load_A,
input load_B,
input clr_flag_A,
input clr_flag_B,
input set_run_A,
input set_run_B,
input clr_run_A,
input clr_run_B,
input enable_irq_A,
input enable_irq_B,
output flag_A,
output flag_B,
output overflow_A,
output irq_n
);
 
assign irq_n = ~( (flag_A&enable_irq_A) | (flag_B&enable_irq_B) );
 
jt51_timer #(.mult_width(6), .counter_width(10)) timer_A(
.clk ( clk ),
.rst ( rst ),
.start_value( value_A ),
.load ( load_A ),
.clr_flag ( clr_flag_A),
.set_run ( set_run_A ),
.clr_run ( clr_run_A ),
.flag ( flag_A ),
.overflow ( overflow_A)
);
 
jt51_timer #(.mult_width(10), .counter_width(8)) timer_B(
.clk ( clk ),
.rst ( rst ),
.start_value( value_B ),
.load ( load_B ),
.clr_flag ( clr_flag_B),
.set_run ( set_run_B ),
.clr_run ( clr_run_B ),
.flag ( flag_B ),
.overflow ( )
);
 
endmodule
 
module jt51_timer #(parameter counter_width = 10, mult_width=5 )
(
input clk,
input rst,
input [counter_width-1:0] start_value,
input load,
input clr_flag,
input set_run,
input clr_run,
output reg flag,
output reg overflow
);
 
reg run;
reg [ mult_width-1:0] mult;
reg [counter_width-1:0] cnt;
 
always@(posedge clk)
if( clr_flag || rst)
flag <= 1'b0;
else if(overflow) flag<=1'b1;
always@(posedge clk)
if( clr_run || rst)
run <= 1'b0;
else if(set_run || load) run<=1'b1;
 
reg [mult_width+counter_width-1:0] next, init;
 
always @(*) begin
{overflow, next } <= { 1'b0, cnt, mult } + 1'b1;
init <= { start_value, { (mult_width){1'b0} } };
end
 
always @(posedge clk) begin : counter
if( load ) begin
mult <= { (mult_width){1'b0} };
cnt <= start_value;
end
else if( run )
{ cnt, mult } <= overflow ? init : next;
end
endmodule
/jt51/trunk/jt51/phinc_lut.vh
0,0 → 1,1044
/* This file is part of JT51.
 
JT51 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
 
JT51 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with JT51. If not, see <http://www.gnu.org/licenses/>.
Author: Jose Tejada Gomez. Twitter: @topapate
Version: 1.0
Date: 27-10-2016
*/
10'd0: phinc <= { 12'd1299 }; // nota = 0, KF = 0
10'd1: phinc <= { 12'd1300 }; // nota = 0, KF = 1
10'd2: phinc <= { 12'd1301 }; // nota = 0, KF = 2
10'd3: phinc <= { 12'd1302 }; // nota = 0, KF = 3
10'd4: phinc <= { 12'd1303 }; // nota = 0, KF = 4
10'd5: phinc <= { 12'd1304 }; // nota = 0, KF = 5
10'd6: phinc <= { 12'd1305 }; // nota = 0, KF = 6
10'd7: phinc <= { 12'd1306 }; // nota = 0, KF = 7
10'd8: phinc <= { 12'd1308 }; // nota = 0, KF = 8
10'd9: phinc <= { 12'd1309 }; // nota = 0, KF = 9
10'd10: phinc <= { 12'd1310 }; // nota = 0, KF = 10
10'd11: phinc <= { 12'd1311 }; // nota = 0, KF = 11
10'd12: phinc <= { 12'd1313 }; // nota = 0, KF = 12
10'd13: phinc <= { 12'd1314 }; // nota = 0, KF = 13
10'd14: phinc <= { 12'd1315 }; // nota = 0, KF = 14
10'd15: phinc <= { 12'd1316 }; // nota = 0, KF = 15
10'd16: phinc <= { 12'd1318 }; // nota = 0, KF = 16
10'd17: phinc <= { 12'd1319 }; // nota = 0, KF = 17
10'd18: phinc <= { 12'd1320 }; // nota = 0, KF = 18
10'd19: phinc <= { 12'd1321 }; // nota = 0, KF = 19
10'd20: phinc <= { 12'd1322 }; // nota = 0, KF = 20
10'd21: phinc <= { 12'd1323 }; // nota = 0, KF = 21
10'd22: phinc <= { 12'd1324 }; // nota = 0, KF = 22
10'd23: phinc <= { 12'd1325 }; // nota = 0, KF = 23
10'd24: phinc <= { 12'd1327 }; // nota = 0, KF = 24
10'd25: phinc <= { 12'd1328 }; // nota = 0, KF = 25
10'd26: phinc <= { 12'd1329 }; // nota = 0, KF = 26
10'd27: phinc <= { 12'd1330 }; // nota = 0, KF = 27
10'd28: phinc <= { 12'd1332 }; // nota = 0, KF = 28
10'd29: phinc <= { 12'd1333 }; // nota = 0, KF = 29
10'd30: phinc <= { 12'd1334 }; // nota = 0, KF = 30
10'd31: phinc <= { 12'd1335 }; // nota = 0, KF = 31
10'd32: phinc <= { 12'd1337 }; // nota = 0, KF = 32
10'd33: phinc <= { 12'd1338 }; // nota = 0, KF = 33
10'd34: phinc <= { 12'd1339 }; // nota = 0, KF = 34
10'd35: phinc <= { 12'd1340 }; // nota = 0, KF = 35
10'd36: phinc <= { 12'd1341 }; // nota = 0, KF = 36
10'd37: phinc <= { 12'd1342 }; // nota = 0, KF = 37
10'd38: phinc <= { 12'd1343 }; // nota = 0, KF = 38
10'd39: phinc <= { 12'd1344 }; // nota = 0, KF = 39
10'd40: phinc <= { 12'd1346 }; // nota = 0, KF = 40
10'd41: phinc <= { 12'd1347 }; // nota = 0, KF = 41
10'd42: phinc <= { 12'd1348 }; // nota = 0, KF = 42
10'd43: phinc <= { 12'd1349 }; // nota = 0, KF = 43
10'd44: phinc <= { 12'd1351 }; // nota = 0, KF = 44
10'd45: phinc <= { 12'd1352 }; // nota = 0, KF = 45
10'd46: phinc <= { 12'd1353 }; // nota = 0, KF = 46
10'd47: phinc <= { 12'd1354 }; // nota = 0, KF = 47
10'd48: phinc <= { 12'd1356 }; // nota = 0, KF = 48
10'd49: phinc <= { 12'd1357 }; // nota = 0, KF = 49
10'd50: phinc <= { 12'd1358 }; // nota = 0, KF = 50
10'd51: phinc <= { 12'd1359 }; // nota = 0, KF = 51
10'd52: phinc <= { 12'd1361 }; // nota = 0, KF = 52
10'd53: phinc <= { 12'd1362 }; // nota = 0, KF = 53
10'd54: phinc <= { 12'd1363 }; // nota = 0, KF = 54
10'd55: phinc <= { 12'd1364 }; // nota = 0, KF = 55
10'd56: phinc <= { 12'd1366 }; // nota = 0, KF = 56
10'd57: phinc <= { 12'd1367 }; // nota = 0, KF = 57
10'd58: phinc <= { 12'd1368 }; // nota = 0, KF = 58
10'd59: phinc <= { 12'd1369 }; // nota = 0, KF = 59
10'd60: phinc <= { 12'd1371 }; // nota = 0, KF = 60
10'd61: phinc <= { 12'd1372 }; // nota = 0, KF = 61
10'd62: phinc <= { 12'd1373 }; // nota = 0, KF = 62
10'd63: phinc <= { 12'd1374 }; // nota = 0, KF = 63
10'd64: phinc <= { 12'd1376 }; // nota = 1, KF = 0
10'd65: phinc <= { 12'd1377 }; // nota = 1, KF = 1
10'd66: phinc <= { 12'd1378 }; // nota = 1, KF = 2
10'd67: phinc <= { 12'd1379 }; // nota = 1, KF = 3
10'd68: phinc <= { 12'd1381 }; // nota = 1, KF = 4
10'd69: phinc <= { 12'd1382 }; // nota = 1, KF = 5
10'd70: phinc <= { 12'd1383 }; // nota = 1, KF = 6
10'd71: phinc <= { 12'd1384 }; // nota = 1, KF = 7
10'd72: phinc <= { 12'd1386 }; // nota = 1, KF = 8
10'd73: phinc <= { 12'd1387 }; // nota = 1, KF = 9
10'd74: phinc <= { 12'd1388 }; // nota = 1, KF = 10
10'd75: phinc <= { 12'd1389 }; // nota = 1, KF = 11
10'd76: phinc <= { 12'd1391 }; // nota = 1, KF = 12
10'd77: phinc <= { 12'd1392 }; // nota = 1, KF = 13
10'd78: phinc <= { 12'd1393 }; // nota = 1, KF = 14
10'd79: phinc <= { 12'd1394 }; // nota = 1, KF = 15
10'd80: phinc <= { 12'd1396 }; // nota = 1, KF = 16
10'd81: phinc <= { 12'd1397 }; // nota = 1, KF = 17
10'd82: phinc <= { 12'd1398 }; // nota = 1, KF = 18
10'd83: phinc <= { 12'd1399 }; // nota = 1, KF = 19
10'd84: phinc <= { 12'd1401 }; // nota = 1, KF = 20
10'd85: phinc <= { 12'd1402 }; // nota = 1, KF = 21
10'd86: phinc <= { 12'd1403 }; // nota = 1, KF = 22
10'd87: phinc <= { 12'd1404 }; // nota = 1, KF = 23
10'd88: phinc <= { 12'd1406 }; // nota = 1, KF = 24
10'd89: phinc <= { 12'd1407 }; // nota = 1, KF = 25
10'd90: phinc <= { 12'd1408 }; // nota = 1, KF = 26
10'd91: phinc <= { 12'd1409 }; // nota = 1, KF = 27
10'd92: phinc <= { 12'd1411 }; // nota = 1, KF = 28
10'd93: phinc <= { 12'd1412 }; // nota = 1, KF = 29
10'd94: phinc <= { 12'd1413 }; // nota = 1, KF = 30
10'd95: phinc <= { 12'd1414 }; // nota = 1, KF = 31
10'd96: phinc <= { 12'd1416 }; // nota = 1, KF = 32
10'd97: phinc <= { 12'd1417 }; // nota = 1, KF = 33
10'd98: phinc <= { 12'd1418 }; // nota = 1, KF = 34
10'd99: phinc <= { 12'd1419 }; // nota = 1, KF = 35
10'd100: phinc <= { 12'd1421 }; // nota = 1, KF = 36
10'd101: phinc <= { 12'd1422 }; // nota = 1, KF = 37
10'd102: phinc <= { 12'd1423 }; // nota = 1, KF = 38
10'd103: phinc <= { 12'd1424 }; // nota = 1, KF = 39
10'd104: phinc <= { 12'd1426 }; // nota = 1, KF = 40
10'd105: phinc <= { 12'd1427 }; // nota = 1, KF = 41
10'd106: phinc <= { 12'd1429 }; // nota = 1, KF = 42
10'd107: phinc <= { 12'd1430 }; // nota = 1, KF = 43
10'd108: phinc <= { 12'd1431 }; // nota = 1, KF = 44
10'd109: phinc <= { 12'd1432 }; // nota = 1, KF = 45
10'd110: phinc <= { 12'd1434 }; // nota = 1, KF = 46
10'd111: phinc <= { 12'd1435 }; // nota = 1, KF = 47
10'd112: phinc <= { 12'd1437 }; // nota = 1, KF = 48
10'd113: phinc <= { 12'd1438 }; // nota = 1, KF = 49
10'd114: phinc <= { 12'd1439 }; // nota = 1, KF = 50
10'd115: phinc <= { 12'd1440 }; // nota = 1, KF = 51
10'd116: phinc <= { 12'd1442 }; // nota = 1, KF = 52
10'd117: phinc <= { 12'd1443 }; // nota = 1, KF = 53
10'd118: phinc <= { 12'd1444 }; // nota = 1, KF = 54
10'd119: phinc <= { 12'd1445 }; // nota = 1, KF = 55
10'd120: phinc <= { 12'd1447 }; // nota = 1, KF = 56
10'd121: phinc <= { 12'd1448 }; // nota = 1, KF = 57
10'd122: phinc <= { 12'd1449 }; // nota = 1, KF = 58
10'd123: phinc <= { 12'd1450 }; // nota = 1, KF = 59
10'd124: phinc <= { 12'd1452 }; // nota = 1, KF = 60
10'd125: phinc <= { 12'd1453 }; // nota = 1, KF = 61
10'd126: phinc <= { 12'd1454 }; // nota = 1, KF = 62
10'd127: phinc <= { 12'd1455 }; // nota = 1, KF = 63
10'd128: phinc <= { 12'd1458 }; // nota = 2, KF = 0
10'd129: phinc <= { 12'd1459 }; // nota = 2, KF = 1
10'd130: phinc <= { 12'd1460 }; // nota = 2, KF = 2
10'd131: phinc <= { 12'd1461 }; // nota = 2, KF = 3
10'd132: phinc <= { 12'd1463 }; // nota = 2, KF = 4
10'd133: phinc <= { 12'd1464 }; // nota = 2, KF = 5
10'd134: phinc <= { 12'd1465 }; // nota = 2, KF = 6
10'd135: phinc <= { 12'd1466 }; // nota = 2, KF = 7
10'd136: phinc <= { 12'd1468 }; // nota = 2, KF = 8
10'd137: phinc <= { 12'd1469 }; // nota = 2, KF = 9
10'd138: phinc <= { 12'd1471 }; // nota = 2, KF = 10
10'd139: phinc <= { 12'd1472 }; // nota = 2, KF = 11
10'd140: phinc <= { 12'd1473 }; // nota = 2, KF = 12
10'd141: phinc <= { 12'd1474 }; // nota = 2, KF = 13
10'd142: phinc <= { 12'd1476 }; // nota = 2, KF = 14
10'd143: phinc <= { 12'd1477 }; // nota = 2, KF = 15
10'd144: phinc <= { 12'd1479 }; // nota = 2, KF = 16
10'd145: phinc <= { 12'd1480 }; // nota = 2, KF = 17
10'd146: phinc <= { 12'd1481 }; // nota = 2, KF = 18
10'd147: phinc <= { 12'd1482 }; // nota = 2, KF = 19
10'd148: phinc <= { 12'd1484 }; // nota = 2, KF = 20
10'd149: phinc <= { 12'd1485 }; // nota = 2, KF = 21
10'd150: phinc <= { 12'd1486 }; // nota = 2, KF = 22
10'd151: phinc <= { 12'd1487 }; // nota = 2, KF = 23
10'd152: phinc <= { 12'd1489 }; // nota = 2, KF = 24
10'd153: phinc <= { 12'd1490 }; // nota = 2, KF = 25
10'd154: phinc <= { 12'd1492 }; // nota = 2, KF = 26
10'd155: phinc <= { 12'd1493 }; // nota = 2, KF = 27
10'd156: phinc <= { 12'd1494 }; // nota = 2, KF = 28
10'd157: phinc <= { 12'd1495 }; // nota = 2, KF = 29
10'd158: phinc <= { 12'd1497 }; // nota = 2, KF = 30
10'd159: phinc <= { 12'd1498 }; // nota = 2, KF = 31
10'd160: phinc <= { 12'd1501 }; // nota = 2, KF = 32
10'd161: phinc <= { 12'd1502 }; // nota = 2, KF = 33
10'd162: phinc <= { 12'd1503 }; // nota = 2, KF = 34
10'd163: phinc <= { 12'd1504 }; // nota = 2, KF = 35
10'd164: phinc <= { 12'd1506 }; // nota = 2, KF = 36
10'd165: phinc <= { 12'd1507 }; // nota = 2, KF = 37
10'd166: phinc <= { 12'd1509 }; // nota = 2, KF = 38
10'd167: phinc <= { 12'd1510 }; // nota = 2, KF = 39
10'd168: phinc <= { 12'd1512 }; // nota = 2, KF = 40
10'd169: phinc <= { 12'd1513 }; // nota = 2, KF = 41
10'd170: phinc <= { 12'd1514 }; // nota = 2, KF = 42
10'd171: phinc <= { 12'd1515 }; // nota = 2, KF = 43
10'd172: phinc <= { 12'd1517 }; // nota = 2, KF = 44
10'd173: phinc <= { 12'd1518 }; // nota = 2, KF = 45
10'd174: phinc <= { 12'd1520 }; // nota = 2, KF = 46
10'd175: phinc <= { 12'd1521 }; // nota = 2, KF = 47
10'd176: phinc <= { 12'd1523 }; // nota = 2, KF = 48
10'd177: phinc <= { 12'd1524 }; // nota = 2, KF = 49
10'd178: phinc <= { 12'd1525 }; // nota = 2, KF = 50
10'd179: phinc <= { 12'd1526 }; // nota = 2, KF = 51
10'd180: phinc <= { 12'd1528 }; // nota = 2, KF = 52
10'd181: phinc <= { 12'd1529 }; // nota = 2, KF = 53
10'd182: phinc <= { 12'd1531 }; // nota = 2, KF = 54
10'd183: phinc <= { 12'd1532 }; // nota = 2, KF = 55
10'd184: phinc <= { 12'd1534 }; // nota = 2, KF = 56
10'd185: phinc <= { 12'd1535 }; // nota = 2, KF = 57
10'd186: phinc <= { 12'd1536 }; // nota = 2, KF = 58
10'd187: phinc <= { 12'd1537 }; // nota = 2, KF = 59
10'd188: phinc <= { 12'd1539 }; // nota = 2, KF = 60
10'd189: phinc <= { 12'd1540 }; // nota = 2, KF = 61
10'd190: phinc <= { 12'd1542 }; // nota = 2, KF = 62
10'd191: phinc <= { 12'd1543 }; // nota = 2, KF = 63
10'd192: phinc <= { 12'd1458 }; // nota = 3, KF = 0
10'd193: phinc <= { 12'd1459 }; // nota = 3, KF = 1
10'd194: phinc <= { 12'd1460 }; // nota = 3, KF = 2
10'd195: phinc <= { 12'd1461 }; // nota = 3, KF = 3
10'd196: phinc <= { 12'd1463 }; // nota = 3, KF = 4
10'd197: phinc <= { 12'd1464 }; // nota = 3, KF = 5
10'd198: phinc <= { 12'd1465 }; // nota = 3, KF = 6
10'd199: phinc <= { 12'd1466 }; // nota = 3, KF = 7
10'd200: phinc <= { 12'd1468 }; // nota = 3, KF = 8
10'd201: phinc <= { 12'd1469 }; // nota = 3, KF = 9
10'd202: phinc <= { 12'd1471 }; // nota = 3, KF = 10
10'd203: phinc <= { 12'd1472 }; // nota = 3, KF = 11
10'd204: phinc <= { 12'd1473 }; // nota = 3, KF = 12
10'd205: phinc <= { 12'd1474 }; // nota = 3, KF = 13
10'd206: phinc <= { 12'd1476 }; // nota = 3, KF = 14
10'd207: phinc <= { 12'd1477 }; // nota = 3, KF = 15
10'd208: phinc <= { 12'd1479 }; // nota = 3, KF = 16
10'd209: phinc <= { 12'd1480 }; // nota = 3, KF = 17
10'd210: phinc <= { 12'd1481 }; // nota = 3, KF = 18
10'd211: phinc <= { 12'd1482 }; // nota = 3, KF = 19
10'd212: phinc <= { 12'd1484 }; // nota = 3, KF = 20
10'd213: phinc <= { 12'd1485 }; // nota = 3, KF = 21
10'd214: phinc <= { 12'd1486 }; // nota = 3, KF = 22
10'd215: phinc <= { 12'd1487 }; // nota = 3, KF = 23
10'd216: phinc <= { 12'd1489 }; // nota = 3, KF = 24
10'd217: phinc <= { 12'd1490 }; // nota = 3, KF = 25
10'd218: phinc <= { 12'd1492 }; // nota = 3, KF = 26
10'd219: phinc <= { 12'd1493 }; // nota = 3, KF = 27
10'd220: phinc <= { 12'd1494 }; // nota = 3, KF = 28
10'd221: phinc <= { 12'd1495 }; // nota = 3, KF = 29
10'd222: phinc <= { 12'd1497 }; // nota = 3, KF = 30
10'd223: phinc <= { 12'd1498 }; // nota = 3, KF = 31
10'd224: phinc <= { 12'd1501 }; // nota = 3, KF = 32
10'd225: phinc <= { 12'd1502 }; // nota = 3, KF = 33
10'd226: phinc <= { 12'd1503 }; // nota = 3, KF = 34
10'd227: phinc <= { 12'd1504 }; // nota = 3, KF = 35
10'd228: phinc <= { 12'd1506 }; // nota = 3, KF = 36
10'd229: phinc <= { 12'd1507 }; // nota = 3, KF = 37
10'd230: phinc <= { 12'd1509 }; // nota = 3, KF = 38
10'd231: phinc <= { 12'd1510 }; // nota = 3, KF = 39
10'd232: phinc <= { 12'd1512 }; // nota = 3, KF = 40
10'd233: phinc <= { 12'd1513 }; // nota = 3, KF = 41
10'd234: phinc <= { 12'd1514 }; // nota = 3, KF = 42
10'd235: phinc <= { 12'd1515 }; // nota = 3, KF = 43
10'd236: phinc <= { 12'd1517 }; // nota = 3, KF = 44
10'd237: phinc <= { 12'd1518 }; // nota = 3, KF = 45
10'd238: phinc <= { 12'd1520 }; // nota = 3, KF = 46
10'd239: phinc <= { 12'd1521 }; // nota = 3, KF = 47
10'd240: phinc <= { 12'd1523 }; // nota = 3, KF = 48
10'd241: phinc <= { 12'd1524 }; // nota = 3, KF = 49
10'd242: phinc <= { 12'd1525 }; // nota = 3, KF = 50
10'd243: phinc <= { 12'd1526 }; // nota = 3, KF = 51
10'd244: phinc <= { 12'd1528 }; // nota = 3, KF = 52
10'd245: phinc <= { 12'd1529 }; // nota = 3, KF = 53
10'd246: phinc <= { 12'd1531 }; // nota = 3, KF = 54
10'd247: phinc <= { 12'd1532 }; // nota = 3, KF = 55
10'd248: phinc <= { 12'd1534 }; // nota = 3, KF = 56
10'd249: phinc <= { 12'd1535 }; // nota = 3, KF = 57
10'd250: phinc <= { 12'd1536 }; // nota = 3, KF = 58
10'd251: phinc <= { 12'd1537 }; // nota = 3, KF = 59
10'd252: phinc <= { 12'd1539 }; // nota = 3, KF = 60
10'd253: phinc <= { 12'd1540 }; // nota = 3, KF = 61
10'd254: phinc <= { 12'd1542 }; // nota = 3, KF = 62
10'd255: phinc <= { 12'd1543 }; // nota = 3, KF = 63
10'd256: phinc <= { 12'd1545 }; // nota = 4, KF = 0
10'd257: phinc <= { 12'd1546 }; // nota = 4, KF = 1
10'd258: phinc <= { 12'd1547 }; // nota = 4, KF = 2
10'd259: phinc <= { 12'd1548 }; // nota = 4, KF = 3
10'd260: phinc <= { 12'd1550 }; // nota = 4, KF = 4
10'd261: phinc <= { 12'd1551 }; // nota = 4, KF = 5
10'd262: phinc <= { 12'd1553 }; // nota = 4, KF = 6
10'd263: phinc <= { 12'd1554 }; // nota = 4, KF = 7
10'd264: phinc <= { 12'd1556 }; // nota = 4, KF = 8
10'd265: phinc <= { 12'd1557 }; // nota = 4, KF = 9
10'd266: phinc <= { 12'd1558 }; // nota = 4, KF = 10
10'd267: phinc <= { 12'd1559 }; // nota = 4, KF = 11
10'd268: phinc <= { 12'd1561 }; // nota = 4, KF = 12
10'd269: phinc <= { 12'd1562 }; // nota = 4, KF = 13
10'd270: phinc <= { 12'd1564 }; // nota = 4, KF = 14
10'd271: phinc <= { 12'd1565 }; // nota = 4, KF = 15
10'd272: phinc <= { 12'd1567 }; // nota = 4, KF = 16
10'd273: phinc <= { 12'd1568 }; // nota = 4, KF = 17
10'd274: phinc <= { 12'd1569 }; // nota = 4, KF = 18
10'd275: phinc <= { 12'd1570 }; // nota = 4, KF = 19
10'd276: phinc <= { 12'd1572 }; // nota = 4, KF = 20
10'd277: phinc <= { 12'd1573 }; // nota = 4, KF = 21
10'd278: phinc <= { 12'd1575 }; // nota = 4, KF = 22
10'd279: phinc <= { 12'd1576 }; // nota = 4, KF = 23
10'd280: phinc <= { 12'd1578 }; // nota = 4, KF = 24
10'd281: phinc <= { 12'd1579 }; // nota = 4, KF = 25
10'd282: phinc <= { 12'd1580 }; // nota = 4, KF = 26
10'd283: phinc <= { 12'd1581 }; // nota = 4, KF = 27
10'd284: phinc <= { 12'd1583 }; // nota = 4, KF = 28
10'd285: phinc <= { 12'd1584 }; // nota = 4, KF = 29
10'd286: phinc <= { 12'd1586 }; // nota = 4, KF = 30
10'd287: phinc <= { 12'd1587 }; // nota = 4, KF = 31
10'd288: phinc <= { 12'd1590 }; // nota = 4, KF = 32
10'd289: phinc <= { 12'd1591 }; // nota = 4, KF = 33
10'd290: phinc <= { 12'd1592 }; // nota = 4, KF = 34
10'd291: phinc <= { 12'd1593 }; // nota = 4, KF = 35
10'd292: phinc <= { 12'd1595 }; // nota = 4, KF = 36
10'd293: phinc <= { 12'd1596 }; // nota = 4, KF = 37
10'd294: phinc <= { 12'd1598 }; // nota = 4, KF = 38
10'd295: phinc <= { 12'd1599 }; // nota = 4, KF = 39
10'd296: phinc <= { 12'd1601 }; // nota = 4, KF = 40
10'd297: phinc <= { 12'd1602 }; // nota = 4, KF = 41
10'd298: phinc <= { 12'd1604 }; // nota = 4, KF = 42
10'd299: phinc <= { 12'd1605 }; // nota = 4, KF = 43
10'd300: phinc <= { 12'd1607 }; // nota = 4, KF = 44
10'd301: phinc <= { 12'd1608 }; // nota = 4, KF = 45
10'd302: phinc <= { 12'd1609 }; // nota = 4, KF = 46
10'd303: phinc <= { 12'd1610 }; // nota = 4, KF = 47
10'd304: phinc <= { 12'd1613 }; // nota = 4, KF = 48
10'd305: phinc <= { 12'd1614 }; // nota = 4, KF = 49
10'd306: phinc <= { 12'd1615 }; // nota = 4, KF = 50
10'd307: phinc <= { 12'd1616 }; // nota = 4, KF = 51
10'd308: phinc <= { 12'd1618 }; // nota = 4, KF = 52
10'd309: phinc <= { 12'd1619 }; // nota = 4, KF = 53
10'd310: phinc <= { 12'd1621 }; // nota = 4, KF = 54
10'd311: phinc <= { 12'd1622 }; // nota = 4, KF = 55
10'd312: phinc <= { 12'd1624 }; // nota = 4, KF = 56
10'd313: phinc <= { 12'd1625 }; // nota = 4, KF = 57
10'd314: phinc <= { 12'd1627 }; // nota = 4, KF = 58
10'd315: phinc <= { 12'd1628 }; // nota = 4, KF = 59
10'd316: phinc <= { 12'd1630 }; // nota = 4, KF = 60
10'd317: phinc <= { 12'd1631 }; // nota = 4, KF = 61
10'd318: phinc <= { 12'd1632 }; // nota = 4, KF = 62
10'd319: phinc <= { 12'd1633 }; // nota = 4, KF = 63
10'd320: phinc <= { 12'd1637 }; // nota = 5, KF = 0
10'd321: phinc <= { 12'd1638 }; // nota = 5, KF = 1
10'd322: phinc <= { 12'd1639 }; // nota = 5, KF = 2
10'd323: phinc <= { 12'd1640 }; // nota = 5, KF = 3
10'd324: phinc <= { 12'd1642 }; // nota = 5, KF = 4
10'd325: phinc <= { 12'd1643 }; // nota = 5, KF = 5
10'd326: phinc <= { 12'd1645 }; // nota = 5, KF = 6
10'd327: phinc <= { 12'd1646 }; // nota = 5, KF = 7
10'd328: phinc <= { 12'd1648 }; // nota = 5, KF = 8
10'd329: phinc <= { 12'd1649 }; // nota = 5, KF = 9
10'd330: phinc <= { 12'd1651 }; // nota = 5, KF = 10
10'd331: phinc <= { 12'd1652 }; // nota = 5, KF = 11
10'd332: phinc <= { 12'd1654 }; // nota = 5, KF = 12
10'd333: phinc <= { 12'd1655 }; // nota = 5, KF = 13
10'd334: phinc <= { 12'd1656 }; // nota = 5, KF = 14
10'd335: phinc <= { 12'd1657 }; // nota = 5, KF = 15
10'd336: phinc <= { 12'd1660 }; // nota = 5, KF = 16
10'd337: phinc <= { 12'd1661 }; // nota = 5, KF = 17
10'd338: phinc <= { 12'd1663 }; // nota = 5, KF = 18
10'd339: phinc <= { 12'd1664 }; // nota = 5, KF = 19
10'd340: phinc <= { 12'd1666 }; // nota = 5, KF = 20
10'd341: phinc <= { 12'd1667 }; // nota = 5, KF = 21
10'd342: phinc <= { 12'd1669 }; // nota = 5, KF = 22
10'd343: phinc <= { 12'd1670 }; // nota = 5, KF = 23
10'd344: phinc <= { 12'd1672 }; // nota = 5, KF = 24
10'd345: phinc <= { 12'd1673 }; // nota = 5, KF = 25
10'd346: phinc <= { 12'd1675 }; // nota = 5, KF = 26
10'd347: phinc <= { 12'd1676 }; // nota = 5, KF = 27
10'd348: phinc <= { 12'd1678 }; // nota = 5, KF = 28
10'd349: phinc <= { 12'd1679 }; // nota = 5, KF = 29
10'd350: phinc <= { 12'd1681 }; // nota = 5, KF = 30
10'd351: phinc <= { 12'd1682 }; // nota = 5, KF = 31
10'd352: phinc <= { 12'd1685 }; // nota = 5, KF = 32
10'd353: phinc <= { 12'd1686 }; // nota = 5, KF = 33
10'd354: phinc <= { 12'd1688 }; // nota = 5, KF = 34
10'd355: phinc <= { 12'd1689 }; // nota = 5, KF = 35
10'd356: phinc <= { 12'd1691 }; // nota = 5, KF = 36
10'd357: phinc <= { 12'd1692 }; // nota = 5, KF = 37
10'd358: phinc <= { 12'd1694 }; // nota = 5, KF = 38
10'd359: phinc <= { 12'd1695 }; // nota = 5, KF = 39
10'd360: phinc <= { 12'd1697 }; // nota = 5, KF = 40
10'd361: phinc <= { 12'd1698 }; // nota = 5, KF = 41
10'd362: phinc <= { 12'd1700 }; // nota = 5, KF = 42
10'd363: phinc <= { 12'd1701 }; // nota = 5, KF = 43
10'd364: phinc <= { 12'd1703 }; // nota = 5, KF = 44
10'd365: phinc <= { 12'd1704 }; // nota = 5, KF = 45
10'd366: phinc <= { 12'd1706 }; // nota = 5, KF = 46
10'd367: phinc <= { 12'd1707 }; // nota = 5, KF = 47
10'd368: phinc <= { 12'd1709 }; // nota = 5, KF = 48
10'd369: phinc <= { 12'd1710 }; // nota = 5, KF = 49
10'd370: phinc <= { 12'd1712 }; // nota = 5, KF = 50
10'd371: phinc <= { 12'd1713 }; // nota = 5, KF = 51
10'd372: phinc <= { 12'd1715 }; // nota = 5, KF = 52
10'd373: phinc <= { 12'd1716 }; // nota = 5, KF = 53
10'd374: phinc <= { 12'd1718 }; // nota = 5, KF = 54
10'd375: phinc <= { 12'd1719 }; // nota = 5, KF = 55
10'd376: phinc <= { 12'd1721 }; // nota = 5, KF = 56
10'd377: phinc <= { 12'd1722 }; // nota = 5, KF = 57
10'd378: phinc <= { 12'd1724 }; // nota = 5, KF = 58
10'd379: phinc <= { 12'd1725 }; // nota = 5, KF = 59
10'd380: phinc <= { 12'd1727 }; // nota = 5, KF = 60
10'd381: phinc <= { 12'd1728 }; // nota = 5, KF = 61
10'd382: phinc <= { 12'd1730 }; // nota = 5, KF = 62
10'd383: phinc <= { 12'd1731 }; // nota = 5, KF = 63
10'd384: phinc <= { 12'd1734 }; // nota = 6, KF = 0
10'd385: phinc <= { 12'd1735 }; // nota = 6, KF = 1
10'd386: phinc <= { 12'd1737 }; // nota = 6, KF = 2
10'd387: phinc <= { 12'd1738 }; // nota = 6, KF = 3
10'd388: phinc <= { 12'd1740 }; // nota = 6, KF = 4
10'd389: phinc <= { 12'd1741 }; // nota = 6, KF = 5
10'd390: phinc <= { 12'd1743 }; // nota = 6, KF = 6
10'd391: phinc <= { 12'd1744 }; // nota = 6, KF = 7
10'd392: phinc <= { 12'd1746 }; // nota = 6, KF = 8
10'd393: phinc <= { 12'd1748 }; // nota = 6, KF = 9
10'd394: phinc <= { 12'd1749 }; // nota = 6, KF = 10
10'd395: phinc <= { 12'd1751 }; // nota = 6, KF = 11
10'd396: phinc <= { 12'd1752 }; // nota = 6, KF = 12
10'd397: phinc <= { 12'd1754 }; // nota = 6, KF = 13
10'd398: phinc <= { 12'd1755 }; // nota = 6, KF = 14
10'd399: phinc <= { 12'd1757 }; // nota = 6, KF = 15
10'd400: phinc <= { 12'd1759 }; // nota = 6, KF = 16
10'd401: phinc <= { 12'd1760 }; // nota = 6, KF = 17
10'd402: phinc <= { 12'd1762 }; // nota = 6, KF = 18
10'd403: phinc <= { 12'd1763 }; // nota = 6, KF = 19
10'd404: phinc <= { 12'd1765 }; // nota = 6, KF = 20
10'd405: phinc <= { 12'd1766 }; // nota = 6, KF = 21
10'd406: phinc <= { 12'd1768 }; // nota = 6, KF = 22
10'd407: phinc <= { 12'd1769 }; // nota = 6, KF = 23
10'd408: phinc <= { 12'd1771 }; // nota = 6, KF = 24
10'd409: phinc <= { 12'd1773 }; // nota = 6, KF = 25
10'd410: phinc <= { 12'd1774 }; // nota = 6, KF = 26
10'd411: phinc <= { 12'd1776 }; // nota = 6, KF = 27
10'd412: phinc <= { 12'd1777 }; // nota = 6, KF = 28
10'd413: phinc <= { 12'd1779 }; // nota = 6, KF = 29
10'd414: phinc <= { 12'd1780 }; // nota = 6, KF = 30
10'd415: phinc <= { 12'd1782 }; // nota = 6, KF = 31
10'd416: phinc <= { 12'd1785 }; // nota = 6, KF = 32
10'd417: phinc <= { 12'd1786 }; // nota = 6, KF = 33
10'd418: phinc <= { 12'd1788 }; // nota = 6, KF = 34
10'd419: phinc <= { 12'd1789 }; // nota = 6, KF = 35
10'd420: phinc <= { 12'd1791 }; // nota = 6, KF = 36
10'd421: phinc <= { 12'd1793 }; // nota = 6, KF = 37
10'd422: phinc <= { 12'd1794 }; // nota = 6, KF = 38
10'd423: phinc <= { 12'd1796 }; // nota = 6, KF = 39
10'd424: phinc <= { 12'd1798 }; // nota = 6, KF = 40
10'd425: phinc <= { 12'd1799 }; // nota = 6, KF = 41
10'd426: phinc <= { 12'd1801 }; // nota = 6, KF = 42
10'd427: phinc <= { 12'd1802 }; // nota = 6, KF = 43
10'd428: phinc <= { 12'd1804 }; // nota = 6, KF = 44
10'd429: phinc <= { 12'd1806 }; // nota = 6, KF = 45
10'd430: phinc <= { 12'd1807 }; // nota = 6, KF = 46
10'd431: phinc <= { 12'd1809 }; // nota = 6, KF = 47
10'd432: phinc <= { 12'd1811 }; // nota = 6, KF = 48
10'd433: phinc <= { 12'd1812 }; // nota = 6, KF = 49
10'd434: phinc <= { 12'd1814 }; // nota = 6, KF = 50
10'd435: phinc <= { 12'd1815 }; // nota = 6, KF = 51
10'd436: phinc <= { 12'd1817 }; // nota = 6, KF = 52
10'd437: phinc <= { 12'd1819 }; // nota = 6, KF = 53
10'd438: phinc <= { 12'd1820 }; // nota = 6, KF = 54
10'd439: phinc <= { 12'd1822 }; // nota = 6, KF = 55
10'd440: phinc <= { 12'd1824 }; // nota = 6, KF = 56
10'd441: phinc <= { 12'd1825 }; // nota = 6, KF = 57
10'd442: phinc <= { 12'd1827 }; // nota = 6, KF = 58
10'd443: phinc <= { 12'd1828 }; // nota = 6, KF = 59
10'd444: phinc <= { 12'd1830 }; // nota = 6, KF = 60
10'd445: phinc <= { 12'd1832 }; // nota = 6, KF = 61
10'd446: phinc <= { 12'd1833 }; // nota = 6, KF = 62
10'd447: phinc <= { 12'd1835 }; // nota = 6, KF = 63
10'd448: phinc <= { 12'd1734 }; // nota = 7, KF = 0
10'd449: phinc <= { 12'd1735 }; // nota = 7, KF = 1
10'd450: phinc <= { 12'd1737 }; // nota = 7, KF = 2
10'd451: phinc <= { 12'd1738 }; // nota = 7, KF = 3
10'd452: phinc <= { 12'd1740 }; // nota = 7, KF = 4
10'd453: phinc <= { 12'd1741 }; // nota = 7, KF = 5
10'd454: phinc <= { 12'd1743 }; // nota = 7, KF = 6
10'd455: phinc <= { 12'd1744 }; // nota = 7, KF = 7
10'd456: phinc <= { 12'd1746 }; // nota = 7, KF = 8
10'd457: phinc <= { 12'd1748 }; // nota = 7, KF = 9
10'd458: phinc <= { 12'd1749 }; // nota = 7, KF = 10
10'd459: phinc <= { 12'd1751 }; // nota = 7, KF = 11
10'd460: phinc <= { 12'd1752 }; // nota = 7, KF = 12
10'd461: phinc <= { 12'd1754 }; // nota = 7, KF = 13
10'd462: phinc <= { 12'd1755 }; // nota = 7, KF = 14
10'd463: phinc <= { 12'd1757 }; // nota = 7, KF = 15
10'd464: phinc <= { 12'd1759 }; // nota = 7, KF = 16
10'd465: phinc <= { 12'd1760 }; // nota = 7, KF = 17
10'd466: phinc <= { 12'd1762 }; // nota = 7, KF = 18
10'd467: phinc <= { 12'd1763 }; // nota = 7, KF = 19
10'd468: phinc <= { 12'd1765 }; // nota = 7, KF = 20
10'd469: phinc <= { 12'd1766 }; // nota = 7, KF = 21
10'd470: phinc <= { 12'd1768 }; // nota = 7, KF = 22
10'd471: phinc <= { 12'd1769 }; // nota = 7, KF = 23
10'd472: phinc <= { 12'd1771 }; // nota = 7, KF = 24
10'd473: phinc <= { 12'd1773 }; // nota = 7, KF = 25
10'd474: phinc <= { 12'd1774 }; // nota = 7, KF = 26
10'd475: phinc <= { 12'd1776 }; // nota = 7, KF = 27
10'd476: phinc <= { 12'd1777 }; // nota = 7, KF = 28
10'd477: phinc <= { 12'd1779 }; // nota = 7, KF = 29
10'd478: phinc <= { 12'd1780 }; // nota = 7, KF = 30
10'd479: phinc <= { 12'd1782 }; // nota = 7, KF = 31
10'd480: phinc <= { 12'd1785 }; // nota = 7, KF = 32
10'd481: phinc <= { 12'd1786 }; // nota = 7, KF = 33
10'd482: phinc <= { 12'd1788 }; // nota = 7, KF = 34
10'd483: phinc <= { 12'd1789 }; // nota = 7, KF = 35
10'd484: phinc <= { 12'd1791 }; // nota = 7, KF = 36
10'd485: phinc <= { 12'd1793 }; // nota = 7, KF = 37
10'd486: phinc <= { 12'd1794 }; // nota = 7, KF = 38
10'd487: phinc <= { 12'd1796 }; // nota = 7, KF = 39
10'd488: phinc <= { 12'd1798 }; // nota = 7, KF = 40
10'd489: phinc <= { 12'd1799 }; // nota = 7, KF = 41
10'd490: phinc <= { 12'd1801 }; // nota = 7, KF = 42
10'd491: phinc <= { 12'd1802 }; // nota = 7, KF = 43
10'd492: phinc <= { 12'd1804 }; // nota = 7, KF = 44
10'd493: phinc <= { 12'd1806 }; // nota = 7, KF = 45
10'd494: phinc <= { 12'd1807 }; // nota = 7, KF = 46
10'd495: phinc <= { 12'd1809 }; // nota = 7, KF = 47
10'd496: phinc <= { 12'd1811 }; // nota = 7, KF = 48
10'd497: phinc <= { 12'd1812 }; // nota = 7, KF = 49
10'd498: phinc <= { 12'd1814 }; // nota = 7, KF = 50
10'd499: phinc <= { 12'd1815 }; // nota = 7, KF = 51
10'd500: phinc <= { 12'd1817 }; // nota = 7, KF = 52
10'd501: phinc <= { 12'd1819 }; // nota = 7, KF = 53
10'd502: phinc <= { 12'd1820 }; // nota = 7, KF = 54
10'd503: phinc <= { 12'd1822 }; // nota = 7, KF = 55
10'd504: phinc <= { 12'd1824 }; // nota = 7, KF = 56
10'd505: phinc <= { 12'd1825 }; // nota = 7, KF = 57
10'd506: phinc <= { 12'd1827 }; // nota = 7, KF = 58
10'd507: phinc <= { 12'd1828 }; // nota = 7, KF = 59
10'd508: phinc <= { 12'd1830 }; // nota = 7, KF = 60
10'd509: phinc <= { 12'd1832 }; // nota = 7, KF = 61
10'd510: phinc <= { 12'd1833 }; // nota = 7, KF = 62
10'd511: phinc <= { 12'd1835 }; // nota = 7, KF = 63
10'd512: phinc <= { 12'd1837 }; // nota = 8, KF = 0
10'd513: phinc <= { 12'd1838 }; // nota = 8, KF = 1
10'd514: phinc <= { 12'd1840 }; // nota = 8, KF = 2
10'd515: phinc <= { 12'd1841 }; // nota = 8, KF = 3
10'd516: phinc <= { 12'd1843 }; // nota = 8, KF = 4
10'd517: phinc <= { 12'd1845 }; // nota = 8, KF = 5
10'd518: phinc <= { 12'd1846 }; // nota = 8, KF = 6
10'd519: phinc <= { 12'd1848 }; // nota = 8, KF = 7
10'd520: phinc <= { 12'd1850 }; // nota = 8, KF = 8
10'd521: phinc <= { 12'd1851 }; // nota = 8, KF = 9
10'd522: phinc <= { 12'd1853 }; // nota = 8, KF = 10
10'd523: phinc <= { 12'd1854 }; // nota = 8, KF = 11
10'd524: phinc <= { 12'd1856 }; // nota = 8, KF = 12
10'd525: phinc <= { 12'd1858 }; // nota = 8, KF = 13
10'd526: phinc <= { 12'd1859 }; // nota = 8, KF = 14
10'd527: phinc <= { 12'd1861 }; // nota = 8, KF = 15
10'd528: phinc <= { 12'd1864 }; // nota = 8, KF = 16
10'd529: phinc <= { 12'd1865 }; // nota = 8, KF = 17
10'd530: phinc <= { 12'd1867 }; // nota = 8, KF = 18
10'd531: phinc <= { 12'd1868 }; // nota = 8, KF = 19
10'd532: phinc <= { 12'd1870 }; // nota = 8, KF = 20
10'd533: phinc <= { 12'd1872 }; // nota = 8, KF = 21
10'd534: phinc <= { 12'd1873 }; // nota = 8, KF = 22
10'd535: phinc <= { 12'd1875 }; // nota = 8, KF = 23
10'd536: phinc <= { 12'd1877 }; // nota = 8, KF = 24
10'd537: phinc <= { 12'd1879 }; // nota = 8, KF = 25
10'd538: phinc <= { 12'd1880 }; // nota = 8, KF = 26
10'd539: phinc <= { 12'd1882 }; // nota = 8, KF = 27
10'd540: phinc <= { 12'd1884 }; // nota = 8, KF = 28
10'd541: phinc <= { 12'd1885 }; // nota = 8, KF = 29
10'd542: phinc <= { 12'd1887 }; // nota = 8, KF = 30
10'd543: phinc <= { 12'd1888 }; // nota = 8, KF = 31
10'd544: phinc <= { 12'd1891 }; // nota = 8, KF = 32
10'd545: phinc <= { 12'd1892 }; // nota = 8, KF = 33
10'd546: phinc <= { 12'd1894 }; // nota = 8, KF = 34
10'd547: phinc <= { 12'd1895 }; // nota = 8, KF = 35
10'd548: phinc <= { 12'd1897 }; // nota = 8, KF = 36
10'd549: phinc <= { 12'd1899 }; // nota = 8, KF = 37
10'd550: phinc <= { 12'd1900 }; // nota = 8, KF = 38
10'd551: phinc <= { 12'd1902 }; // nota = 8, KF = 39
10'd552: phinc <= { 12'd1904 }; // nota = 8, KF = 40
10'd553: phinc <= { 12'd1906 }; // nota = 8, KF = 41
10'd554: phinc <= { 12'd1907 }; // nota = 8, KF = 42
10'd555: phinc <= { 12'd1909 }; // nota = 8, KF = 43
10'd556: phinc <= { 12'd1911 }; // nota = 8, KF = 44
10'd557: phinc <= { 12'd1912 }; // nota = 8, KF = 45
10'd558: phinc <= { 12'd1914 }; // nota = 8, KF = 46
10'd559: phinc <= { 12'd1915 }; // nota = 8, KF = 47
10'd560: phinc <= { 12'd1918 }; // nota = 8, KF = 48
10'd561: phinc <= { 12'd1919 }; // nota = 8, KF = 49
10'd562: phinc <= { 12'd1921 }; // nota = 8, KF = 50
10'd563: phinc <= { 12'd1923 }; // nota = 8, KF = 51
10'd564: phinc <= { 12'd1925 }; // nota = 8, KF = 52
10'd565: phinc <= { 12'd1926 }; // nota = 8, KF = 53
10'd566: phinc <= { 12'd1928 }; // nota = 8, KF = 54
10'd567: phinc <= { 12'd1930 }; // nota = 8, KF = 55
10'd568: phinc <= { 12'd1932 }; // nota = 8, KF = 56
10'd569: phinc <= { 12'd1933 }; // nota = 8, KF = 57
10'd570: phinc <= { 12'd1935 }; // nota = 8, KF = 58
10'd571: phinc <= { 12'd1937 }; // nota = 8, KF = 59
10'd572: phinc <= { 12'd1939 }; // nota = 8, KF = 60
10'd573: phinc <= { 12'd1940 }; // nota = 8, KF = 61
10'd574: phinc <= { 12'd1942 }; // nota = 8, KF = 62
10'd575: phinc <= { 12'd1944 }; // nota = 8, KF = 63
10'd576: phinc <= { 12'd1946 }; // nota = 9, KF = 0
10'd577: phinc <= { 12'd1947 }; // nota = 9, KF = 1
10'd578: phinc <= { 12'd1949 }; // nota = 9, KF = 2
10'd579: phinc <= { 12'd1951 }; // nota = 9, KF = 3
10'd580: phinc <= { 12'd1953 }; // nota = 9, KF = 4
10'd581: phinc <= { 12'd1954 }; // nota = 9, KF = 5
10'd582: phinc <= { 12'd1956 }; // nota = 9, KF = 6
10'd583: phinc <= { 12'd1958 }; // nota = 9, KF = 7
10'd584: phinc <= { 12'd1960 }; // nota = 9, KF = 8
10'd585: phinc <= { 12'd1961 }; // nota = 9, KF = 9
10'd586: phinc <= { 12'd1963 }; // nota = 9, KF = 10
10'd587: phinc <= { 12'd1965 }; // nota = 9, KF = 11
10'd588: phinc <= { 12'd1967 }; // nota = 9, KF = 12
10'd589: phinc <= { 12'd1968 }; // nota = 9, KF = 13
10'd590: phinc <= { 12'd1970 }; // nota = 9, KF = 14
10'd591: phinc <= { 12'd1972 }; // nota = 9, KF = 15
10'd592: phinc <= { 12'd1975 }; // nota = 9, KF = 16
10'd593: phinc <= { 12'd1976 }; // nota = 9, KF = 17
10'd594: phinc <= { 12'd1978 }; // nota = 9, KF = 18
10'd595: phinc <= { 12'd1980 }; // nota = 9, KF = 19
10'd596: phinc <= { 12'd1982 }; // nota = 9, KF = 20
10'd597: phinc <= { 12'd1983 }; // nota = 9, KF = 21
10'd598: phinc <= { 12'd1985 }; // nota = 9, KF = 22
10'd599: phinc <= { 12'd1987 }; // nota = 9, KF = 23
10'd600: phinc <= { 12'd1989 }; // nota = 9, KF = 24
10'd601: phinc <= { 12'd1990 }; // nota = 9, KF = 25
10'd602: phinc <= { 12'd1992 }; // nota = 9, KF = 26
10'd603: phinc <= { 12'd1994 }; // nota = 9, KF = 27
10'd604: phinc <= { 12'd1996 }; // nota = 9, KF = 28
10'd605: phinc <= { 12'd1997 }; // nota = 9, KF = 29
10'd606: phinc <= { 12'd1999 }; // nota = 9, KF = 30
10'd607: phinc <= { 12'd2001 }; // nota = 9, KF = 31
10'd608: phinc <= { 12'd2003 }; // nota = 9, KF = 32
10'd609: phinc <= { 12'd2004 }; // nota = 9, KF = 33
10'd610: phinc <= { 12'd2006 }; // nota = 9, KF = 34
10'd611: phinc <= { 12'd2008 }; // nota = 9, KF = 35
10'd612: phinc <= { 12'd2010 }; // nota = 9, KF = 36
10'd613: phinc <= { 12'd2011 }; // nota = 9, KF = 37
10'd614: phinc <= { 12'd2013 }; // nota = 9, KF = 38
10'd615: phinc <= { 12'd2015 }; // nota = 9, KF = 39
10'd616: phinc <= { 12'd2017 }; // nota = 9, KF = 40
10'd617: phinc <= { 12'd2019 }; // nota = 9, KF = 41
10'd618: phinc <= { 12'd2021 }; // nota = 9, KF = 42
10'd619: phinc <= { 12'd2022 }; // nota = 9, KF = 43
10'd620: phinc <= { 12'd2024 }; // nota = 9, KF = 44
10'd621: phinc <= { 12'd2026 }; // nota = 9, KF = 45
10'd622: phinc <= { 12'd2028 }; // nota = 9, KF = 46
10'd623: phinc <= { 12'd2029 }; // nota = 9, KF = 47
10'd624: phinc <= { 12'd2032 }; // nota = 9, KF = 48
10'd625: phinc <= { 12'd2033 }; // nota = 9, KF = 49
10'd626: phinc <= { 12'd2035 }; // nota = 9, KF = 50
10'd627: phinc <= { 12'd2037 }; // nota = 9, KF = 51
10'd628: phinc <= { 12'd2039 }; // nota = 9, KF = 52
10'd629: phinc <= { 12'd2041 }; // nota = 9, KF = 53
10'd630: phinc <= { 12'd2043 }; // nota = 9, KF = 54
10'd631: phinc <= { 12'd2044 }; // nota = 9, KF = 55
10'd632: phinc <= { 12'd2047 }; // nota = 9, KF = 56
10'd633: phinc <= { 12'd2048 }; // nota = 9, KF = 57
10'd634: phinc <= { 12'd2050 }; // nota = 9, KF = 58
10'd635: phinc <= { 12'd2052 }; // nota = 9, KF = 59
10'd636: phinc <= { 12'd2054 }; // nota = 9, KF = 60
10'd637: phinc <= { 12'd2056 }; // nota = 9, KF = 61
10'd638: phinc <= { 12'd2058 }; // nota = 9, KF = 62
10'd639: phinc <= { 12'd2059 }; // nota = 9, KF = 63
10'd640: phinc <= { 12'd2062 }; // nota = 10, KF = 0
10'd641: phinc <= { 12'd2063 }; // nota = 10, KF = 1
10'd642: phinc <= { 12'd2065 }; // nota = 10, KF = 2
10'd643: phinc <= { 12'd2067 }; // nota = 10, KF = 3
10'd644: phinc <= { 12'd2069 }; // nota = 10, KF = 4
10'd645: phinc <= { 12'd2071 }; // nota = 10, KF = 5
10'd646: phinc <= { 12'd2073 }; // nota = 10, KF = 6
10'd647: phinc <= { 12'd2074 }; // nota = 10, KF = 7
10'd648: phinc <= { 12'd2077 }; // nota = 10, KF = 8
10'd649: phinc <= { 12'd2078 }; // nota = 10, KF = 9
10'd650: phinc <= { 12'd2080 }; // nota = 10, KF = 10
10'd651: phinc <= { 12'd2082 }; // nota = 10, KF = 11
10'd652: phinc <= { 12'd2084 }; // nota = 10, KF = 12
10'd653: phinc <= { 12'd2086 }; // nota = 10, KF = 13
10'd654: phinc <= { 12'd2088 }; // nota = 10, KF = 14
10'd655: phinc <= { 12'd2089 }; // nota = 10, KF = 15
10'd656: phinc <= { 12'd2092 }; // nota = 10, KF = 16
10'd657: phinc <= { 12'd2093 }; // nota = 10, KF = 17
10'd658: phinc <= { 12'd2095 }; // nota = 10, KF = 18
10'd659: phinc <= { 12'd2097 }; // nota = 10, KF = 19
10'd660: phinc <= { 12'd2099 }; // nota = 10, KF = 20
10'd661: phinc <= { 12'd2101 }; // nota = 10, KF = 21
10'd662: phinc <= { 12'd2103 }; // nota = 10, KF = 22
10'd663: phinc <= { 12'd2104 }; // nota = 10, KF = 23
10'd664: phinc <= { 12'd2107 }; // nota = 10, KF = 24
10'd665: phinc <= { 12'd2108 }; // nota = 10, KF = 25
10'd666: phinc <= { 12'd2110 }; // nota = 10, KF = 26
10'd667: phinc <= { 12'd2112 }; // nota = 10, KF = 27
10'd668: phinc <= { 12'd2114 }; // nota = 10, KF = 28
10'd669: phinc <= { 12'd2116 }; // nota = 10, KF = 29
10'd670: phinc <= { 12'd2118 }; // nota = 10, KF = 30
10'd671: phinc <= { 12'd2119 }; // nota = 10, KF = 31
10'd672: phinc <= { 12'd2122 }; // nota = 10, KF = 32
10'd673: phinc <= { 12'd2123 }; // nota = 10, KF = 33
10'd674: phinc <= { 12'd2125 }; // nota = 10, KF = 34
10'd675: phinc <= { 12'd2127 }; // nota = 10, KF = 35
10'd676: phinc <= { 12'd2129 }; // nota = 10, KF = 36
10'd677: phinc <= { 12'd2131 }; // nota = 10, KF = 37
10'd678: phinc <= { 12'd2133 }; // nota = 10, KF = 38
10'd679: phinc <= { 12'd2134 }; // nota = 10, KF = 39
10'd680: phinc <= { 12'd2137 }; // nota = 10, KF = 40
10'd681: phinc <= { 12'd2139 }; // nota = 10, KF = 41
10'd682: phinc <= { 12'd2141 }; // nota = 10, KF = 42
10'd683: phinc <= { 12'd2142 }; // nota = 10, KF = 43
10'd684: phinc <= { 12'd2145 }; // nota = 10, KF = 44
10'd685: phinc <= { 12'd2146 }; // nota = 10, KF = 45
10'd686: phinc <= { 12'd2148 }; // nota = 10, KF = 46
10'd687: phinc <= { 12'd2150 }; // nota = 10, KF = 47
10'd688: phinc <= { 12'd2153 }; // nota = 10, KF = 48
10'd689: phinc <= { 12'd2154 }; // nota = 10, KF = 49
10'd690: phinc <= { 12'd2156 }; // nota = 10, KF = 50
10'd691: phinc <= { 12'd2158 }; // nota = 10, KF = 51
10'd692: phinc <= { 12'd2160 }; // nota = 10, KF = 52
10'd693: phinc <= { 12'd2162 }; // nota = 10, KF = 53
10'd694: phinc <= { 12'd2164 }; // nota = 10, KF = 54
10'd695: phinc <= { 12'd2165 }; // nota = 10, KF = 55
10'd696: phinc <= { 12'd2168 }; // nota = 10, KF = 56
10'd697: phinc <= { 12'd2170 }; // nota = 10, KF = 57
10'd698: phinc <= { 12'd2172 }; // nota = 10, KF = 58
10'd699: phinc <= { 12'd2173 }; // nota = 10, KF = 59
10'd700: phinc <= { 12'd2176 }; // nota = 10, KF = 60
10'd701: phinc <= { 12'd2177 }; // nota = 10, KF = 61
10'd702: phinc <= { 12'd2179 }; // nota = 10, KF = 62
10'd703: phinc <= { 12'd2181 }; // nota = 10, KF = 63
10'd704: phinc <= { 12'd2062 }; // nota = 11, KF = 0
10'd705: phinc <= { 12'd2063 }; // nota = 11, KF = 1
10'd706: phinc <= { 12'd2065 }; // nota = 11, KF = 2
10'd707: phinc <= { 12'd2067 }; // nota = 11, KF = 3
10'd708: phinc <= { 12'd2069 }; // nota = 11, KF = 4
10'd709: phinc <= { 12'd2071 }; // nota = 11, KF = 5
10'd710: phinc <= { 12'd2073 }; // nota = 11, KF = 6
10'd711: phinc <= { 12'd2074 }; // nota = 11, KF = 7
10'd712: phinc <= { 12'd2077 }; // nota = 11, KF = 8
10'd713: phinc <= { 12'd2078 }; // nota = 11, KF = 9
10'd714: phinc <= { 12'd2080 }; // nota = 11, KF = 10
10'd715: phinc <= { 12'd2082 }; // nota = 11, KF = 11
10'd716: phinc <= { 12'd2084 }; // nota = 11, KF = 12
10'd717: phinc <= { 12'd2086 }; // nota = 11, KF = 13
10'd718: phinc <= { 12'd2088 }; // nota = 11, KF = 14
10'd719: phinc <= { 12'd2089 }; // nota = 11, KF = 15
10'd720: phinc <= { 12'd2092 }; // nota = 11, KF = 16
10'd721: phinc <= { 12'd2093 }; // nota = 11, KF = 17
10'd722: phinc <= { 12'd2095 }; // nota = 11, KF = 18
10'd723: phinc <= { 12'd2097 }; // nota = 11, KF = 19
10'd724: phinc <= { 12'd2099 }; // nota = 11, KF = 20
10'd725: phinc <= { 12'd2101 }; // nota = 11, KF = 21
10'd726: phinc <= { 12'd2103 }; // nota = 11, KF = 22
10'd727: phinc <= { 12'd2104 }; // nota = 11, KF = 23
10'd728: phinc <= { 12'd2107 }; // nota = 11, KF = 24
10'd729: phinc <= { 12'd2108 }; // nota = 11, KF = 25
10'd730: phinc <= { 12'd2110 }; // nota = 11, KF = 26
10'd731: phinc <= { 12'd2112 }; // nota = 11, KF = 27
10'd732: phinc <= { 12'd2114 }; // nota = 11, KF = 28
10'd733: phinc <= { 12'd2116 }; // nota = 11, KF = 29
10'd734: phinc <= { 12'd2118 }; // nota = 11, KF = 30
10'd735: phinc <= { 12'd2119 }; // nota = 11, KF = 31
10'd736: phinc <= { 12'd2122 }; // nota = 11, KF = 32
10'd737: phinc <= { 12'd2123 }; // nota = 11, KF = 33
10'd738: phinc <= { 12'd2125 }; // nota = 11, KF = 34
10'd739: phinc <= { 12'd2127 }; // nota = 11, KF = 35
10'd740: phinc <= { 12'd2129 }; // nota = 11, KF = 36
10'd741: phinc <= { 12'd2131 }; // nota = 11, KF = 37
10'd742: phinc <= { 12'd2133 }; // nota = 11, KF = 38
10'd743: phinc <= { 12'd2134 }; // nota = 11, KF = 39
10'd744: phinc <= { 12'd2137 }; // nota = 11, KF = 40
10'd745: phinc <= { 12'd2139 }; // nota = 11, KF = 41
10'd746: phinc <= { 12'd2141 }; // nota = 11, KF = 42
10'd747: phinc <= { 12'd2142 }; // nota = 11, KF = 43
10'd748: phinc <= { 12'd2145 }; // nota = 11, KF = 44
10'd749: phinc <= { 12'd2146 }; // nota = 11, KF = 45
10'd750: phinc <= { 12'd2148 }; // nota = 11, KF = 46
10'd751: phinc <= { 12'd2150 }; // nota = 11, KF = 47
10'd752: phinc <= { 12'd2153 }; // nota = 11, KF = 48
10'd753: phinc <= { 12'd2154 }; // nota = 11, KF = 49
10'd754: phinc <= { 12'd2156 }; // nota = 11, KF = 50
10'd755: phinc <= { 12'd2158 }; // nota = 11, KF = 51
10'd756: phinc <= { 12'd2160 }; // nota = 11, KF = 52
10'd757: phinc <= { 12'd2162 }; // nota = 11, KF = 53
10'd758: phinc <= { 12'd2164 }; // nota = 11, KF = 54
10'd759: phinc <= { 12'd2165 }; // nota = 11, KF = 55
10'd760: phinc <= { 12'd2168 }; // nota = 11, KF = 56
10'd761: phinc <= { 12'd2170 }; // nota = 11, KF = 57
10'd762: phinc <= { 12'd2172 }; // nota = 11, KF = 58
10'd763: phinc <= { 12'd2173 }; // nota = 11, KF = 59
10'd764: phinc <= { 12'd2176 }; // nota = 11, KF = 60
10'd765: phinc <= { 12'd2177 }; // nota = 11, KF = 61
10'd766: phinc <= { 12'd2179 }; // nota = 11, KF = 62
10'd767: phinc <= { 12'd2181 }; // nota = 11, KF = 63
10'd768: phinc <= { 12'd2185 }; // nota = 12, KF = 0
10'd769: phinc <= { 12'd2186 }; // nota = 12, KF = 1
10'd770: phinc <= { 12'd2188 }; // nota = 12, KF = 2
10'd771: phinc <= { 12'd2190 }; // nota = 12, KF = 3
10'd772: phinc <= { 12'd2192 }; // nota = 12, KF = 4
10'd773: phinc <= { 12'd2194 }; // nota = 12, KF = 5
10'd774: phinc <= { 12'd2196 }; // nota = 12, KF = 6
10'd775: phinc <= { 12'd2197 }; // nota = 12, KF = 7
10'd776: phinc <= { 12'd2200 }; // nota = 12, KF = 8
10'd777: phinc <= { 12'd2202 }; // nota = 12, KF = 9
10'd778: phinc <= { 12'd2204 }; // nota = 12, KF = 10
10'd779: phinc <= { 12'd2205 }; // nota = 12, KF = 11
10'd780: phinc <= { 12'd2208 }; // nota = 12, KF = 12
10'd781: phinc <= { 12'd2209 }; // nota = 12, KF = 13
10'd782: phinc <= { 12'd2211 }; // nota = 12, KF = 14
10'd783: phinc <= { 12'd2213 }; // nota = 12, KF = 15
10'd784: phinc <= { 12'd2216 }; // nota = 12, KF = 16
10'd785: phinc <= { 12'd2218 }; // nota = 12, KF = 17
10'd786: phinc <= { 12'd2220 }; // nota = 12, KF = 18
10'd787: phinc <= { 12'd2222 }; // nota = 12, KF = 19
10'd788: phinc <= { 12'd2223 }; // nota = 12, KF = 20
10'd789: phinc <= { 12'd2226 }; // nota = 12, KF = 21
10'd790: phinc <= { 12'd2227 }; // nota = 12, KF = 22
10'd791: phinc <= { 12'd2230 }; // nota = 12, KF = 23
10'd792: phinc <= { 12'd2232 }; // nota = 12, KF = 24
10'd793: phinc <= { 12'd2234 }; // nota = 12, KF = 25
10'd794: phinc <= { 12'd2236 }; // nota = 12, KF = 26
10'd795: phinc <= { 12'd2238 }; // nota = 12, KF = 27
10'd796: phinc <= { 12'd2239 }; // nota = 12, KF = 28
10'd797: phinc <= { 12'd2242 }; // nota = 12, KF = 29
10'd798: phinc <= { 12'd2243 }; // nota = 12, KF = 30
10'd799: phinc <= { 12'd2246 }; // nota = 12, KF = 31
10'd800: phinc <= { 12'd2249 }; // nota = 12, KF = 32
10'd801: phinc <= { 12'd2251 }; // nota = 12, KF = 33
10'd802: phinc <= { 12'd2253 }; // nota = 12, KF = 34
10'd803: phinc <= { 12'd2255 }; // nota = 12, KF = 35
10'd804: phinc <= { 12'd2256 }; // nota = 12, KF = 36
10'd805: phinc <= { 12'd2259 }; // nota = 12, KF = 37
10'd806: phinc <= { 12'd2260 }; // nota = 12, KF = 38
10'd807: phinc <= { 12'd2263 }; // nota = 12, KF = 39
10'd808: phinc <= { 12'd2265 }; // nota = 12, KF = 40
10'd809: phinc <= { 12'd2267 }; // nota = 12, KF = 41
10'd810: phinc <= { 12'd2269 }; // nota = 12, KF = 42
10'd811: phinc <= { 12'd2271 }; // nota = 12, KF = 43
10'd812: phinc <= { 12'd2272 }; // nota = 12, KF = 44
10'd813: phinc <= { 12'd2275 }; // nota = 12, KF = 45
10'd814: phinc <= { 12'd2276 }; // nota = 12, KF = 46
10'd815: phinc <= { 12'd2279 }; // nota = 12, KF = 47
10'd816: phinc <= { 12'd2281 }; // nota = 12, KF = 48
10'd817: phinc <= { 12'd2283 }; // nota = 12, KF = 49
10'd818: phinc <= { 12'd2285 }; // nota = 12, KF = 50
10'd819: phinc <= { 12'd2287 }; // nota = 12, KF = 51
10'd820: phinc <= { 12'd2288 }; // nota = 12, KF = 52
10'd821: phinc <= { 12'd2291 }; // nota = 12, KF = 53
10'd822: phinc <= { 12'd2292 }; // nota = 12, KF = 54
10'd823: phinc <= { 12'd2295 }; // nota = 12, KF = 55
10'd824: phinc <= { 12'd2297 }; // nota = 12, KF = 56
10'd825: phinc <= { 12'd2299 }; // nota = 12, KF = 57
10'd826: phinc <= { 12'd2301 }; // nota = 12, KF = 58
10'd827: phinc <= { 12'd2303 }; // nota = 12, KF = 59
10'd828: phinc <= { 12'd2304 }; // nota = 12, KF = 60
10'd829: phinc <= { 12'd2307 }; // nota = 12, KF = 61
10'd830: phinc <= { 12'd2308 }; // nota = 12, KF = 62
10'd831: phinc <= { 12'd2311 }; // nota = 12, KF = 63
10'd832: phinc <= { 12'd2315 }; // nota = 13, KF = 0
10'd833: phinc <= { 12'd2317 }; // nota = 13, KF = 1
10'd834: phinc <= { 12'd2319 }; // nota = 13, KF = 2
10'd835: phinc <= { 12'd2321 }; // nota = 13, KF = 3
10'd836: phinc <= { 12'd2322 }; // nota = 13, KF = 4
10'd837: phinc <= { 12'd2325 }; // nota = 13, KF = 5
10'd838: phinc <= { 12'd2326 }; // nota = 13, KF = 6
10'd839: phinc <= { 12'd2329 }; // nota = 13, KF = 7
10'd840: phinc <= { 12'd2331 }; // nota = 13, KF = 8
10'd841: phinc <= { 12'd2333 }; // nota = 13, KF = 9
10'd842: phinc <= { 12'd2335 }; // nota = 13, KF = 10
10'd843: phinc <= { 12'd2337 }; // nota = 13, KF = 11
10'd844: phinc <= { 12'd2338 }; // nota = 13, KF = 12
10'd845: phinc <= { 12'd2341 }; // nota = 13, KF = 13
10'd846: phinc <= { 12'd2342 }; // nota = 13, KF = 14
10'd847: phinc <= { 12'd2345 }; // nota = 13, KF = 15
10'd848: phinc <= { 12'd2348 }; // nota = 13, KF = 16
10'd849: phinc <= { 12'd2350 }; // nota = 13, KF = 17
10'd850: phinc <= { 12'd2352 }; // nota = 13, KF = 18
10'd851: phinc <= { 12'd2354 }; // nota = 13, KF = 19
10'd852: phinc <= { 12'd2355 }; // nota = 13, KF = 20
10'd853: phinc <= { 12'd2358 }; // nota = 13, KF = 21
10'd854: phinc <= { 12'd2359 }; // nota = 13, KF = 22
10'd855: phinc <= { 12'd2362 }; // nota = 13, KF = 23
10'd856: phinc <= { 12'd2364 }; // nota = 13, KF = 24
10'd857: phinc <= { 12'd2366 }; // nota = 13, KF = 25
10'd858: phinc <= { 12'd2368 }; // nota = 13, KF = 26
10'd859: phinc <= { 12'd2370 }; // nota = 13, KF = 27
10'd860: phinc <= { 12'd2371 }; // nota = 13, KF = 28
10'd861: phinc <= { 12'd2374 }; // nota = 13, KF = 29
10'd862: phinc <= { 12'd2375 }; // nota = 13, KF = 30
10'd863: phinc <= { 12'd2378 }; // nota = 13, KF = 31
10'd864: phinc <= { 12'd2382 }; // nota = 13, KF = 32
10'd865: phinc <= { 12'd2384 }; // nota = 13, KF = 33
10'd866: phinc <= { 12'd2386 }; // nota = 13, KF = 34
10'd867: phinc <= { 12'd2388 }; // nota = 13, KF = 35
10'd868: phinc <= { 12'd2389 }; // nota = 13, KF = 36
10'd869: phinc <= { 12'd2392 }; // nota = 13, KF = 37
10'd870: phinc <= { 12'd2393 }; // nota = 13, KF = 38
10'd871: phinc <= { 12'd2396 }; // nota = 13, KF = 39
10'd872: phinc <= { 12'd2398 }; // nota = 13, KF = 40
10'd873: phinc <= { 12'd2400 }; // nota = 13, KF = 41
10'd874: phinc <= { 12'd2402 }; // nota = 13, KF = 42
10'd875: phinc <= { 12'd2404 }; // nota = 13, KF = 43
10'd876: phinc <= { 12'd2407 }; // nota = 13, KF = 44
10'd877: phinc <= { 12'd2410 }; // nota = 13, KF = 45
10'd878: phinc <= { 12'd2411 }; // nota = 13, KF = 46
10'd879: phinc <= { 12'd2414 }; // nota = 13, KF = 47
10'd880: phinc <= { 12'd2417 }; // nota = 13, KF = 48
10'd881: phinc <= { 12'd2419 }; // nota = 13, KF = 49
10'd882: phinc <= { 12'd2421 }; // nota = 13, KF = 50
10'd883: phinc <= { 12'd2423 }; // nota = 13, KF = 51
10'd884: phinc <= { 12'd2424 }; // nota = 13, KF = 52
10'd885: phinc <= { 12'd2427 }; // nota = 13, KF = 53
10'd886: phinc <= { 12'd2428 }; // nota = 13, KF = 54
10'd887: phinc <= { 12'd2431 }; // nota = 13, KF = 55
10'd888: phinc <= { 12'd2433 }; // nota = 13, KF = 56
10'd889: phinc <= { 12'd2435 }; // nota = 13, KF = 57
10'd890: phinc <= { 12'd2437 }; // nota = 13, KF = 58
10'd891: phinc <= { 12'd2439 }; // nota = 13, KF = 59
10'd892: phinc <= { 12'd2442 }; // nota = 13, KF = 60
10'd893: phinc <= { 12'd2445 }; // nota = 13, KF = 61
10'd894: phinc <= { 12'd2446 }; // nota = 13, KF = 62
10'd895: phinc <= { 12'd2449 }; // nota = 13, KF = 63
10'd896: phinc <= { 12'd2452 }; // nota = 14, KF = 0
10'd897: phinc <= { 12'd2454 }; // nota = 14, KF = 1
10'd898: phinc <= { 12'd2456 }; // nota = 14, KF = 2
10'd899: phinc <= { 12'd2458 }; // nota = 14, KF = 3
10'd900: phinc <= { 12'd2459 }; // nota = 14, KF = 4
10'd901: phinc <= { 12'd2462 }; // nota = 14, KF = 5
10'd902: phinc <= { 12'd2463 }; // nota = 14, KF = 6
10'd903: phinc <= { 12'd2466 }; // nota = 14, KF = 7
10'd904: phinc <= { 12'd2468 }; // nota = 14, KF = 8
10'd905: phinc <= { 12'd2470 }; // nota = 14, KF = 9
10'd906: phinc <= { 12'd2472 }; // nota = 14, KF = 10
10'd907: phinc <= { 12'd2474 }; // nota = 14, KF = 11
10'd908: phinc <= { 12'd2477 }; // nota = 14, KF = 12
10'd909: phinc <= { 12'd2480 }; // nota = 14, KF = 13
10'd910: phinc <= { 12'd2481 }; // nota = 14, KF = 14
10'd911: phinc <= { 12'd2484 }; // nota = 14, KF = 15
10'd912: phinc <= { 12'd2488 }; // nota = 14, KF = 16
10'd913: phinc <= { 12'd2490 }; // nota = 14, KF = 17
10'd914: phinc <= { 12'd2492 }; // nota = 14, KF = 18
10'd915: phinc <= { 12'd2494 }; // nota = 14, KF = 19
10'd916: phinc <= { 12'd2495 }; // nota = 14, KF = 20
10'd917: phinc <= { 12'd2498 }; // nota = 14, KF = 21
10'd918: phinc <= { 12'd2499 }; // nota = 14, KF = 22
10'd919: phinc <= { 12'd2502 }; // nota = 14, KF = 23
10'd920: phinc <= { 12'd2504 }; // nota = 14, KF = 24
10'd921: phinc <= { 12'd2506 }; // nota = 14, KF = 25
10'd922: phinc <= { 12'd2508 }; // nota = 14, KF = 26
10'd923: phinc <= { 12'd2510 }; // nota = 14, KF = 27
10'd924: phinc <= { 12'd2513 }; // nota = 14, KF = 28
10'd925: phinc <= { 12'd2516 }; // nota = 14, KF = 29
10'd926: phinc <= { 12'd2517 }; // nota = 14, KF = 30
10'd927: phinc <= { 12'd2520 }; // nota = 14, KF = 31
10'd928: phinc <= { 12'd2524 }; // nota = 14, KF = 32
10'd929: phinc <= { 12'd2526 }; // nota = 14, KF = 33
10'd930: phinc <= { 12'd2528 }; // nota = 14, KF = 34
10'd931: phinc <= { 12'd2530 }; // nota = 14, KF = 35
10'd932: phinc <= { 12'd2531 }; // nota = 14, KF = 36
10'd933: phinc <= { 12'd2534 }; // nota = 14, KF = 37
10'd934: phinc <= { 12'd2535 }; // nota = 14, KF = 38
10'd935: phinc <= { 12'd2538 }; // nota = 14, KF = 39
10'd936: phinc <= { 12'd2540 }; // nota = 14, KF = 40
10'd937: phinc <= { 12'd2542 }; // nota = 14, KF = 41
10'd938: phinc <= { 12'd2544 }; // nota = 14, KF = 42
10'd939: phinc <= { 12'd2546 }; // nota = 14, KF = 43
10'd940: phinc <= { 12'd2549 }; // nota = 14, KF = 44
10'd941: phinc <= { 12'd2552 }; // nota = 14, KF = 45
10'd942: phinc <= { 12'd2553 }; // nota = 14, KF = 46
10'd943: phinc <= { 12'd2556 }; // nota = 14, KF = 47
10'd944: phinc <= { 12'd2561 }; // nota = 14, KF = 48
10'd945: phinc <= { 12'd2563 }; // nota = 14, KF = 49
10'd946: phinc <= { 12'd2565 }; // nota = 14, KF = 50
10'd947: phinc <= { 12'd2567 }; // nota = 14, KF = 51
10'd948: phinc <= { 12'd2568 }; // nota = 14, KF = 52
10'd949: phinc <= { 12'd2571 }; // nota = 14, KF = 53
10'd950: phinc <= { 12'd2572 }; // nota = 14, KF = 54
10'd951: phinc <= { 12'd2575 }; // nota = 14, KF = 55
10'd952: phinc <= { 12'd2577 }; // nota = 14, KF = 56
10'd953: phinc <= { 12'd2579 }; // nota = 14, KF = 57
10'd954: phinc <= { 12'd2581 }; // nota = 14, KF = 58
10'd955: phinc <= { 12'd2583 }; // nota = 14, KF = 59
10'd956: phinc <= { 12'd2586 }; // nota = 14, KF = 60
10'd957: phinc <= { 12'd2589 }; // nota = 14, KF = 61
10'd958: phinc <= { 12'd2590 }; // nota = 14, KF = 62
10'd959: phinc <= { 12'd2593 }; // nota = 14, KF = 63
10'd960: phinc <= { 12'd2452 }; // nota = 15, KF = 0
10'd961: phinc <= { 12'd2454 }; // nota = 15, KF = 1
10'd962: phinc <= { 12'd2456 }; // nota = 15, KF = 2
10'd963: phinc <= { 12'd2458 }; // nota = 15, KF = 3
10'd964: phinc <= { 12'd2459 }; // nota = 15, KF = 4
10'd965: phinc <= { 12'd2462 }; // nota = 15, KF = 5
10'd966: phinc <= { 12'd2463 }; // nota = 15, KF = 6
10'd967: phinc <= { 12'd2466 }; // nota = 15, KF = 7
10'd968: phinc <= { 12'd2468 }; // nota = 15, KF = 8
10'd969: phinc <= { 12'd2470 }; // nota = 15, KF = 9
10'd970: phinc <= { 12'd2472 }; // nota = 15, KF = 10
10'd971: phinc <= { 12'd2474 }; // nota = 15, KF = 11
10'd972: phinc <= { 12'd2477 }; // nota = 15, KF = 12
10'd973: phinc <= { 12'd2480 }; // nota = 15, KF = 13
10'd974: phinc <= { 12'd2481 }; // nota = 15, KF = 14
10'd975: phinc <= { 12'd2484 }; // nota = 15, KF = 15
10'd976: phinc <= { 12'd2488 }; // nota = 15, KF = 16
10'd977: phinc <= { 12'd2490 }; // nota = 15, KF = 17
10'd978: phinc <= { 12'd2492 }; // nota = 15, KF = 18
10'd979: phinc <= { 12'd2494 }; // nota = 15, KF = 19
10'd980: phinc <= { 12'd2495 }; // nota = 15, KF = 20
10'd981: phinc <= { 12'd2498 }; // nota = 15, KF = 21
10'd982: phinc <= { 12'd2499 }; // nota = 15, KF = 22
10'd983: phinc <= { 12'd2502 }; // nota = 15, KF = 23
10'd984: phinc <= { 12'd2504 }; // nota = 15, KF = 24
10'd985: phinc <= { 12'd2506 }; // nota = 15, KF = 25
10'd986: phinc <= { 12'd2508 }; // nota = 15, KF = 26
10'd987: phinc <= { 12'd2510 }; // nota = 15, KF = 27
10'd988: phinc <= { 12'd2513 }; // nota = 15, KF = 28
10'd989: phinc <= { 12'd2516 }; // nota = 15, KF = 29
10'd990: phinc <= { 12'd2517 }; // nota = 15, KF = 30
10'd991: phinc <= { 12'd2520 }; // nota = 15, KF = 31
10'd992: phinc <= { 12'd2524 }; // nota = 15, KF = 32
10'd993: phinc <= { 12'd2526 }; // nota = 15, KF = 33
10'd994: phinc <= { 12'd2528 }; // nota = 15, KF = 34
10'd995: phinc <= { 12'd2530 }; // nota = 15, KF = 35
10'd996: phinc <= { 12'd2531 }; // nota = 15, KF = 36
10'd997: phinc <= { 12'd2534 }; // nota = 15, KF = 37
10'd998: phinc <= { 12'd2535 }; // nota = 15, KF = 38
10'd999: phinc <= { 12'd2538 }; // nota = 15, KF = 39
10'd1000: phinc <= { 12'd2540 }; // nota = 15, KF = 40
10'd1001: phinc <= { 12'd2542 }; // nota = 15, KF = 41
10'd1002: phinc <= { 12'd2544 }; // nota = 15, KF = 42
10'd1003: phinc <= { 12'd2546 }; // nota = 15, KF = 43
10'd1004: phinc <= { 12'd2549 }; // nota = 15, KF = 44
10'd1005: phinc <= { 12'd2552 }; // nota = 15, KF = 45
10'd1006: phinc <= { 12'd2553 }; // nota = 15, KF = 46
10'd1007: phinc <= { 12'd2556 }; // nota = 15, KF = 47
10'd1008: phinc <= { 12'd2561 }; // nota = 15, KF = 48
10'd1009: phinc <= { 12'd2563 }; // nota = 15, KF = 49
10'd1010: phinc <= { 12'd2565 }; // nota = 15, KF = 50
10'd1011: phinc <= { 12'd2567 }; // nota = 15, KF = 51
10'd1012: phinc <= { 12'd2568 }; // nota = 15, KF = 52
10'd1013: phinc <= { 12'd2571 }; // nota = 15, KF = 53
10'd1014: phinc <= { 12'd2572 }; // nota = 15, KF = 54
10'd1015: phinc <= { 12'd2575 }; // nota = 15, KF = 55
10'd1016: phinc <= { 12'd2577 }; // nota = 15, KF = 56
10'd1017: phinc <= { 12'd2579 }; // nota = 15, KF = 57
10'd1018: phinc <= { 12'd2581 }; // nota = 15, KF = 58
10'd1019: phinc <= { 12'd2583 }; // nota = 15, KF = 59
10'd1020: phinc <= { 12'd2586 }; // nota = 15, KF = 60
10'd1021: phinc <= { 12'd2589 }; // nota = 15, KF = 61
10'd1022: phinc <= { 12'd2590 }; // nota = 15, KF = 62
10'd1023: phinc <= { 12'd2593 }; // nota = 15, KF = 63
/jt51/trunk/jt51/sin_lut.vh
0,0 → 1,276
/* This file is part of JT51.
 
JT51 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
 
JT51 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with JT51. If not, see <http://www.gnu.org/licenses/>.
Author: Jose Tejada Gomez. Twitter: @topapate
Version: 1.0
Date: 27-10-2016
*/
8'd0: log_val <= 12'd2137;
8'd1: log_val <= 12'd1731;
8'd2: log_val <= 12'd1543;
8'd3: log_val <= 12'd1419;
8'd4: log_val <= 12'd1326;
8'd5: log_val <= 12'd1252;
8'd6: log_val <= 12'd1190;
8'd7: log_val <= 12'd1137;
8'd8: log_val <= 12'd1091;
8'd9: log_val <= 12'd1050;
8'd10: log_val <= 12'd1013;
8'd11: log_val <= 12'd979;
8'd12: log_val <= 12'd949;
8'd13: log_val <= 12'd920;
8'd14: log_val <= 12'd894;
8'd15: log_val <= 12'd869;
8'd16: log_val <= 12'd846;
8'd17: log_val <= 12'd825;
8'd18: log_val <= 12'd804;
8'd19: log_val <= 12'd785;
8'd20: log_val <= 12'd767;
8'd21: log_val <= 12'd749;
8'd22: log_val <= 12'd732;
8'd23: log_val <= 12'd717;
8'd24: log_val <= 12'd701;
8'd25: log_val <= 12'd687;
8'd26: log_val <= 12'd672;
8'd27: log_val <= 12'd659;
8'd28: log_val <= 12'd646;
8'd29: log_val <= 12'd633;
8'd30: log_val <= 12'd621;
8'd31: log_val <= 12'd609;
8'd32: log_val <= 12'd598;
8'd33: log_val <= 12'd587;
8'd34: log_val <= 12'd576;
8'd35: log_val <= 12'd566;
8'd36: log_val <= 12'd556;
8'd37: log_val <= 12'd546;
8'd38: log_val <= 12'd536;
8'd39: log_val <= 12'd527;
8'd40: log_val <= 12'd518;
8'd41: log_val <= 12'd509;
8'd42: log_val <= 12'd501;
8'd43: log_val <= 12'd492;
8'd44: log_val <= 12'd484;
8'd45: log_val <= 12'd476;
8'd46: log_val <= 12'd468;
8'd47: log_val <= 12'd461;
8'd48: log_val <= 12'd453;
8'd49: log_val <= 12'd446;
8'd50: log_val <= 12'd439;
8'd51: log_val <= 12'd432;
8'd52: log_val <= 12'd425;
8'd53: log_val <= 12'd418;
8'd54: log_val <= 12'd411;
8'd55: log_val <= 12'd405;
8'd56: log_val <= 12'd399;
8'd57: log_val <= 12'd392;
8'd58: log_val <= 12'd386;
8'd59: log_val <= 12'd380;
8'd60: log_val <= 12'd375;
8'd61: log_val <= 12'd369;
8'd62: log_val <= 12'd363;
8'd63: log_val <= 12'd358;
8'd64: log_val <= 12'd352;
8'd65: log_val <= 12'd347;
8'd66: log_val <= 12'd341;
8'd67: log_val <= 12'd336;
8'd68: log_val <= 12'd331;
8'd69: log_val <= 12'd326;
8'd70: log_val <= 12'd321;
8'd71: log_val <= 12'd316;
8'd72: log_val <= 12'd311;
8'd73: log_val <= 12'd307;
8'd74: log_val <= 12'd302;
8'd75: log_val <= 12'd297;
8'd76: log_val <= 12'd293;
8'd77: log_val <= 12'd289;
8'd78: log_val <= 12'd284;
8'd79: log_val <= 12'd280;
8'd80: log_val <= 12'd276;
8'd81: log_val <= 12'd271;
8'd82: log_val <= 12'd267;
8'd83: log_val <= 12'd263;
8'd84: log_val <= 12'd259;
8'd85: log_val <= 12'd255;
8'd86: log_val <= 12'd251;
8'd87: log_val <= 12'd248;
8'd88: log_val <= 12'd244;
8'd89: log_val <= 12'd240;
8'd90: log_val <= 12'd236;
8'd91: log_val <= 12'd233;
8'd92: log_val <= 12'd229;
8'd93: log_val <= 12'd226;
8'd94: log_val <= 12'd222;
8'd95: log_val <= 12'd219;
8'd96: log_val <= 12'd215;
8'd97: log_val <= 12'd212;
8'd98: log_val <= 12'd209;
8'd99: log_val <= 12'd205;
8'd100: log_val <= 12'd202;
8'd101: log_val <= 12'd199;
8'd102: log_val <= 12'd196;
8'd103: log_val <= 12'd193;
8'd104: log_val <= 12'd190;
8'd105: log_val <= 12'd187;
8'd106: log_val <= 12'd184;
8'd107: log_val <= 12'd181;
8'd108: log_val <= 12'd178;
8'd109: log_val <= 12'd175;
8'd110: log_val <= 12'd172;
8'd111: log_val <= 12'd169;
8'd112: log_val <= 12'd167;
8'd113: log_val <= 12'd164;
8'd114: log_val <= 12'd161;
8'd115: log_val <= 12'd159;
8'd116: log_val <= 12'd156;
8'd117: log_val <= 12'd153;
8'd118: log_val <= 12'd151;
8'd119: log_val <= 12'd148;
8'd120: log_val <= 12'd146;
8'd121: log_val <= 12'd143;
8'd122: log_val <= 12'd141;
8'd123: log_val <= 12'd138;
8'd124: log_val <= 12'd136;
8'd125: log_val <= 12'd134;
8'd126: log_val <= 12'd131;
8'd127: log_val <= 12'd129;
8'd128: log_val <= 12'd127;
8'd129: log_val <= 12'd125;
8'd130: log_val <= 12'd122;
8'd131: log_val <= 12'd120;
8'd132: log_val <= 12'd118;
8'd133: log_val <= 12'd116;
8'd134: log_val <= 12'd114;
8'd135: log_val <= 12'd112;
8'd136: log_val <= 12'd110;
8'd137: log_val <= 12'd108;
8'd138: log_val <= 12'd106;
8'd139: log_val <= 12'd104;
8'd140: log_val <= 12'd102;
8'd141: log_val <= 12'd100;
8'd142: log_val <= 12'd98;
8'd143: log_val <= 12'd96;
8'd144: log_val <= 12'd94;
8'd145: log_val <= 12'd92;
8'd146: log_val <= 12'd91;
8'd147: log_val <= 12'd89;
8'd148: log_val <= 12'd87;
8'd149: log_val <= 12'd85;
8'd150: log_val <= 12'd83;
8'd151: log_val <= 12'd82;
8'd152: log_val <= 12'd80;
8'd153: log_val <= 12'd78;
8'd154: log_val <= 12'd77;
8'd155: log_val <= 12'd75;
8'd156: log_val <= 12'd74;
8'd157: log_val <= 12'd72;
8'd158: log_val <= 12'd70;
8'd159: log_val <= 12'd69;
8'd160: log_val <= 12'd67;
8'd161: log_val <= 12'd66;
8'd162: log_val <= 12'd64;
8'd163: log_val <= 12'd63;
8'd164: log_val <= 12'd62;
8'd165: log_val <= 12'd60;
8'd166: log_val <= 12'd59;
8'd167: log_val <= 12'd57;
8'd168: log_val <= 12'd56;
8'd169: log_val <= 12'd55;
8'd170: log_val <= 12'd53;
8'd171: log_val <= 12'd52;
8'd172: log_val <= 12'd51;
8'd173: log_val <= 12'd49;
8'd174: log_val <= 12'd48;
8'd175: log_val <= 12'd47;
8'd176: log_val <= 12'd46;
8'd177: log_val <= 12'd45;
8'd178: log_val <= 12'd43;
8'd179: log_val <= 12'd42;
8'd180: log_val <= 12'd41;
8'd181: log_val <= 12'd40;
8'd182: log_val <= 12'd39;
8'd183: log_val <= 12'd38;
8'd184: log_val <= 12'd37;
8'd185: log_val <= 12'd36;
8'd186: log_val <= 12'd35;
8'd187: log_val <= 12'd34;
8'd188: log_val <= 12'd33;
8'd189: log_val <= 12'd32;
8'd190: log_val <= 12'd31;
8'd191: log_val <= 12'd30;
8'd192: log_val <= 12'd29;
8'd193: log_val <= 12'd28;
8'd194: log_val <= 12'd27;
8'd195: log_val <= 12'd26;
8'd196: log_val <= 12'd25;
8'd197: log_val <= 12'd24;
8'd198: log_val <= 12'd23;
8'd199: log_val <= 12'd23;
8'd200: log_val <= 12'd22;
8'd201: log_val <= 12'd21;
8'd202: log_val <= 12'd20;
8'd203: log_val <= 12'd20;
8'd204: log_val <= 12'd19;
8'd205: log_val <= 12'd18;
8'd206: log_val <= 12'd17;
8'd207: log_val <= 12'd17;
8'd208: log_val <= 12'd16;
8'd209: log_val <= 12'd15;
8'd210: log_val <= 12'd15;
8'd211: log_val <= 12'd14;
8'd212: log_val <= 12'd13;
8'd213: log_val <= 12'd13;
8'd214: log_val <= 12'd12;
8'd215: log_val <= 12'd12;
8'd216: log_val <= 12'd11;
8'd217: log_val <= 12'd10;
8'd218: log_val <= 12'd10;
8'd219: log_val <= 12'd9;
8'd220: log_val <= 12'd9;
8'd221: log_val <= 12'd8;
8'd222: log_val <= 12'd8;
8'd223: log_val <= 12'd7;
8'd224: log_val <= 12'd7;
8'd225: log_val <= 12'd7;
8'd226: log_val <= 12'd6;
8'd227: log_val <= 12'd6;
8'd228: log_val <= 12'd5;
8'd229: log_val <= 12'd5;
8'd230: log_val <= 12'd5;
8'd231: log_val <= 12'd4;
8'd232: log_val <= 12'd4;
8'd233: log_val <= 12'd4;
8'd234: log_val <= 12'd3;
8'd235: log_val <= 12'd3;
8'd236: log_val <= 12'd3;
8'd237: log_val <= 12'd2;
8'd238: log_val <= 12'd2;
8'd239: log_val <= 12'd2;
8'd240: log_val <= 12'd2;
8'd241: log_val <= 12'd1;
8'd242: log_val <= 12'd1;
8'd243: log_val <= 12'd1;
8'd244: log_val <= 12'd1;
8'd245: log_val <= 12'd1;
8'd246: log_val <= 12'd1;
8'd247: log_val <= 12'd1;
8'd248: log_val <= 12'd0;
8'd249: log_val <= 12'd0;
8'd250: log_val <= 12'd0;
8'd251: log_val <= 12'd0;
8'd252: log_val <= 12'd0;
8'd253: log_val <= 12'd0;
8'd254: log_val <= 12'd0;
8'd255: log_val <= 12'd0;
/jt51/trunk/jt51 datasheet.pdf Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream
jt51/trunk/jt51 datasheet.pdf Property changes : Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.