Browse Source

Добавлена логика перегрузки коэффициентов FIR Compiler

Anatoliy Chigirinskiy 1 năm trước cách đây
mục cha
commit
34a9890420

+ 232 - 6
src/src/FftDataFiltering/DecimFilterWrapper.v

@@ -62,12 +62,40 @@ module	DecimFilterWrapper
 	wire	adcSinVal;
 	wire	[AdcDataWidth-1:0]	adcCosResult;
 	wire	adcCosVal;
+
+	wire   	axiReloadReady;
+	wire   	axiReloadLast;
+	
+	wire   	axiReloadValid;
+	wire   	axiDataValid;
+	wire   	axiConfigReady;
+	wire	axiConfigValid;
+	wire [7:0] axiConfigData;
+	wire [15:0] axiReloadDataRam;
 	
+
+	reg axiDataValidReg;
+	reg axiReloadValidReg;
+	reg   	[15:0]  axiReloadData;
+	reg axiReloadLastReg;
+	reg axiConfigValidReg;
+	reg [7:0] axiConfigDataReg;
+
+
 	reg		[24-1:0]	ifFtwLReg;
 	reg		[24-1:0]	ifFtwHReg;
 	
 	reg		[15:0]	outDataI;
 	reg		[15:0]	outDataQ;
+
+	reg 	[1:0] currState;
+	reg 	[1:0] nextState;
+
+	reg 	[2:0] decimFactorReg;
+
+	reg		[3:0] coeffCnt;
+	reg		[4:0] delayCnt;
+	reg		[1:0] configCnt;
 	
 	localparam	extendBitNum	=	FilteredDataWidth-AdcDataWidth;
 	
@@ -81,6 +109,14 @@ module	DecimFilterWrapper
 	// localparam	maxWidthForR8	=	5'd26;	//msb for R = 8;
 	// localparam	maxWidthForR9	=	5'd27;	//msb for R = 9;
 	// localparam	maxWidthForR10	=	5'd28;	//msb for R = 10;
+
+	localparam 	IDLE		=	2'd0;
+	localparam 	RECONFIG	=	2'd1;
+	localparam 	WAIT_READY	=	2'd2;
+	localparam	CONFIG_STATE =  2'd3;		
+
+
+	localparam  DELAY_VALUE = 2*8-1;
 	
 	wire	[39:0]	firData;
 	wire	firDataVal;
@@ -95,12 +131,25 @@ module	DecimFilterWrapper
 	assign	FilteredDataVal_o	=	firDataVal;
 
 
+	assign  axiDataValid = axiDataValidReg;
+	assign  axiReloadValid = axiReloadValidReg;
+	assign  axiReloadLast = axiReloadLastReg;
+	assign axiConfigValid = axiConfigValidReg;
+	assign axiConfigData = axiConfigDataReg;
+
+
 // {{14{AdcData_i[AdcDataWidth-1]}},AdcData_i}
 
 //================================================================================
 //	CODING
 //================================================================================
 
+always @(posedge Clk_i) begin 
+		decimFactorReg <= DecimFactor_i;
+	end
+
+
+
 always	@(posedge	Clk_i)	begin
 	if	(!Rst_i)	begin
 		case(DecimFactor_i)
@@ -161,6 +210,167 @@ always	@(posedge	Clk_i)	begin
 	end
 end
 
