瀏覽代碼

Доработан механизм подготовки данных для FFT. Если КоэффициентДецимации <= 1, данные пропускаются как есть (режим осциллографа?), если коэффициентДецимации >= 2, то данные пропускаются через фильтр-дециматор.

Stepan Churbanov 2 年之前
父節點
當前提交
586e308709

文件差異過大導致無法顯示
+ 1 - 49
S5443_M/S5443.srcs/constrs_1/new/S5443Top.xdc


二進制
S5443_M/S5443.srcs/sources_1/ip/MeasDataFifo/MeasDataFifo.dcp


+ 0 - 7
S5443_M/S5443.srcs/sources_1/ip/MeasDataFifo/MeasDataFifo.xci

@@ -554,10 +554,6 @@
             <xilinx:configElementInfo xilinx:referenceId="BUSIFPARAM_VALUE.S_AXIS.HAS_TREADY" xilinx:valueSource="auto"/>
             <xilinx:configElementInfo xilinx:referenceId="BUSIFPARAM_VALUE.S_AXIS.TDATA_NUM_BYTES" xilinx:valueSource="auto"/>
             <xilinx:configElementInfo xilinx:referenceId="PARAM_VALUE.Data_Count_Width" xilinx:valueSource="user"/>
-            <xilinx:configElementInfo xilinx:referenceId="PARAM_VALUE.Dout_Reset_Value" xilinx:valueSource="user"/>
-            <xilinx:configElementInfo xilinx:referenceId="PARAM_VALUE.Enable_Safety_Circuit" xilinx:valueSource="user"/>
-            <xilinx:configElementInfo xilinx:referenceId="PARAM_VALUE.Fifo_Implementation" xilinx:valueSource="user"/>
-            <xilinx:configElementInfo xilinx:referenceId="PARAM_VALUE.Full_Flags_Reset_Value" xilinx:valueSource="user"/>
             <xilinx:configElementInfo xilinx:referenceId="PARAM_VALUE.Full_Threshold_Assert_Value" xilinx:valueSource="user"/>
             <xilinx:configElementInfo xilinx:referenceId="PARAM_VALUE.Full_Threshold_Negate_Value" xilinx:valueSource="user"/>
             <xilinx:configElementInfo xilinx:referenceId="PARAM_VALUE.Input_Data_Width" xilinx:valueSource="user"/>
@@ -565,9 +561,6 @@
             <xilinx:configElementInfo xilinx:referenceId="PARAM_VALUE.Output_Data_Width" xilinx:valueSource="user"/>
             <xilinx:configElementInfo xilinx:referenceId="PARAM_VALUE.Output_Depth" xilinx:valueSource="user"/>
             <xilinx:configElementInfo xilinx:referenceId="PARAM_VALUE.Read_Data_Count_Width" xilinx:valueSource="user"/>
-            <xilinx:configElementInfo xilinx:referenceId="PARAM_VALUE.Reset_Pin" xilinx:valueSource="user"/>
-            <xilinx:configElementInfo xilinx:referenceId="PARAM_VALUE.Reset_Type" xilinx:valueSource="user"/>
-            <xilinx:configElementInfo xilinx:referenceId="PARAM_VALUE.Use_Dout_Reset" xilinx:valueSource="user"/>
             <xilinx:configElementInfo xilinx:referenceId="PARAM_VALUE.Write_Data_Count_Width" xilinx:valueSource="user"/>
           </xilinx:configElementInfos>
           <xilinx:boundaryDescriptionInfo>

文件差異過大導致無法顯示
+ 12459 - 12459
S5443_M/S5443.srcs/sources_1/ip/MeasDataFifo/MeasDataFifo_sim_netlist.v


文件差異過大導致無法顯示
+ 13681 - 13680
S5443_M/S5443.srcs/sources_1/ip/MeasDataFifo/MeasDataFifo_sim_netlist.vhdl


+ 1 - 1
S5443_M/S5443.srcs/sources_1/ip/MeasDataFifo/MeasDataFifo_stub.v

@@ -1,7 +1,7 @@
 // Copyright 1986-2020 Xilinx, Inc. All Rights Reserved.
 // --------------------------------------------------------------------------------
 // Tool Version: Vivado v.2020.2 (win64) Build 3064766 Wed Nov 18 09:12:45 MST 2020
-// Date        : Wed Sep 14 10:24:19 2022
+// Date        : Fri Aug 25 12:40:35 2023
 // Host        : DESKTOP-RMARCDV running 64-bit major release  (build 9200)
 // Command     : write_verilog -force -mode synth_stub -rename_top MeasDataFifo -prefix
 //               MeasDataFifo_ MeasDataFifo_stub.v

+ 1 - 0
S5443_M/S5443.srcs/sources_1/ip/MeasDataFifo/MeasDataFifo_stub.vhdl

@@ -1,7 +1,7 @@
 -- Copyright 1986-2020 Xilinx, Inc. All Rights Reserved.
 -- --------------------------------------------------------------------------------
 -- Tool Version: Vivado v.2020.2 (win64) Build 3064766 Wed Nov 18 09:12:45 MST 2020
+-- Date        : Fri Aug 25 12:40:35 2023
 -- Host        : DESKTOP-RMARCDV running 64-bit major release  (build 9200)
 -- Command     : write_vhdl -force -mode synth_stub -rename_top MeasDataFifo -prefix
 --               MeasDataFifo_ MeasDataFifo_stub.vhdl

+ 26 - 23
S5443_M/S5443.srcs/sources_1/new/ExtDspInterface/DspInterface.v

@@ -247,20 +247,20 @@ DecimFilterWrapper	DecimFilter
 	.FilteredDataVal_o	(filteredDecimDataVal)
 );
 
-FftDataFormer	FftDataFormerInst
-(
-	.Clk_i				(Clk_i), 
-	.Rst_i				(Rst_i),	
-	.OscWind_i			(OscWind_i),
-	.MeasNum_i			(MeasNum_i),
+// FftDataFormer	FftDataFormerInst
+// (
+	// .Clk_i				(Clk_i), 
+	// .Rst_i				(Rst_i),	
+	// .OscWind_i			(OscWind_i),
+	// .MeasNum_i			(MeasNum_i),
 	
-	.AdcData_i			({filteredDecimDataI,filteredDecimDataQ}),
+	// .AdcData_i			({filteredDecimDataI,filteredDecimDataQ}),
 	// .AdcData_i			({testPatternData,testPatternData}),
-	.AdcDataVal_i		(filteredDecimDataVal),
+	// .AdcDataVal_i		(filteredDecimDataVal),
 	
-	.OscDataBus_o		(fftDataBus),
-	.OscDataBusVal_o	(fftDataBusVal)
-);
+	// .OscDataBus_o		(fftDataBus),
+	// .OscDataBusVal_o	(fftDataBusVal)
+// );
 
 // decimBlock	
 // #(	
