`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: 
// Engineer: 
// 
// Create Date:    14:12:30 06/03/2020 
// Design Name: 
// Module Name:    WinParameters 
// Project Name: 
// Target Devices: 
// Tool versions: 
// Description: 
//
// Dependencies: kek
//
// Revision: 
// Revision 0.01 - File Created
// Additional Comments: 
//
//////////////////////////////////////////////////////////////////////////////////
module WinParameters 
#(	
	parameter	WindPhIncWidth		=	48,
	parameter	WindNormCoefWidth	=	14,
	parameter	WindPNumWidth		=	32,
	parameter	BandCmdWidth		=	16
)
(	
	input		Clk_i,
	input		Rst_i,
	input		[BandCmdWidth-1:0]		FilterCmd_i,
	output		[WindPhIncWidth-1:0]	WinPhInc_o,
	output		[WindPhIncWidth-1:0]	WinPhIncStart_o,
	output		[WindNormCoefWidth-1:0]	WinNormCoef_o,
	output		[WindPNumWidth-1:0]		WinPointsNum_o,
	output		[WindPNumWidth-1:0]		AverageNoiseLvl_o
);
//================================================================================
//  REG/WIRE
//================================================================================
	reg [WindPhIncWidth-1:0]	windPhInc;
	reg	[WindNormCoefWidth-1:0]	winNormCoef;
	reg	[WindPNumWidth-1:0]		winPointsNum;
	reg	[WindPNumWidth-1:0]		averageNoiseLvl;
//================================================================================
//  ASSIGNMENTS
//================================================================================	
	assign	WinPhInc_o 			=	windPhInc;
	assign	WinPhIncStart_o		 =	32'h80000000;
	assign	WinNormCoef_o		=	winNormCoef;
	assign	WinPointsNum_o		=	winPointsNum;
	assign	AverageNoiseLvl_o	=	averageNoiseLvl;
//================================================================================
//  CODING
//================================================================================	
always	@	(posedge	Clk_i)	begin
	if	(!Rst_i)	begin
		case (FilterCmd_i)			
			8'h0 : begin	//	1	Hz
						windPhInc		<=	32'h2a8;
						// winNormCoef		<=	32'h334269d2;
						winNormCoef		<=	32'h3395e8ca;
						winPointsNum	<=	32'h30291a0;
						averageNoiseLvl	<=	32'h0;
					end
			8'h1 : begin//	1.5	Hz
						windPhInc		<=	32'h3fc;
						// winNormCoef		<=	32'h3391cf5e;
						winNormCoef		<=	32'h3395e8ca;
						winPointsNum	<=	32'h201b66a;
						averageNoiseLvl	<=	32'h0;
					end
			8'h2 : begin//	2	Hz
						windPhInc		<=	32'h550;
						// winNormCoef		<=	32'h33c269d2;
						winNormCoef		<=	32'h33c7e10e;
						winPointsNum	<=	32'h18148d0;
						averageNoiseLvl	<=	32'h0;
					 end
			8'h3 : begin//	3	Hz
						windPhInc		<=	32'h7f9;
						// winNormCoef		<=	32'h3411ccc1;
						winNormCoef		<=	32'h3415e61b;
						winPointsNum	<=	32'h100db35;
						averageNoiseLvl	<=	32'h0;
					end
			8'h4 : begin//	5	Hz
						windPhInc		<=	32'hd49;
						// winNormCoef		<=	32'h347301aa;
						winNormCoef		<=	32'h3479d6a3;
						winPointsNum	<=	32'h9a1d20;
						averageNoiseLvl	<=	32'h0;
					end
			8'h5 : begin//	7	Hz
						windPhInc		<=	32'h129a;
						// winNormCoef		<=	32'h34aa19fd;
						winNormCoef		<=	32'h34aee23e;
						winPointsNum	<=	32'h6e14cd;
						averageNoiseLvl	<=	32'h0;
					end
			8'h10 : begin//	10	Hz
						windPhInc		<=	32'h1a93;
						// winNormCoef		<=	32'h34f3005d;
						winNormCoef		<=	32'h34f9d54a;
						winPointsNum	<=	32'h4d0e90;
						averageNoiseLvl	<=	32'h0;
					end
			8'h11 : begin//	15	Hz
						windPhInc		<=	32'h27dd;
						// winNormCoef		<=	32'h35363ff7;
						winNormCoef		<=	32'h353b5fa5;
						winPointsNum	<=	32'h335f0a;
						averageNoiseLvl	<=	32'h0;
					end
			8'h12 : begin//	20	Hz
						windPhInc		<=	32'h3527;
						// winNormCoef		<=	32'h3572ffba;
						winNormCoef		<=	32'h3579d49f;
						winPointsNum	<=	32'h268748;
						averageNoiseLvl	<=	32'h0;
					end
			8'h13 : begin//	30	Hz
						windPhInc		<=	32'h4fbb;
						// winNormCoef		<=	32'h35b63fa7;
						winNormCoef		<=	32'h35bb5f4e;
						winPointsNum	<=	32'h19af85;
						averageNoiseLvl	<=	32'h0;
					end
			8'h14 : begin//	50	Hz
						windPhInc		<=	32'h84e3;
						// winNormCoef		<=	32'h3617df9c;
						winNormCoef		<=	32'h361c24a2;
						winPointsNum	<=	32'hf6950;
						averageNoiseLvl	<=	32'h0;
					end
			8'h15 : begin//	70	Hz
						windPhInc		<=	32'hba0b;
						// winNormCoef		<=	32'h36549f77;
						winNormCoef		<=	32'h365a99ac;
						winPointsNum	<=	32'hb0214;
						averageNoiseLvl	<=	32'h0;
					end
			8'h20 : begin//	100	Hz
						windPhInc		<=	32'h109c7;
						// winNormCoef		<=	32'h3697df93;
						winNormCoef		<=	32'h369c248d;
						winPointsNum	<=	32'h7b4a8;
						averageNoiseLvl	<=	32'h0;
					end
			8'h21 : begin//	150	Hz
						windPhInc		<=	32'h18eab;
						// winNormCoef		<=	32'h36e3cf84;
						winNormCoef		<=	32'h36ea36ec;
						winPointsNum	<=	32'h5231a;
						averageNoiseLvl	<=	32'h0;
					end
			8'h22 : begin//	200	Hz
						windPhInc		<=	32'h21390;
						// winNormCoef		<=	32'h3717df94;
						winNormCoef		<=	32'h371c2478;
						winPointsNum	<=	32'h3da54;
						averageNoiseLvl	<=	32'h0;
					end
			8'h23 : begin//	300	Hz 
						windPhInc		<=	32'h31d5b;
						// winNormCoef		<=	32'h3763cf83;
						winNormCoef		<=	32'h376a36b6;
						winPointsNum	<=	32'h2918d;
						averageNoiseLvl	<=	32'h0;
					end
			8'h24 : begin//	500	Hz
						windPhInc		<=	32'h530e3;
						// winNormCoef		<=	32'h37bdd7e8;
						winNormCoef		<=	32'h37c32db2;
						winPointsNum	<=	32'h18a88;
						averageNoiseLvl	<=	32'h0;
					end
			8'h25 : begin//	700	Hz
						windPhInc		<=	32'h7449e;
						// winNormCoef		<=	32'h3804e417;
						winNormCoef		<=	32'h38089ffd;
						winPointsNum	<=	32'h119ce;
						averageNoiseLvl	<=	32'h0;
					end
			8'h30 : begin//	1	kHz
						windPhInc		<=	32'ha61fc;
						// winNormCoef		<=	32'h383dd7e8;
						winNormCoef		<=	32'h38432d23;
						winPointsNum	<=	32'hc544;
						averageNoiseLvl	<=	32'h0;
					end
			8'h31 : begin//	1.5	kHz
						windPhInc		<=	32'hf92fb;
						// winNormCoef		<=	32'h388e6329;
						winNormCoef		<=	32'h389262af;
						winPointsNum	<=	32'h8382;
						averageNoiseLvl	<=	32'h0;
					end
			8'h32 : begin//	2	kHz
						windPhInc		<=	32'h14c3f9;
						// winNormCoef		<=	32'h38bdd900;
						winNormCoef		<=	32'h38c32d23;
						winPointsNum	<=	32'h62a2;
						averageNoiseLvl	<=	32'h0;
					end
			8'h33 : begin//	3	kHz
						windPhInc		<=	32'h1f25f6;
						// winNormCoef		<=	32'h390e6466;
						winNormCoef		<=	32'h391262b5;
						winPointsNum	<=	32'h41c1;
						averageNoiseLvl	<=	32'h0;
					end
			8'h34 : begin//	5	kHz
						windPhInc		<=	32'h33ee26;
						// winNormCoef		<=	32'h396d509f;
						winNormCoef		<=	32'h3973f593;
						winPointsNum	<=	32'h2774;
						averageNoiseLvl	<=	32'h0;
					end
			8'h35 : begin//	7	kHz
						windPhInc		<=	32'h48bca9;
						// winNormCoef		<=	32'h39a61fcc;
						winNormCoef		<=	32'h39aac491;
						winPointsNum	<=	32'h1c2e;
						averageNoiseLvl	<=	32'h0;
					end
			8'h40 : begin//	10	kHz
						windPhInc		<=	32'h67dc4c;
						// winNormCoef		<=	32'h39ed577f;
						winNormCoef		<=	32'h39f3f593;
						winPointsNum	<=	32'h13ba;
						averageNoiseLvl	<=	32'h0;
					end
			8'h41 : begin//	15	kHz
						windPhInc		<=	32'h9c09c0;
						// winNormCoef		<=	32'h3a3206c8;
						winNormCoef		<=	32'h3a36f82e;
						winPointsNum	<=	32'hd26;
						averageNoiseLvl	<=	32'h0;
					end
			8'h42 : begin//	20	kHz
						windPhInc 		<=	32'hd00d00;
						// winNormCoef		<=	32'h3a6d577f;
						winNormCoef		<=	32'h3a73e7a1;
						winPointsNum	<=	32'h9dd;
						averageNoiseLvl	<=	32'h0;
					end
			8'h43 : begin//	30	kHz
						windPhInc		<=	32'h1381381;
						// winNormCoef		<=	32'h3ab21643;
						winNormCoef		<=	32'h3ab6f82e;
						winPointsNum	<=	32'h693;
						averageNoiseLvl	<=	32'h0;
					end
			8'h44 : begin//	50	kHz
						windPhInc		<=	32'h2082082;
						// winNormCoef		<=	32'h3b14707d;
						winNormCoef		<=	32'h3b1870f3;
						winPointsNum	<=	32'h3f2;
						averageNoiseLvl	<=	32'h0;
					end
			8'h45 : begin//	70	KHz
						windPhInc		<=	32'h2d82d82;
						// winNormCoef		<=	32'h3b500d01;
						winNormCoef		<=	32'h3b559010;
						winPointsNum	<=	32'h2d1;
						averageNoiseLvl	<=	32'h0;
					end
			8'h50 : begin//	100	KHz
						windPhInc		<=	32'h4104104;
						// winNormCoef		<=	32'h3b949b93;
						winNormCoef		<=	32'h3b98700b;
						winPointsNum	<=	32'h1f9;
						averageNoiseLvl	<=	32'h0;
					end
			8'h51 : begin//	150	KHz
						windPhInc 		<=	32'h6186186;
						// winNormCoef		<=	32'h3bdfac1f;
						winNormCoef		<=	32'h3be52dcd;
						winPointsNum	<=	32'h150;
						averageNoiseLvl	<=	32'h0;
					end
			8'h52 : begin//	200	KHz
						windPhInc		<=	32'h8421084;
						// winNormCoef		<=	32'h3c14f209;
						winNormCoef		<=	32'h3c18700b;
						winPointsNum	<=	32'hfc;
						averageNoiseLvl	<=	32'h0;
					end
			8'h53 : begin//	300	KHz
						windPhInc 		<=	32'hc30c30c;
						// winNormCoef		<=	32'h3c607038;
						winNormCoef		<=	32'h3c652dcd;
						winPointsNum	<=	32'ha8;
						averageNoiseLvl	<=	32'h0;
					end
			8'h54 : begin//	500	KHz
						windPhInc 		<=	32'h1c71c71;
						// winNormCoef		<=	32'h3ce38e38;
						winNormCoef		<=	32'h3ce98ccd;
						winPointsNum	<=	32'h90;
						averageNoiseLvl	<=	32'h0;
					end
			8'h55 : begin//	700	KHz
						windPhInc		<=	32'h2828282;
						// winNormCoef		<=	32'h3d20a0a0;
						winNormCoef		<=	32'h3d24cd6d;
						winPointsNum	<=	32'h66;
						averageNoiseLvl	<=	32'h0;
					end
			8'h60 : begin//	1	MHz
						windPhInc 		<=	32'h38e38e3;
						// winNormCoef		<=	32'h3d638e39;
						winNormCoef		<=	32'h3d698ccd;
						winPointsNum	<=	32'h48;
						averageNoiseLvl	<=	32'h0;
					end
			8'h61 : begin//	1.5	MHz
						windPhInc 		<=	32'h5555555;
						// winNormCoef		<=	32'h3daaaaab;
						winNormCoef		<=	32'h3daf299a;
						winPointsNum	<=	32'h30;
						averageNoiseLvl	<=	32'h0;
					end
			8'h62 : begin//	2	MHz
						windPhInc 		<=	32'h71c71c7;
						// winNormCoef		<=	32'h3de38e39;
						winNormCoef		<=	32'h3de98759;
						winPointsNum	<=	32'h24;
						averageNoiseLvl	<=	32'h0;
					end	
			8'h63 : begin
						windPhInc 		<=	32'h0;
						// winNormCoef		<=	32'h3e124925;
						winNormCoef		<=	32'h3e1665f8;
						winPointsNum	<=	32'he;
						averageNoiseLvl	<=	32'h3b83126f;
					end	
			// 8'h64 : begin//	5	MHz
						// windPhInc 		<=	32'h12492492;
						// winNormCoef		<=	32'h3e924925;
						// winPointsNum	<=	32'he;
					// end	
			// 8'h64 : begin//	2,46	MHz
						// windPhInc 		<=	32'h9d89d89;
						// winNormCoef		<=	32'h3df76c57;
						// winPointsNum	<=	32'h1a;
					// end	
			// 8'h70 : begin
						// параметры для калибровки - прямоугольное окно 65536 отсчетов	2^16
						// windPhInc 		<=	32'h1FFFFFFF;
						// winNormCoef		<=	32'h6D13892;
						// winPointsNum	<=	32'h10000;
					// end	
			// 8'h71 : begin
						// 7.5MHZ
						// windPhInc 		<=	32'h1c71c71c;
						// winNormCoef		<=	32'h3ee38e39;
						// winPointsNum	<=	32'h9;
					// end	
			// 8'h72 : begin
						// 10MHZ
						// windPhInc 		<=	32'h24924924;
						// winNormCoef		<=	32'h3f124925;
						// winPointsNum	<=	32'h7;
					// end	
			8'h64 : begin
						windPhInc 		<=	32'h0;
						// winNormCoef		<=	32'h3e800000;
						winNormCoef		<=	32'h3e839930;
						winPointsNum	<=	32'h8;
						averageNoiseLvl	<=	32'h3bc49ba6;
					end	
			8'h70 : begin
						// параметры для калибровки - прямоугольное окно 65536 отсчетов	2^16
						windPhInc 		<=	32'h1FFFFFFF;
						winNormCoef		<=	32'h6D13892;
						winPointsNum	<=	32'h10000;
						averageNoiseLvl	<=	32'h0;
					end	
			8'h71 : begin							
						windPhInc 		<=	32'h0;
						// winNormCoef		<=	32'h3eaaaaab;
						winNormCoef		<=	32'h3eaf76cd;
						winPointsNum	<=	32'h6;
						averageNoiseLvl	<=	32'h3c03126f;
					end	
			8'h72 : begin	
						windPhInc 		<=	32'h0;
						// winNormCoef		<=	32'h3f000000;
						winNormCoef		<=	32'h3f039939;
						winPointsNum	<=	32'h4;
						averageNoiseLvl	<=	32'h3a83126f;
					end
					
			default: begin	
						windPhInc 		<=	32'h15555555;
						winNormCoef		<=	32'h3e86cfea;
						winPointsNum	<=	32'hc;
						averageNoiseLvl	<=	32'h0;
					 end					 
		endcase
	end	
end
endmodule