+
+always @(posedge Clk_i) begin 
+    if (Rst_i) begin 
+        currState <= IDLE;
+    end
+    else begin 
+        currState <= nextState;
+    end
+end
+
+
+
+always @(*) begin 
+	case (currState)  
+		IDLE : begin
+			axiDataValidReg = decimDataValI;
+			axiReloadData = 16'h0;
+			axiReloadLastReg = 1'b0;
+			axiConfigValidReg = 1'b0;
+		end
+		RECONFIG : begin
+			axiDataValidReg = 1'b0;
+			axiReloadValidReg = 1'b1;
+			axiConfigValidReg = 1'b0;
+			axiConfigDataReg = 8'h0;
+			axiReloadData = axiReloadDataRam;
+			if (coeffCnt == 4'd7) begin 
+				axiReloadLastReg = 1'b1;
+			end
+			else begin 
+				axiReloadLastReg = 1'b0;
+			end
+		end
+		WAIT_READY : begin
+			axiDataValidReg = 1'b0;
+			axiReloadLastReg = 1'b0;
+			axiReloadValidReg = 1'b0;
+			axiReloadData = 16'h0;
+			axiConfigValidReg = 1'b0;
+			axiConfigDataReg = 8'h0;
+		end
+		CONFIG_STATE : begin
+			axiConfigValidReg = 1'b1;
+			if (configCnt == 1) begin 
+				axiConfigDataReg = 8'h0;
+			end
+			else if (configCnt == 2) begin 
+				axiConfigDataReg = 8'h0;
+			end
+		end
+	endcase
+end
+
+
+
+
+
+			
+
+
+always @(posedge Clk_i) begin 
+	if (Rst_i) begin 
+		coeffCnt <= 4'd0;
+	end
+	else begin 
+		if (currState == RECONFIG) begin 
+			coeffCnt <= coeffCnt + 1;
+		end
+		else begin 
+			coeffCnt <= 4'd0;
+		end
+	end
+end
+
+always @(posedge Clk_i) begin 
+	if (Rst_i) begin
+		 delayCnt <= 5'd0;
+	end
+	else begin 
+		if (currState == WAIT_READY) begin 
+			delayCnt <= delayCnt +1;
+		end
+		else begin 
+			delayCnt <= 5'd0;
+		end
+	end
+end
+
+always @(posedge Clk_i) begin 
+	if (Rst_i) begin 
+		configCnt <= 2'b0;
+	end
+	else begin 
+		if (currState == CONFIG_STATE) begin 
+			configCnt <= configCnt +1;
+		end
+		else begin 
+			configCnt <= 2'b0;
+		end
+	end
+end
+
+
+
+
+
+always @(*) begin 
+    if (Rst_i) begin 
+        nextState = IDLE;
+    end
+    else begin 
+        case (currState)
+            IDLE: begin 
+                if (decimFactorReg != DecimFactor_i && axiReloadReady) begin 
+                    nextState = RECONFIG;
+                end
+            end
+			RECONFIG: begin 
+				if (coeffCnt == 4'd7) begin 
+					nextState = WAIT_READY;
+				end
+			end
+			WAIT_READY: begin
+				if (delayCnt == DELAY_VALUE) begin
+					nextState = CONFIG_STATE;
+				end
+			end
+			CONFIG_STATE: begin 
+					if (configCnt == 2) begin 
+						nextState = IDLE;
+					end
+			end
+			default: begin
+				nextState = IDLE;
+			end
+        endcase
+    end
+end
+
+
+
+
+
+
+
+
+
+
+
+
+ReloadCoeffRam ReloadCoeffRam (
+	.Clk_i			(Clk_i),
+	.Rst_i			(Rst_i),
+	.ReadEn_i		(axiReloadValid),
+	.Data_o			(axiReloadDataRam)
+
+
+);
+
+
+
 cicFilter 
 #(
 	.N (N),	//filter order
@@ -180,13 +390,29 @@ cicFilterInstI
 	.DataValid_o	(decimDataValI)
 );
 
+// FirFilter FirFilter (
+//   .aclk(Clk_i),                              // input wire aclk
+//   .s_axis_data_tvalid(decimDataValI),  // input wire s_axis_data_tvalid
+//   .s_axis_data_tready(),  // output wire s_axis_data_tready
+//   .s_axis_data_tdata(outDataI),    // input wire [15 : 0] s_axis_data_tdata
+//   .m_axis_data_tvalid(firDataVal),  // output wire m_axis_data_tvalid
+//   .m_axis_data_tdata(firData)    // output wire [39 : 0] m_axis_data_tdata
+// );
+
 FirFilter FirFilter (
-  .aclk(Clk_i),                              // input wire aclk
-  .s_axis_data_tvalid(decimDataValI),  // input wire s_axis_data_tvalid
-  .s_axis_data_tready(),  // output wire s_axis_data_tready
-  .s_axis_data_tdata(outDataI),    // input wire [15 : 0] s_axis_data_tdata
-  .m_axis_data_tvalid(firDataVal),  // output wire m_axis_data_tvalid
-  .m_axis_data_tdata(firData)    // output wire [39 : 0] m_axis_data_tdata
+  .aclk(Clk_i),                                                        // input wire aclk
+  .s_axis_data_tvalid(axiDataValid),                            // input wire s_axis_data_tvalid
+  .s_axis_data_tready(),                            // output wire s_axis_data_tready
+  .s_axis_data_tdata(outDataI),                              // input wire [15 : 0] s_axis_data_tdata
+  .s_axis_config_tvalid(axiConfigValid),                        // input wire s_axis_config_tvalid
+  .s_axis_config_tready(axiConfigReady),                        // output wire s_axis_config_tready
+  .s_axis_config_tdata(axiConfigDataReg),                          // input wire [7 : 0] s_axis_config_tdata
+  .s_axis_reload_tvalid(axiReloadValid),                        // input wire s_axis_reload_tvalid
+  .s_axis_reload_tready(axiReloadReady),                        // output wire s_axis_reload_tready
+  .s_axis_reload_tlast(axiReloadLast),                          // input wire s_axis_reload_tlast
+  .s_axis_reload_tdata(axiReloadData),                          // input wire [15 : 0] s_axis_reload_tdata
+  .m_axis_data_tvalid(firDataVal),                            // output wire m_axis_data_tvalid
+  .m_axis_data_tdata(firData)                         // output wire [39 : 0] m_axis_data_tdata
 );
 
 endmodule

+ 108 - 0
src/src/FftDataFiltering/ReloadCoeffRam.v

@@ -0,0 +1,108 @@
+
+// `include "mem_init1.txt"
+// `include "mem_init2.txt"
+module ReloadCoeffRam (
+    input Clk_i,
+    input Rst_i,
+    input ReadEn_i,
+
+    output signed [15:0] Data_o
+
+
+
+
+
+
+);
+
+
+
+integer m1;
+integer m2;
+
+
+assign Data_o = dataReg;
+
+
+
+reg [4:0] addr;
+reg signed [15:0] dataReg;
+
+reg signed [15:0] mem1 [7:0];
+reg signed [15:0] mem2 [7:0];
+ 
+
+initial begin 
+    // mem1[0] = -27;
+    // mem1[1] =615;
+    // mem1[2] = 1015;
+    // mem1[3] = -1512;
+    // mem1[4]  = -5803;
+    // mem1[5]  = -2223;
+    // mem1[6]  =  14818;
+    // mem1[7]  =  32767;
+    mem1[0]  =  -38;
+    mem1[1]  =  646;
+    mem1[2] =  1106;
+    mem1[3] =  -1507;
+    mem1[4] =  -6135;
+    mem1[5] =  -2817;
+    mem1[6] =  14421;
+    mem1[7] =  32767;
+end
+
+
+    // integer file;
+    // initial begin
+    //     file = $fopen("C:/S5243_FFT_REPO/src/src/FftDataFiltering/mem_init1.txt", "r");
+    //     if (file == 0) begin
+    //         $display("Error: file not found");
+    //         $finish;
+    //     end
+    //     while (!$feof(file)) begin
+    //         $fscanf(file, "%d\n", mem1);
+    //     end
+    //     $fclose(file);
+    // end
+
+
+
+always @(posedge Clk_i) begin 
+    if (Rst_i) begin 
+        addr <= 5'h0;
+    end
+    else begin 
+        if (ReadEn_i) begin 
+            addr <= addr + 1;
+        end
+    end
+end
+
+always @(*) begin 
+    if (Rst_i) begin
+        dataReg = 16'h0;
+    end
+    else begin 
+        if (ReadEn_i) begin 
+            dataReg = mem1[addr];
+        end
+    end
+end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+endmodule

+ 8 - 0
src/src/FftDataFiltering/mem_init1.txt

@@ -0,0 +1,8 @@
+-27,
+615,
+1015,
+-1512,
+-5803,
+-2223,
+14818,
+32767,

+ 8 - 0
src/src/FftDataFiltering/mem_init2.txt

@@ -0,0 +1,8 @@
+-27,
+615,
+1015,
+-1512,
+-5803,
+-2223,
+14818,
+32767,

+ 6 - 5
src/src/Sim/DecimFilterWrapperTb.v

@@ -16,8 +16,7 @@ real	signal;
 
 reg		[31:0]	tbCnt;
 reg		[31:0]	pNumCnt;
-// wire	oscWind	=	(tbCnt>=4500&tbCnt<=5499)?	1'b1:1'b0;
-wire	oscWind	=	(tbCnt>=4500&tbCnt<=4999)?	1'b1:1'b0;
+wire	oscWind	=	(tbCnt>=4500&tbCnt<=4999)?	1'b1:1'b0 ||(tbCnt>=5500&tbCnt<=5999)?	1'b1:1'b0  ;
 
 wire	signed	[13:0]	ncoSin1;
 wire	signed	[13:0]	ncoCos1;
@@ -58,6 +57,8 @@ initial begin
 	decimFactor	=	3'd2;
 #100;
 	Rst		=	1'b0;
+	#105000;
+	decimFactor = 3'd1;
 end	
 
 always	@(posedge	Clk50)	begin
@@ -153,8 +154,8 @@ DecimFilter
 	.IfFtwL_i		(24'h51eb85),
 	.IfFtwH_i		(24'h23),
 	
-	.AdcData_i		(singlePulse),
-	// .AdcData_i		(sinAdd),
+	// .AdcData_i		(singlePulse),
+	.AdcData_i		(sinAdd),
 	// .AdcData_i		(adcDataMixedCut),
 	
 	.FilteredAdcDataI_o	(resultI),
@@ -227,7 +228,7 @@ always	@(posedge	Clk50)	begin
 		if	(oscWind)	begin
 			// $display("AdcData is %d", sinAdd);
 			// $fwrite(inSignal,"%d\n",   sinAdd);
-			$fwrite(inSignal,"%d\n",   singlePulse);
+			$fwrite(inSignal,"%d\n",   sinAdd);
 		end	
 	end	
 end

+ 583 - 247
src/src/Sim/FilteredData.txt

@@ -1,250 +1,586 @@
      0
      0
-     0
-     0
-     2
-    -8
-     5
-    31
-  -107
-   135
+    -1
+   -12
+   -26
     16
-  -463
-  1120
-  1120
-  -463
-    16
-   135
-  -107
-    31
-     5
-    -8
-     2
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
-     0
+   146
+   159
+  -301
+ -1127
+ -1405
+  -396
+  1117
+  1367
+   -76
+ -1410
+  -853
+   861
+  1388
+    -1
+ -1391
+  -860
+   856
+  1388
+    -1
+ -1390
+  -860
+   857
+  1387
+    -1
+ -1390
+  -860
+   857
+  1387
+    -2
+ -1391
+  -859
+   857
+  1388
+    -3
+ -1391
+  -860
+   858
+  1388
+    -1
+ -1391
+  -860
+   856
+  1388
+    -1
+ -1390
+  -860
+   857
+  1387
+    -1
+ -1390
+  -860
+   857
+  1387
+    -2
+ -1391
+  -859
+   857
+  1388
+    -3
+ -1391
+  -860
+   858
+  1388
+    -1
+ -1391
+  -860
+   856
+  1388
+    -1
+ -1390
+  -860
+   857
+  1387
+    -1
+ -1390
+  -860
+   857
+  1387
+    -2
+ -1391
+  -859
+   857
+  1388
+    -3
+ -1391
+  -860
+   858
+  1388
+    -1
+ -1391
+  -860
+   856
+  1388
+    -1
+ -1390
+  -860
+   857
+  1387
+    -1
+ -1390
+  -860
+   857
+  1387
+    -2
+ -1391
+  -859
+   857
+  1388
+    -3
+ -1391
+  -860
+   858
+  1388
+    -1
+ -1391
+  -860
+   856
+  1388
+    -1
+ -1390
+  -860
+   857
+  1387
+    -1
+ -1390
+  -860
+   857
+  1387
+    -2
+ -1391
+  -859
+   857
+  1388
+    -3
+ -1391
+  -860
+   858
+  1388
+    -1
+ -1391
+  -860
+   856
+  1388
+    -1
+ -1390
+  -860
+   857
+  1387
+    -1
+ -1390
+  -860
+   857
+  1387
+    -2
+ -1391
+  -859
+   857
+  1388
+    -3
+ -1391
+  -860
+   858
+  1388
+    -1
+ -1391
+  -860
+   856
+  1388
+    -1
+ -1390
+  -860
+   857
+  1387
+    -1
+ -1390
+  -860
+   857
+  1387
+    -2
+ -1391
+  -859
+   857
+  1388
+    -3
+ -1391
+  -860
+   858
+  1388
+    -1
+ -1391
+  -860
+   856
+  1388
+    -1
+ -1390
+  -860
+   857
+  1387
+    -1
+ -1390
+  -860
+   857
+  1387
+    -2
+ -1391
+  -859
+   857
+  1388
+    -3
+ -1391
+  -860
+   858
+  1388
+    -1
+ -1391
+  -860
+   856
+  1388
+    -1
+ -1390
+  -860
+   857
+  1387
+    -1
+ -1390
+  -860
+   857
+  1387
+    -2
+ -1391
+  -859
+   857
+  1388
+    -3
+ -1391
+  -860
+   858
+  1388
+    -1
+ -1391
+  -860
+   856
+  1388
+    -1
+ -1439
+  -890
+   888
+  1527
+   108
+ -1733
+ -1718
+   908
+  4100
+  4463
+  1031
+ -2566
+ -1927
+  2629
+  6382
+  6030
+  2895
+   129
+  -882
+  -813
+  -484
+  -124
+   276
+   466
+   393
+   273
+   201
+   -35
+  -421
+  -581
+  -347
+   -25
+   128
+   254
+   464
+   496
+   158
+  -263
+  -407
+  -350
+  -332
+  -254
+    85
+   478
+   535
+   282
+    60
+   -61
+  -283
+  -537
+  -479
+   -86
+   253
+   331
+   349
+   405
+   262
+  -160
+  -498
+  -465
+  -256
+  -129
+    24
+   345
+   579
+   420
+    33
+  -203
+  -274
+  -394
+  -470
+  -227
+   226
+   469
+   393
+   273
+   201
+   -35
+  -421
+  -581
+  -347
+   -25
+   128
+   254
+   464
+   496
+   158
+  -263
+  -407
+  -350
+  -332
+  -254
+    85
+   478
+   535
+   282
+    60
+   -61
+  -283
+  -537
+  -479
+   -86
+   253
+   331
+   349
+   405
+   262
+  -160
+  -498
+  -465
+  -256
+  -129
+    24
+   345
+   579
+   420
+    33
+  -203
+  -274
+  -394
+  -470
+  -227
+   226
+   469
+   393
+   273
+   201
+   -35
+  -421
+  -581
+  -347
+   -25
+   128
+   254
+   464
+   496
+   158
+  -263
+  -407
+  -350
+  -332
+  -254
+    85
+   478
+   535
+   282
+    60
+   -61
+  -283
+  -537
+  -479
+   -86
+   253
+   331
+   349
+   405
+   262
+  -160
+  -498
+  -465
+  -256
+  -129
+    24
+   345
+   579
+   420
+    33
+  -203
+  -274
+  -394
+  -470
+  -227
+   226
+   469
+   393
+   273
+   201
+   -35
+  -421
+  -581
+  -347
+   -25
+   128
+   254
+   464
+   496
+   158
+  -263
+  -407
+  -350
+  -332
+  -254
+    85
+   478
+   535
+   282
+    60
+   -61
+  -283
+  -537
+  -479
+   -86
+   253
+   331
+   349
+   405
+   262
+  -160
+  -498
+  -465
+  -256
+  -129
+    24
+   345
+   579
+   420
+    33
+  -203
+  -274
+  -394
+  -470
+  -227
+   226
+   469
+   393
+   273
+   201
+   -35
+  -421
+  -581
+  -347
+   -25
+   128
+   254
+   464
+   496
+   158
+  -263
+  -407
+  -350
+  -332
+  -254
+    85
+   478
+   535
+   282
+    60
+   -61
+  -283
+  -537
+  -479
+   -86
+   253
+   331
+   349
+   405
+   262
+  -160
+  -498
+  -465
+  -256
+  -129
+    24
+   345
+   579
+   420
+    33
+  -203
+  -274
+  -394
+  -470
+  -227
+   226
+   469
+   393
+   273
+   201
+   -35
+  -421
+  -581
+  -347
+   -25
+   128
+   254
+   464
+   496
+   158
+  -263
+  -407
+  -350
+  -332
+  -254
+    85
+   478
+   535
+   282
+    60
+   -61
+  -283
+  -537
+  -479
+   -86
+   253
+   331
+   349
+   405
+   262
+  -160
+  -498
+  -465
+  -256
+  -129
+    24
+   345
+   579
+   420
+    33
+  -203
+  -274
+  -394
+  -470
+  -227
+   226
+   469
+   393
+   273
+   201
+   -35
+  -421
+  -581
+  -347
+   -25
+   128
+   254
+   464
+ 

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 586 - 500
src/src/Sim/InputSignal.txt


+ 18 - 18
src/src/Sim/KapitanovScriptForCicComp.m

@@ -52,7 +52,7 @@ clear all;
 %  ---- CIC Filter Parameters
 %  ------------------------------------------------------------------------
 
-R = 2;         % Decimation factor
+R = 4;         % Decimation factor
 N = 8;         % Number of stages
 M = 1;         % Differential delay (only 1)
 
@@ -100,23 +100,23 @@ Hcic = abs((sin(pi*M*R*ff) ./ sin(pi*ff))).^N;
 Hcicdb = 20 * log10(abs(Hcic));
 
 
-##figure('name','Cic Response', 'Numbertitle', 'off')
-##plot(ff, Hcicdb - max(Hcicdb), '-.', 'LineWidth', 2, 'Color',[0 0 1]);
-##
-##title([{'Cic Response'};{sprintf('Fo = %i',Fo)}]);
-##xlabel ('Freq (\pi x rad / samples)');
-##ylabel ('Magnitude');
-##axis tight;
-##grid on;
-##
-##figure('name','Cic Response', 'Numbertitle', 'off')
-##plot(ff, HCICdb - max(HCICdb), '-.', 'LineWidth', 2, 'Color',[0 0 1]);
-##
-##title([{'Cic Response'};{sprintf('Fo = %i',Fo)}]);
-##xlabel ('Freq (\pi x rad / samples)');
-##ylabel ('Magnitude');
-##axis tight;
-##grid on;
+% ##figure('name','Cic Response', 'Numbertitle', 'off')
+% ##plot(ff, Hcicdb - max(Hcicdb), '-.', 'LineWidth', 2, 'Color',[0 0 1]);
+% ##
+% ##title([{'Cic Response'};{sprintf('Fo = %i',Fo)}]);
+% ##xlabel ('Freq (\pi x rad / samples)');
+% ##ylabel ('Magnitude');
+% ##axis tight;
+% ##grid on;
+% ##
+% ##figure('name','Cic Response', 'Numbertitle', 'off')
+% ##plot(ff, HCICdb - max(HCICdb), '-.', 'LineWidth', 2, 'Color',[0 0 1]);
+% ##
+% ##title([{'Cic Response'};{sprintf('Fo = %i',Fo)}]);
+% ##xlabel ('Freq (\pi x rad / samples)');
+% ##ylabel ('Magnitude');
+% ##axis tight;
+% ##grid on;
 
 fp = [0:STEP:Fo]; % Pass band frequency dots
 fs = [(Fo+STEP):STEP:0.5]; % Stop band frequency dots

+ 3 - 1
src/src/Sim/S5243TopSpectrumTb.v

@@ -41,7 +41,7 @@ module S5243TopSpectrumTb;
 	localparam	[1:0]	CURRADCCHANNEL	=	2'h3;
 	//COMMANDS	FOR REG_MAP
 	// parameter	[31:0]	MeasCmdBypass	=	{8'h11,8'h0,8'h63,7'h1,1'h1};
-	parameter	[31:0]	MeasCmdFft 		=	{8'h11,8'h0,8'h63,7'h1,1'b1};
+	parameter	[31:0]	MeasCmdFft 		=	{8'h11,8'h0,8'h63,7'h2,1'b1};
 	parameter	[31:0]	AdcCtrl =	{8'h12,24'h2};
 	parameter	[31:0]	SensCtrlCmd =	{1'b0,21'h0,CURRADCCHANNEL,4'h0,4'h1};
 	parameter	[31:0]	DitherCmd 	= {8'h0E,8'd9,4'h0,4'h1,4'd11,4'h3};
@@ -385,6 +385,8 @@ always	@(posedge	Clk41)	begin
 			DspSpiData		<=	MeasNum1RegCmd;
 		end else	if	(cmdCnt	==	3)	begin
 			DspSpiData		<=	SensCtrlCmd;
+		end else	if	(cmdCnt == 113) begin 
+			DspSpiData <= {8'h11,8'h0,8'h63,7'h4,1'b1};
 		end
 	end	else	if	(txCurrState	==	TX)	begin
 		DspSpiData	<=	DspSpiData<<1;

+ 14 - 14
src/src/Sim/fir_filter.coe

@@ -1,19 +1,19 @@
 Radix = 10;
 Coefficient_Width = 16;
 Coefdata =
--27,
-615,
-1015,
--1512,
--5803,
--2223,
-14818,
+-38,
+646,
+1106,
+-1507,
+-6135,
+-2817,
+14421,
 32767,
 32767,
-14818,
--2223,
--5803,
--1512,
-1015,
-615,
--27;
+14421,
+-2817,
+-6135,
+-1507,
+1106,
+646,
+-38;