@@ -278,25 +278,28 @@ FftDataFormer	FftDataFormerInst
 	// .DataValid_o	(currDataChannelDecimVal)
 // );
 
-// OscDataFormer	DecimDataFormer
-// (
-	// .Clk_i				(Clk_i), 
-	// .Rst_i				(Rst_i),	
-	// .OscWind_i			(OscWind_i),
-	// .MeasNum_i			(MeasNum_i),
+OscDataFormer	DecimDataFormer
+(
+	.Clk_i				(Clk_i), 
+	.Rst_i				(Rst_i),	
+	.OscWind_i			(OscWind_i),
+	.MeasNum_i			(MeasNum_i),
 	
 	// .AdcDataVal_i		(currDataChannelDecimVal),
-	// .AdcData_i			(currDataChannelDecim),	
+	// .AdcData_i			(currDataChannelDecim),
 	
-	// .OscDataBus_o		(decimDataBus),
-	// .OscDataBusVal_o	(decimDataBusVal)
-// );
+	.AdcDataVal_i		(filteredDecimDataVal),
+	.AdcData_i			(filteredDecimDataI),	
+	
+	.OscDataBus_o		(decimDataBus),
+	.OscDataBusVal_o	(decimDataBusVal)
+);
 
 always	@(posedge	Clk_i)	begin
 	if	(!Rst_i)	begin
 		if	(Mode_i)	begin
-			dataForFifo		<=	fftDataBus;
-			dataForFifoVal	<=	fftDataBusVal;
+			dataForFifo		<=	decimDataBus;
+			dataForFifoVal	<=	decimDataBusVal;
 		end	else	begin
 			dataForFifo		<=	measDataBus;
 			dataForFifoVal	<=	LpOutStart_i;

+ 14 - 103
S5443_M/S5443.srcs/sources_1/new/FftDataFiltering/DecimFilterWrapper.v

@@ -84,11 +84,9 @@ module	DecimFilterWrapper
 //================================================================================
 
 	assign	FilteredAdcDataI_o	=	outDataI;
-	// assign	FilteredAdcDataI_o	=	decimDataI;
 	assign	FilteredAdcDataQ_o	=	outDataQ;
-	// assign	FilteredAdcDataQ_o	=	decimDataQ;
-	// assign	FilteredDataVal_o	=	decimDataValIR&decimDataValQR;
-	assign	FilteredDataVal_o	=	decimDataValI&decimDataValQ;
+
+	assign	FilteredDataVal_o	=	decimDataValI;
 
 
 // {{14{AdcData_i[AdcDataWidth-1]}},AdcData_i}
@@ -100,6 +98,18 @@ module	DecimFilterWrapper
 always	@(posedge	Clk_i)	begin
 	if	(!Rst_i)	begin
 		case(DecimFactor_i)
+			3'd0:	begin
+						outDataI	<=	AdcData_i;
+						outDataQ	<=	AdcData_i;
+						decimDataValIR	<=	OscWind_i;
+						decimDataValQR	<=	OscWind_i;
+					end
+			3'd1:	begin
+						outDataI	<=	AdcData_i;
+						outDataQ	<=	AdcData_i;
+						decimDataValIR	<=	OscWind_i;
+						decimDataValQR	<=	OscWind_i;
+					end
 			3'd2:	begin
 						outDataI	<=	decimDataI[maxWidthForR2-:16];
 						outDataQ	<=	decimDataQ[maxWidthForR2-:16];
@@ -145,74 +155,6 @@ always	@(posedge	Clk_i)	begin
 	end
 end
 
-always	@(posedge	Clk_i)	begin
-	if	(!Rst_i)	begin
-		ifFtwLReg	<=	IfFtwL_i;
-		ifFtwHReg	<=	IfFtwH_i;
-	end	else	begin
-		ifFtwLReg	<=	0;
-		ifFtwHReg	<=	0;
-	end
-end
-
-CordicNco		
-#(	
-	.ODatWidth	(14),
-	.PhIncWidth	(32),
-	.IterNum	(10),
-	.EnSinN		(1)
-)
-ncoInst
-(
-	.Clk_i		(Clk_i),
-	.Rst_i		(Rst_i),
-	.Val_i		(1'b1),
-	.PhaseInc_i	({ifFtwHReg[0+:32-24],ifFtwLReg}),
-	// .PhaseInc_i	(32'h3eb851eb),
-	.WindVal_i	(1'b1),
-	.WinType_i	(),
-	.Wind_o		(),
-	.Sin_o		(ncoSin),
-	.Cos_o		(ncoCos),
-	.Val_o		()
-);
-
-SimpleMult	
-#(	
-	.FactorAWidth	(AdcDataWidth),
-	.FactorBWidth	(AdcDataWidth),
-	.OutputWidth	(AdcDataWidth)
-)
-AdcNcoSinMult	
-(
-	.Rst_i		(Rst_i),
-	.Clk_i		(Clk_i),
-	.Val_i		(1'b1),
-	.FactorA_i	(ncoSin),
-	.FactorB_i	(AdcData_i),	
-	// .FactorB_i	(ncoSin),	
-	.Result_o	(adcSinResult),
-	.ResultVal_o(adcSinVal)
-);
-
-SimpleMult	
-#(	
-	.FactorAWidth	(AdcDataWidth),
-	.FactorBWidth	(AdcDataWidth),
-	.OutputWidth	(AdcDataWidth)
-)
-AdcNcoCosMult	
-(
-	.Rst_i		(Rst_i),
-	.Clk_i		(Clk_i),
-	.Val_i		(1'b1),
-	.FactorA_i	(ncoCos),
-	.FactorB_i	(AdcData_i),
-	// .FactorB_i	(ncoSin),
-	.Result_o	(adcCosResult),
-	.ResultVal_o(adcCosVal)
-);
-
 cicFilter 
 #(
 	.N (N),	//filter order
@@ -226,43 +168,12 @@ cicFilterInstI
 	.Clk_i			(Clk_i),
 	.Rst_i			(Rst_i),
 	.DecimFactor_i	(DecimFactor_i),
-	// .Data_i			({{15{adcCosResult[AdcDataWidth-1]}},adcCosResult}),
 	.Data_i			({{15{AdcData_i[AdcDataWidth-1]}},AdcData_i}),
 	.DataNd_i		(OscWind_i),
 	.Data_o			(decimDataI),
 	.DataValid_o	(decimDataValI)
 );
 
-cicFilter 
-#(
-	.N (N),	//filter order
-	.M (M),	//comb delay
-	.filteredDataWidth	(FilteredDataWidth),
-	.inOutDataWidth		(FilteredDataWidth),
-	.decimCntWidth		(7)
-)
-cicFilterInstQ
-(
-	.Clk_i			(Clk_i),
-	.Rst_i			(Rst_i),
-	.DecimFactor_i	(DecimFactor_i),
-	// .Data_i			({{15{adcSinResult[AdcDataWidth-1]}},adcSinResult}),
-	.Data_i			({{15{AdcData_i[AdcDataWidth-1]}},AdcData_i}),
-	.DataNd_i		(OscWind_i),
-	.Data_o			(decimDataQ),
-	.DataValid_o	(decimDataValQ)
-);
-  
-// fir_compiler_0 firCompensator 
-// (
-	// .aclk	(Clk_i),
-	// .s_axis_data_tvalid	(decimDataVal),
-	// .s_axis_data_tready	(),
-	// .s_axis_data_tdata	({{3{decimData[FilteredDataWidth-1]}},decimData}),
-	// .m_axis_data_tvalid	(firDataOutVal),
-	// .m_axis_data_tdata	(firDataOut)
-// );
-
 endmodule
 
 

+ 1 - 1
S5443_M/S5443.srcs/sources_1/new/FftDataFiltering/DecimFilterWrapperTb.v

@@ -49,7 +49,7 @@ parameter	M	=	1;
 initial begin
 	Clk50		=	1'b1;
 	Rst			=	1'b1;
-	decimFactor	=	3'd4;
+	decimFactor	=	3'd2;
 #100;
 	Rst		=	1'b0;
 end		

+ 496 - 246
S5443_M/S5443.srcs/sources_1/new/FilteredData.txt

@@ -1,250 +1,500 @@
     -1
-   -12
-   -38
-   -44
-   -20
-    44
-   138
-   236
-   294
-   269
-   137
-   -98
-  -390
-  -656
-  -799
-  -736
+    -1
+    -2
+    -2
+    -4
+    -2
+    -2
+    -3
+     5
+     1
+    12
+    13
+    14
+    30
+    17
+    33
+    27
+    16
+    31
+    -7
+     7
+   -18
+   -45
+   -27
+   -87
+   -59
+   -84
+  -105
+   -52
+  -109
+   -36
+   -36
+   -34
+    67
+    12
+   123
+   124
+   117
+   226
+   118
+   213
+   159
+    89
+   164
+   -33
+    33
+   -77
+  -191
+  -107
+  -337
+  -221
+  -301
+  -367
+  -177
+  -357
+  -115
+  -112
+  -101
+   200
+    36
+   346
+   343
+   317
+   598
+   306
+   544
+   399
+   219
+   396
+   -79
+    78
+  -176
   -434
-    71
-   675
-  1218
-  1527
-  1464
-   974
-   121
-  -909
- -1856
- -2442
- -2452
- -1799
-  -567
-   984
-  2468
-  3471
-  3664
-  2907
-  1298
-  -826
- -2960
- -4533
- -5066
- -4315
- -2363
-   366
-  3230
-  5498
-  6530
-  5948
-  3772
-   451
- -3225
- -6322
- -7989
- -7734
- -5481
- -1670
-  2816
-  6852
-  9361
-  9612
-  7426
-  3234
- -2007
- -7005
--10487
--11465
- -9560
- -5136
-   780
-  6754
- 11282
- 13159
- 11777
-  7320
-   861
- -6054
--11683
--14567
--13894
- -9702
- -2914
-  4846
- 11632
- 15625
- 15834
- 12077
-  5194
- -3184
--11006
--16283
--17595
--14504
- -7706
-  1158
-  9872
- 16316
- 18830
- 16677
- 10291
-  1199
- -8342
--15941
--19686
--18596
--12803
- -3810
-  6277
- 14928
- 19942
- 20030
- 15142
-  6456
- -3923
--13444
--19721
--21015
--17178
- -9049
-  1348
- 11450
- 18768
- 21444
- 18810
- 11499
-  1327
- -9159
--17358
--21266
--19936
--13690
- -4037
-  6592
- 15535
- 20566
- 20471
- 15419
-  6515
- -3923
--13323
--19366
--20562
--16656
- -8696
-  1284
- 10805
- 17552
- 20003
- 17413
- 10560
-  1209
- -8271
--15534
--18855
--17506
--11902
- -3481
-  5660
- 13228
- 17365
- 17139
- 12731
-  5333
- -3184
--10719
--15446
--16255
--13051
+  -238
+  -745
+  -483
+  -649
+  -782
+  -371
+  -743
+  -237
+  -227
+  -202
+   399
+    72
+   677
+   665
+   608
+  1138
+   578
+  1018
+   741
+   403
+   724
+  -143
+   141
+  -314
+  -768
+  -419
+ -1302
+  -838
+ -1119
+ -1339
+  -631
+ -1255
+  -398
+  -379
+  -336
+   659
+   119
+  1107
+  1080
+   983
+  1831
+   926
+  1622
+  1174
+   637
+  1137
+  -223
+   220
+  -487
+ -1186
+  -644
+ -1993
+ -1277
+ -1699
+ -2024
+  -951
+ -1884
+  -595
+  -565
+  -498
+   976
+   176
+  1627
+  1583
+  1436
+  2664
+  1343
+  2344
+  1692
+   915
+  1629
+  -318
+   313
+  -690
+ -1675
+  -907
+ -2799
+ -1788
+ -2373
+ -2820
+ -1321
+ -2611
+  -822
+  -779
+  -685
+  1339
+   241
+  2221
+  2155
+  1950
+  3610
+  1816
+  3163
+  2277
+  1228
+  2182
+  -424
+   419
+  -919
+ -2228
+ -1203
+ -3707
+ -2364
+ -3130
+ -3713
+ -1735
+ -3424
+ -1076
+ -1017
+  -893
+  1743
+   313
+  2880
+  2789
+  2515
+  4648
+  2334
+  4057
+  2917
+  1570
+  2785
+  -541
+   533
+ -1168
+ -2824
+ -1523
+ -4685
+ -2983
+ -3943
+ -4670
+ -2179
+ -4294
+ -1347
+ -1272
+ -1114
+  2173
+   389
+  3580
+  3462
+  3123
+  5763
+  2890
+  5016
+  3601
+  1937
+  3430
+  -665
+   654
+ -1432
+ -3459
+ -1863
+ -5724
+ -3640
+ -4805
+ -5684
+ -2643
+ -5202
+ -1629
+ -1537
+ -1345
+  2619
+   469
+  4306
+  4159
+  3747
+  6907
+  3459
+  5998
+  4301
+  2310
+  4087
+  -791
+   778
+ -1701
+ -4104
+ -2208
  -6776
-   991
-  8265
- 13300
- 14944
- 12885
+ -4304
+ -5677
+ -6708
+ -3123
+ -6140
+ -1921
+ -1810
+ -1582
+  3080
+   551
+  5052
+  4875
+  4388
+  8081
+  4043
+  7004
+  5018
+  2693
+  4759
+  -920
+   902
+ -1969
+ -4748
+ -2551
+ -7825
+ -4966
+ -6543
+ -7725
+ -3594
+ -7059
+ -2207
+ -2077
+ -1814
+  3528
+   630
+  5778
+  5571
+  5010
+  9218
+  4608
+  7976
+  5710
+  3062
+  5406
+ -1045
+  1026
+ -2238
+ -5391
+ -2895
+ -8871
+ -5625
+ -7406
+ -8737
+ -4061
+ -7971
+ -2490
+ -2342
+ -2044
+  3972
+   709
+  6495
+  6257
+  5606
+ 10306
+  5148
+  8904
+  6370
+  3413
+  6022
+ -1163
+  1141
+ -2487
+ -5987
+ -3213
+ -9839
+ -6234
+ -8203
+ -9669
+ -4492
+ -8810
+ -2750
+ -2585
+ -2254
+  4378
+   781
+  7149
+  6883
+  6182
+ 11357
+  5670
+  9801
+  7006
+  3751
+  6615
+ -1276
+  1252
+ -2727
+ -6560
+ -3518
+-10766
+ -6817
+ -8964
+-10560
+ -4884
+ -9573
+ -2986
+ -2806
+ -2445
+  4746
+   846
   7739
-   877
- -5942
--11049
--13315
--12234
- -8230
- -2381
-  3814
-  8817
- 11445
- 11167
-  8200
-  3394
- -2002
- -6675
- -9498
- -9868
- -7819
- -3992
-   576
-  4736
-  7513
-  8319
-  7066
-  4188
-   467
- -3115
- -5695
- -6726
- -6072
- -4011
- -1139
-  1789
-  4055
-  5165
-  4934
-  3544
-  1434
-  -826
- -2681
- -3718
- -3762
- -2900
- -1438
-   201
-  1606
-  2465
-  2636
-  2159
-  1229
-   131
-  -842
- -1471
- -1656
- -1421
-  -889
-  -239
-   351
-   744
-   880
-   777
-   512
-   188
-   -98
-  -284
-  -346
-  -303
-  -198
-   -81
-     9
-    54
-    59
-    41
-    18
-     4
-     0
-    -1
+  7447
+  6684
+ 12272
+  6123
+ 10577
+  7557
+  4044
+  7127
+ -1374
+  1347
+ -2932
+ -7050
+ -3778
+-11556
+ -7313
+ -9611
+-11316
+ -5250
+-10285
+ -3207
+ -3011
+ -2622
+  5087
+   906
+  8286
+  7968
+  7148
+ 13118
+  6541
+ 11293
+  8064
+  4313
+  7596
+ -1464
+  1428
+ -3106
+ -7465
+ -3998
+-12223
+ -7731
+-10154
+-11949
+ -5541
+-10848
+ -3380
+ -3172
+ -2761
+  5354
+   954
+  8711
+  8373
+  7507
+ 13768
+  6862
+ 11841
+  8450
+  4517
+  7952
+ -1531
+  1500
+ -3261
+ -7832
+ -4193
+-12811
+ -8099
+-10632
+-12504
+ -5795
+-11341
+ -3532
+ -3313
+ -2882
+  5586
+   994
+  9080
+  8722
+  7777
+ 14257
+  7102
+ 12248
+  8736
+  4668
+  8212
+ -1581
+  1548
+ -3362
+ -8072
+ -4319
+-13191
+ -8335
+-10936
+-12855
+ -5955
+-11648
+ -3626
+ -3399
+ -2956
+  5725
+  1019
+  9297
+  8926
+  7996
+ 14649
+  7294
+ 12573
+  8964
+  4787
+  8418
+ -1620
+  1585
+ -3442
+ -8259
+ -4417
+-13483
+ -8515
+-11162
+-13107
+ -6041
+-11809
+ -3674
+ -3443
+ -2992
+  5793
+  1030
+  9398
+  9019
+  8074
+ 14781
+  7353
+ 12665
+  9022
+  4814
+  8460
+ -1626
+  1590
+ -3451
+ -8276
+ -4423
+-13493

+ 0 - 1
S5443_M/S5443.srcs/sources_1/new/InternalDsp/InternalDsp.v

@@ -264,7 +264,6 @@ WinParameters
 Win_calc	WinCalcInst
 (
 	.clk_i			(Clk_i),
-	.wind_clk		(WindCalcClk_i),
 	.filterCmd_i	(measCtrlReg[15-:8]),
 	.reset_i		(Rst_i),
 	.WinCtrl_i		(winCtrl),

+ 9 - 9
S5443_M/S5443.srcs/sources_1/new/S5443Top.v

@@ -698,15 +698,15 @@ ExternalDspInterface
 	
 	.OscDataRdFlag_o	(oscDataRdFlag),
 	
-	// .Adc1ChT1Data_i		(adc1ChT1Data),	
-	// .Adc1ChR1Data_i		(adc1ChR1Data),	
-	// .Adc2ChR2Data_i		(adc2ChR2Data),	
-	// .Adc2ChT2Data_i		(adc2ChT2Data),		
-	
-	.Adc1ChT1Data_i		(AdcData_i),	
-	.Adc1ChR1Data_i		(AdcData_i),	
-	.Adc2ChR2Data_i		(AdcData_i),	
-	.Adc2ChT2Data_i		(AdcData_i),		
+	.Adc1ChT1Data_i		(adc1ChT1Data),	
+	.Adc1ChR1Data_i		(adc1ChR1Data),	
+	.Adc2ChR2Data_i		(adc2ChR2Data),	
+	.Adc2ChT2Data_i		(adc2ChT2Data),		
+	
+	// .Adc1ChT1Data_i		(AdcData_i),	
+	// .Adc1ChR1Data_i		(AdcData_i),	
+	// .Adc2ChR2Data_i		(AdcData_i),	
+	// .Adc2ChT2Data_i		(AdcData_i),		
 	
 	.Mosi_o				(adcInitMosi),
 	.Sck_o				(adcInitSck),

+ 58 - 276
S5443_M/S5443.srcs/sources_1/new/S5443TopSpectrumTb.v

@@ -30,38 +30,7 @@
 
 //=============================================================================================================
 module S5443TopSpectrumTb;
-	
-	localparam	[4:0]	EP1MUXCMD	=	5'd14;
-	localparam	[4:0]	EP2MUXCMD	=	5'd1;
-	localparam	[4:0]	EP3MUXCMD	=	5'd1;
-	localparam	[4:0]	EP4MUXCMD	=	5'd1;
-	localparam	[4:0]	EP5MUXCMD	=	5'd1;
-	localparam	[4:0]	EP6MUXCMD	=	5'd1;
-	
-	localparam	[4:0]	PG1MUXCMD	=	5'd13;
-	localparam	[4:0]	PG2MUXCMD	=	5'd0;
-	localparam	[4:0]	PG3MUXCMD	=	5'd18;
-	localparam	[4:0]	PG4MUXCMD	=	5'd18;
-	localparam	[4:0]	PG5MUXCMD	=	5'd0;
-	localparam	[4:0]	PG6MUXCMD	=	5'd0;
-	localparam	[4:0]	PG7MUXCMD	=	5'd0;
-	
-	localparam	[2:0]	PG1MODE	=	3'd5;
-	localparam	[2:0]	PG2MODE	=	3'd1;
-	localparam	[2:0]	PG3MODE	=	3'd3;
-	localparam	[2:0]	PG4MODE	=	3'd4;
-	localparam	[2:0]	PG5MODE	=	3'd0;
-	localparam	[2:0]	PG6MODE	=	3'd0;
-	localparam	[2:0]	PG7MODE	=	3'd3;
-	
-	localparam	PG1POL	=	1'b0;
-	localparam	PG2POL	=	1'b0;
-	localparam	PG3POL	=	1'b0;
-	localparam	PG4POL	=	1'b0;
-	localparam	PG5POL	=	1'b0;
-	localparam	PG6POL	=	1'b0;
-	localparam	PG7POL	=	1'b0;
-	
+
 	localparam	[4:0]	EXTTRIGMUXCMD	=	5'd15;
 	localparam	[4:0]	DSPTRIGINCMD	=	5'h8;
 	localparam	[4:0]	MUXSLOWMODCMD	=	5'd1;
@@ -71,100 +40,18 @@ module S5443TopSpectrumTb;
 	
 	localparam	[1:0]	CURRADCCHANNEL	=	2'b0;
 	//COMMANDS	FOR REG_MAP
-	parameter	[31:0]	MeasCmdBypass	=	{8'h11,8'h0,8'h63,8'h1};
-	parameter	[31:0]	MeasCmdFft 		=	{8'h11,8'h0,8'h63,7'h1,1'b1};
-	parameter	[31:0]	MeasCmd 		=	{8'h11,8'h0,8'h53,8'h0};
-	// parameter	[31:0]	MeasCmd =	{8'h11,8'h3e,8'h63,8'h0};
+	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]	AdcCtrl =	{8'h12,24'h2};
 	parameter	[31:0]	SensCtrlCmd =	{1'b0,21'h0,CURRADCCHANNEL,4'h0,4'b1};
-	// parameter	[31:0]	DitherCmd 	= {8'h0E,24'h100192};
 	parameter	[31:0]	DitherCmd 	= {8'h0E,8'd9,4'h0,4'h1,4'd11,4'h3};
 	parameter	[31:0]	IfFtwH 	=	{8'h15,16'h0,8'h40};
 	parameter	[31:0]	IfFtwL 	=	{8'h16,24'h000000};
 	parameter	[31:0]	FilterCorrCmdH 		=	{8'h17,24'hD70A3D};
 	parameter	[31:0]	FilterCorrCmdL 		=	{8'h18,24'hD70A3D};
-	
-	//PG7 Cmd
-	parameter	[31:0]	PG7P1DelayRegCmd	=	{8'h20,24'd0};
-	parameter	[31:0]	PG7P2DelayRegCmd	=	{8'h21,24'd1};
-	parameter	[31:0]	PG7P3DelayRegCmd	=	{8'h22,24'd5};
-	parameter	[31:0]	PG7P123DelayRegCmd	=	{8'h23,24'd15};
-	parameter	[31:0]	PG7P1WidthRegCmd	=	{8'h24,24'd1};
-	parameter	[31:0]	PG7P2WidthRegCmd	=	{8'h25,24'd3};
-	parameter	[31:0]	PG7P3WidthRegCmd	=	{8'h26,24'd5};
-	parameter	[31:0]	PG7P123WidthRegCmd	=	{8'h27,24'd0};
-
-	//PG1 Cmd
-	parameter	[31:0]	PG1P1DelayRegCmd	=	{8'h28,24'd0};
-	parameter	[31:0]	PG1P2DelayRegCmd	=	{8'h29,24'd400};
-	parameter	[31:0]	PG1P3DelayRegCmd	=	{8'h2a,24'd0};
-	parameter	[31:0]	PG1P123DelayRegCmd	=	{8'h2b,24'd0};
-	parameter	[31:0]	PG1P1WidthRegCmd	=	{8'h2c,24'd1};
-	parameter	[31:0]	PG1P2WidthRegCmd	=	{8'h2d,24'd0};
-	parameter	[31:0]	PG1P3WidthRegCmd	=	{8'h2e,24'd0};
-	parameter	[31:0]	PG1P123WidthRegCmd	=	{8'h2f,24'd0};
-	
-	//PG2 Cmd
-	parameter	[31:0]	PG2P1DelayRegCmd	=	{8'h20,24'd0};
-	parameter	[31:0]	PG2P2DelayRegCmd	=	{8'h21,24'd1};
-	parameter	[31:0]	PG2P3DelayRegCmd	=	{8'h22,24'd5};
-	parameter	[31:0]	PG2P123DelayRegCmd	=	{8'h23,24'd15};
-	parameter	[31:0]	PG2P1WidthRegCmd	=	{8'h24,24'd1};
-	parameter	[31:0]	PG2P2WidthRegCmd	=	{8'h25,24'd3};
-	parameter	[31:0]	PG2P3WidthRegCmd	=	{8'h26,24'd5};
-	parameter	[31:0]	PG2P123WidthRegCmd	=	{8'h27,24'd0};
-	
-	//PG3 Cmd
-	parameter	[31:0]	PG3P1DelayRegCmd	=	{8'h20,24'd0};
-	parameter	[31:0]	PG3P2DelayRegCmd	=	{8'h21,24'd1};
-	parameter	[31:0]	PG3P3DelayRegCmd	=	{8'h22,24'd5};
-	parameter	[31:0]	PG3P123DelayRegCmd	=	{8'h23,24'd15};
-	parameter	[31:0]	PG3P1WidthRegCmd	=	{8'h24,24'd1};
-	parameter	[31:0]	PG3P2WidthRegCmd	=	{8'h25,24'd3};
-	parameter	[31:0]	PG3P3WidthRegCmd	=	{8'h26,24'd5};
-	parameter	[31:0]	PG3P123WidthRegCmd	=	{8'h27,24'd0};
-	
-	//PG4 Cmd
-	parameter	[31:0]	PG4P1DelayRegCmd	=	{8'h40,24'd0};
-	parameter	[31:0]	PG4P2DelayRegCmd	=	{8'h41,24'd18};
-	parameter	[31:0]	PG4P3DelayRegCmd	=	{8'h42,24'd0};
-	parameter	[31:0]	PG4P123DelayRegCmd	=	{8'h43,24'd0};
-	parameter	[31:0]	PG4P1WidthRegCmd	=	{8'h44,24'd1};
-	parameter	[31:0]	PG4P2WidthRegCmd	=	{8'h45,24'd10};
-	parameter	[31:0]	PG4P3WidthRegCmd	=	{8'h46,24'd7};
-	parameter	[31:0]	PG4P123WidthRegCmd	=	{8'h47,24'd0};
-	
-	//PG5 Cmd
-	parameter	[31:0]	PG5P1DelayRegCmd	=	{8'h48,24'd0};
-	parameter	[31:0]	PG5P2DelayRegCmd	=	{8'h49,24'd0};
-	parameter	[31:0]	PG5P3DelayRegCmd	=	{8'h4a,24'd0};
-	parameter	[31:0]	PG5P123DelayRegCmd	=	{8'h4b,24'd0};
-	parameter	[31:0]	PG5P1WidthRegCmd	=	{8'h4c,24'd0};
-	parameter	[31:0]	PG5P2WidthRegCmd	=	{8'h4d,24'd0};
-	parameter	[31:0]	PG5P3WidthRegCmd	=	{8'h4e,24'd0};
-	parameter	[31:0]	PG5P123WidthRegCmd	=	{8'h4f,24'd0};
-	
-	//PG6 Cmd
-	parameter	[31:0]	PG6P1DelayRegCmd	=	{8'h50,24'd0};
-	parameter	[31:0]	PG6P2DelayRegCmd	=	{8'h51,24'd5};
-	parameter	[31:0]	PG6P3DelayRegCmd	=	{8'h52,24'd15};
-	parameter	[31:0]	PG6P123DelayRegCmd	=	{8'h53,24'd0};
-	parameter	[31:0]	PG6P1WidthRegCmd	=	{8'h54,24'd1};
-	parameter	[31:0]	PG6P2WidthRegCmd	=	{8'h55,24'd3};
-	parameter	[31:0]	PG6P3WidthRegCmd	=	{8'h56,24'd5};
-	parameter	[31:0]	PG6P123WidthRegCmd	=	{8'h57,24'd0};
-	
 	parameter	[31:0]	MeasNum0RegCmd		=	{8'h58,24'd10};
 	parameter	[31:0]	MeasNum1RegCmd		=	{8'h59,MUXSLOWMODCMD,MUXFASTMODCMD,DSPTRIGINCMD,25'd0};
-	parameter	[31:0]	PGMode0RegCmd		=	{8'h0b,3'b0,PG7MODE,PG6MODE,PG5MODE,PG4MODE,PG3MODE,PG2MODE,PG1MODE};
-	parameter	[31:0]	PGMode1RegCmd		=	{8'h1b,7'b0000000,PG7POL,PG6POL,PG5POL,PG4POL,PG3POL,PG2POL,PG1POL,10'h0};
-	
-	parameter	[31:0]	MuxCtrl1RegCmd	=	{8'h1c,4'h0,PG7MUXCMD,PG6MUXCMD,PG5MUXCMD,PG4MUXCMD};
-	parameter	[31:0]	MuxCtrl2RegCmd	=	{8'h1d,4'h0,PG3MUXCMD,PG2MUXCMD,PG1MUXCMD,SMPLSTRBMUXCMD};
-	parameter	[31:0]	MuxCtrl3RegCmd	=	{8'h1e,4'h0,GATINGMUXCMD,EXTTRIGMUXCMD,EP2MUXCMD,EP1MUXCMD};
-	parameter	[31:0]	MuxCtrl4RegCmd	=	{8'h1f,4'h0,EP6MUXCMD,EP5MUXCMD,EP4MUXCMD,EP3MUXCMD};
-	
-	//=================================================================================================================================================================================================================
+	//===========================================================================================
 	
 	reg		Clk41;
 	reg		Clk50;
@@ -205,6 +92,13 @@ module S5443TopSpectrumTb;
 	assign	trig0R	=	trig0;
     assign	trig1R	=	trig1;
 	
+	wire	signed	[13:0]	ncoSin1;
+	wire	signed	[13:0]	ncoCos1;
+	wire	signed	[13:0]	ncoSin2;
+	wire	signed	[13:0]	ncoCos2;
+	
+	wire	signed	[13:0]	sinAdd	=	(ncoSin1>>>1)+(ncoSin2>>>1);
+	
 //==========================================================================================
 //clocks gen
 	always	#10 Clk50	=	~Clk50;
@@ -277,23 +171,52 @@ always @ (posedge Clk50)
 		else
 			Data_i = 0;
 	end
-
-integer handle1;
-reg[7:0]	myVar;
-
-initial	begin
-
-handle1 = $fopen("InputSignal.txt");
-$fdisplay(handle1,"Chirp signal samples");
-	if	(tb_cnt>=4500	&	tb_cnt<=5000)	begin
-		$fdisplayh(handle1,Data_i);
-	end
-$fclose(handle1);
-
-end
 		
 wire	[31:0]	test	=	32'h2351eb85;
 // wire	[31:0]	test	=	32'h40000000;
+
+CordicNco		
+#(	
+	.ODatWidth	(14),
+	.PhIncWidth	(32),
+	.IterNum	(10),
+	.EnSinN		(1)
+)
+ncoInst1
+(
+	.Clk_i		(Clk50),
+	.Rst_i		(rst),
+	.Val_i		(1'b1),
+	.PhaseInc_i	(32'h51eb851),
+	.WindVal_i	(1'b1),
+	.WinType_i	(),
+	.Wind_o		(),
+	.Sin_o		(ncoSin1),
+	.Cos_o		(ncoCos1),
+	.Val_o		()
+);
+
+CordicNco		
+#(	
+	.ODatWidth	(14),
+	.PhIncWidth	(32),
+	.IterNum	(10),
+	.EnSinN		(1)
+)
+ncoInst2
+(
+	.Clk_i		(Clk50),
+	.Rst_i		(rst),
+	.Val_i		(1'b1),
+	.PhaseInc_i	(32'h33333333),
+	.WindVal_i	(1'b1),
+	.WinType_i	(),
+	.Wind_o		(),
+	.Sin_o		(ncoSin2),
+	.Cos_o		(ncoCos2),
+	.Val_o		()
+);
+
 CordicNco		
 #(	.ODatWidth	(18),
 	.PhIncWidth	(32),
@@ -313,7 +236,6 @@ ncoInst
 	.Val_o				()
 );
 
-
 S5443Top MasterFpga 
 (
 	.Clk_i				(Clk50),
@@ -387,8 +309,8 @@ S5443Top MasterFpga
 	.DspReadyForRxToFpgaS_o	(),
 	.AmpEn_o				(),	//	0-adc1ChA 1-adc1ChB 2-adc2ChA 3-adc2ChB
 	// .AdcData_i				(sin_value[17-:14])
-	.AdcData_i			(DelpaPulse)
-	// .AdcData_i			(Data_i)
+	// .AdcData_i			(DelpaPulse)
+	.AdcData_i			(sinAdd)
 );
 
 parameter	IDLE	=	2'h0;
@@ -444,154 +366,14 @@ always	@(posedge	Clk41)	begin
 	end
 end
 	
-
 always	@(posedge	Clk41)	begin
 	if	(txCurrState	==	CMD)	begin
 		if	(cmdCnt	==	0)	begin
-			// DspSpiData		<=	MeasCmd;
-			DspSpiData		<=	SensCtrlCmd;
+			DspSpiData		<=	MeasCmdBypass;
 		end	else	if	(cmdCnt	==	1)	begin
-			DspSpiData		<=	IfFtwH;
-		end	else	if	(cmdCnt	==	2)	begin
-			DspSpiData		<=	IfFtwL;
-		end	else	if	(cmdCnt	==	3)	begin
-			DspSpiData		<=	FilterCorrCmdH;
-		end	else	if	(cmdCnt	==	4)	begin
-			DspSpiData		<=	FilterCorrCmdL;
-		end	else	if	(cmdCnt	==	5)	begin
-			DspSpiData		<=	PG1P1DelayRegCmd;
-		end	else	if	(cmdCnt	==	6)	begin
-			DspSpiData		<=	PG1P2DelayRegCmd;
-		end	else	if	(cmdCnt	==	7)	begin
-			DspSpiData		<=	PG1P3DelayRegCmd;
-		end	else	if	(cmdCnt	==	8)	begin
-			DspSpiData		<=	PG1P123DelayRegCmd;
-		end	else	if	(cmdCnt	==	9)	begin
-			DspSpiData		<=	PG1P1WidthRegCmd;
-		end	else	if	(cmdCnt	==	10)	begin
-			DspSpiData		<=	PG1P2WidthRegCmd;
-		end	else	if	(cmdCnt	==	11)	begin
-			DspSpiData		<=	PG1P3WidthRegCmd;
-		end	else	if	(cmdCnt	==	12)	begin
-			DspSpiData		<=	PG1P123WidthRegCmd;
-		end	else	if	(cmdCnt	==	13)	begin
-			DspSpiData		<=	PG2P1DelayRegCmd;
-		end	else	if	(cmdCnt	==	14)	begin
-			DspSpiData		<=	PG2P2DelayRegCmd;
-		end	else	if	(cmdCnt	==	15)	begin
-			DspSpiData		<=	PG2P3DelayRegCmd;	
-		end	else	if	(cmdCnt	==	16)	begin
-			DspSpiData		<=	PG2P123DelayRegCmd;
-		end	else	if	(cmdCnt	==	17)	begin
-			DspSpiData		<=	PG2P1WidthRegCmd;
-		end	else	if	(cmdCnt	==	18)	begin
-			DspSpiData		<=	PG2P2WidthRegCmd;
-		end	else	if	(cmdCnt	==	19)	begin
-			DspSpiData		<=	PG2P3WidthRegCmd;
-		end	else	if	(cmdCnt	==	20)	begin
-			DspSpiData		<=	PG2P123WidthRegCmd;
-		end	else	if	(cmdCnt	==	21)	begin
-			DspSpiData		<=	PG3P1DelayRegCmd;
-		end	else	if	(cmdCnt	==	22)	begin
-			DspSpiData		<=	PG3P2DelayRegCmd;
-		end	else	if	(cmdCnt	==	23)	begin
-			DspSpiData		<=	PG3P3DelayRegCmd;	
-		end	else	if	(cmdCnt	==	24)	begin
-			DspSpiData		<=	PG3P123DelayRegCmd;
-		end	else	if	(cmdCnt	==	25)	begin
-			DspSpiData		<=	PG3P1WidthRegCmd;
-		end	else	if	(cmdCnt	==	26)	begin
-			DspSpiData		<=	PG3P2WidthRegCmd;
-		end	else	if	(cmdCnt	==	27)	begin
-			DspSpiData		<=	PG3P3WidthRegCmd;
-		end	else	if	(cmdCnt	==	28)	begin
-			DspSpiData		<=	PG3P123WidthRegCmd;
-		end	else	if	(cmdCnt	==	29)	begin
-			DspSpiData		<=	PG4P1DelayRegCmd;
-		end	else	if	(cmdCnt	==	30)	begin
-			DspSpiData		<=	PG4P2DelayRegCmd;
-		end	else	if	(cmdCnt	==	31)	begin
-			DspSpiData		<=	PG4P3DelayRegCmd;	
-		end	else	if	(cmdCnt	==	32)	begin
-			DspSpiData		<=	PG4P123DelayRegCmd;
-		end	else	if	(cmdCnt	==	33)	begin
-			DspSpiData		<=	PG4P1WidthRegCmd;
-		end	else	if	(cmdCnt	==	34)	begin
-			DspSpiData		<=	PG4P2WidthRegCmd;
-		end	else	if	(cmdCnt	==	35)	begin
-			DspSpiData		<=	PG4P3WidthRegCmd;
-		end	else	if	(cmdCnt	==	36)	begin
-			DspSpiData		<=	PG4P123WidthRegCmd;
-		end	else	if	(cmdCnt	==	37)	begin
-			DspSpiData		<=	PG5P1DelayRegCmd;
-		end	else	if	(cmdCnt	==	38)	begin
-			DspSpiData		<=	PG5P2DelayRegCmd;
-		end	else	if	(cmdCnt	==	39)	begin
-			DspSpiData		<=	PG5P3DelayRegCmd;	
-		end	else	if	(cmdCnt	==	40)	begin
-			DspSpiData		<=	PG5P123DelayRegCmd;
-		end	else	if	(cmdCnt	==	41)	begin
-			DspSpiData		<=	PG5P1WidthRegCmd;
-		end	else	if	(cmdCnt	==	42)	begin
-			DspSpiData		<=	PG5P2WidthRegCmd;
-		end	else	if	(cmdCnt	==	43)	begin
-			DspSpiData		<=	PG5P3WidthRegCmd;
-		end	else	if	(cmdCnt	==	44)	begin
-			DspSpiData		<=	PG5P123WidthRegCmd;
-		end	else	if	(cmdCnt	==	45)	begin
-			DspSpiData		<=	PG6P1DelayRegCmd;
-		end	else	if	(cmdCnt	==	46)	begin
-			DspSpiData		<=	PG6P2DelayRegCmd;
-		end	else	if	(cmdCnt	==	47)	begin
-			DspSpiData		<=	PG6P3DelayRegCmd;	
-		end	else	if	(cmdCnt	==	48)	begin
-			DspSpiData		<=	PG6P123DelayRegCmd;
-		end	else	if	(cmdCnt	==	49)	begin
-			DspSpiData		<=	PG6P1WidthRegCmd;
-		end	else	if	(cmdCnt	==	50)	begin
-			DspSpiData		<=	PG6P2WidthRegCmd;
-		end	else	if	(cmdCnt	==	51)	begin
-			DspSpiData		<=	PG6P3WidthRegCmd;
-		end	else	if	(cmdCnt	==	52)	begin
-			DspSpiData		<=	PG6P123WidthRegCmd;
-		end	else	if	(cmdCnt	==	53)	begin
-			DspSpiData		<=	PG7P1DelayRegCmd;
-		end	else	if	(cmdCnt	==	54)	begin
-			DspSpiData		<=	PG7P2DelayRegCmd;
-		end	else	if	(cmdCnt	==	55)	begin
-			DspSpiData		<=	PG7P3DelayRegCmd;	
-		end	else	if	(cmdCnt	==	56)	begin
-			DspSpiData		<=	PG7P123DelayRegCmd;
-		end	else	if	(cmdCnt	==	57)	begin
-			DspSpiData		<=	PG7P1WidthRegCmd;
-		end	else	if	(cmdCnt	==	58)	begin
-			DspSpiData		<=	PG7P2WidthRegCmd;
-		end	else	if	(cmdCnt	==	59)	begin
-			DspSpiData		<=	PG7P3WidthRegCmd;
-		end	else	if	(cmdCnt	==	60)	begin
-			DspSpiData		<=	DitherCmd;
-		end	else	if	(cmdCnt	==	61)	begin
 			DspSpiData		<=	MeasNum0RegCmd;
-		end else	if	(cmdCnt	==	62)	begin
+		end	else	if	(cmdCnt	==	2)	begin
 			DspSpiData		<=	MeasNum1RegCmd;
-		end else	if	(cmdCnt	==	63)	begin
-			DspSpiData		<=	PGMode0RegCmd;
-		end	else	if	(cmdCnt	==	64)	begin
-			DspSpiData		<=	PGMode1RegCmd;
-		end	else	if	(cmdCnt	==	65)	begin
-			DspSpiData		<=	MuxCtrl1RegCmd;
-		end	else	if	(cmdCnt	==	66)	begin
-			DspSpiData		<=	MuxCtrl2RegCmd;
-		end	else	if	(cmdCnt	==	67)	begin
-			DspSpiData		<=	MuxCtrl3RegCmd;
-		end	else	if	(cmdCnt	==	68)	begin
-			DspSpiData		<=	AdcCtrl;
-		end	else	if	(cmdCnt	==	99)	begin
-			DspSpiData		<=	{8'h58,24'd100};
-		end	else	if	(cmdCnt	==	100)	begin
-			DspSpiData		<=	MeasCmdFft;
-		end else	begin
-			DspSpiData	<=	32'hfffffff;
 		end
 	end	else	if	(txCurrState	==	TX)	begin
 		DspSpiData	<=	DspSpiData<<1;