|
|
@@ -98,12 +98,21 @@ module InternalDsp
|
|
|
|
|
|
wire [WindWidth-1:0] wind;
|
|
|
|
|
|
- wire [NcoWidth-1:0] ncoCos;
|
|
|
- wire [NcoWidth-1:0] ncoSin;
|
|
|
+ wire [NcoWidth-1:0] ncoCosFirstTone;
|
|
|
+ wire [NcoWidth-1:0] ncoSinFirstTone;
|
|
|
+
|
|
|
+ wire [NcoWidth-1:0] ncoCosSecondTone;
|
|
|
+ wire [NcoWidth-1:0] ncoSinSecondTone;
|
|
|
+
|
|
|
+ wire [NcoWidth-1:0] ncoCosMuxedTone [ChNum-1:0];
|
|
|
+ wire [NcoWidth-1:0] ncoSinMuxedTone [ChNum-1:0];
|
|
|
|
|
|
wire [CorrAdcDataWidth-1:0] adcDataBus [ChNum-1:0];
|
|
|
wire [CorrAdcDataWidth-1:0] adcDataBusExt [ChNum-1:0];
|
|
|
wire [CorrAdcDataWidth-1:0] gatedAdcDataBus [ChNum-1:0];
|
|
|
+
|
|
|
+ wire [CorrAdcDataWidth-1:0] AdcDataBusMuxed [ChNum-1:0];
|
|
|
+
|
|
|
wire [CorrAdcDataWidth-1:0] calAdcData [ChNum-1:0];
|
|
|
wire [CorrAdcDataWidth-1:0] prngData;
|
|
|
reg [CorrAdcDataWidth-1:0] prngDataBus [ChNum-1:0];
|
|
|
@@ -139,6 +148,7 @@ module InternalDsp
|
|
|
|
|
|
wire [WindNcoPhIncWidth-1:0] ncoPhInc = {ifFtwHReg[0+:WindNcoPhIncWidth-CmdDataRegWith],ifFtwLReg};
|
|
|
|
|
|
+ wire grDelayMeasFlag = 1'b1;
|
|
|
//================================================================================
|
|
|
// ASSIGNMENTS
|
|
|
|
|
|
@@ -171,8 +181,8 @@ module InternalDsp
|
|
|
assign MeasDataRdy_o = &resultValBus;
|
|
|
assign EndMeas_o = stopMeas;
|
|
|
|
|
|
- assign NcoCos_o = ncoCos;
|
|
|
- assign NcoSin_o = ncoSin;
|
|
|
+ assign NcoCos_o = ncoCosFirstTone;
|
|
|
+ assign NcoSin_o = ncoSinFirstTone;
|
|
|
assign MeasWind_o = measWind;
|
|
|
|
|
|
assign CalModeDone_o = &calDone;
|
|
|
@@ -296,7 +306,28 @@ CordicNco
|
|
|
.IterNum (13),
|
|
|
.EnSinN (0)
|
|
|
)
|
|
|
-ncoInst
|
|
|
+ncoInstFirstTone
|
|
|
+(
|
|
|
+ .Clk_i (Clk_i),
|
|
|
+ .Rst_i (Rst_i|NcoRst_i),
|
|
|
+ .Val_i (1'b1),
|
|
|
+ .PhaseInc_i ({ifFtwHReg[0+:WindNcoPhIncWidth-CmdDataRegWith],ifFtwLReg}),
|
|
|
+ .WindVal_i (1'b1),
|
|
|
+ .WinType_i (),
|
|
|
+ .Wind_o (),
|
|
|
+ .Sin_o (ncoSinFirstTone),
|
|
|
+ .Cos_o (ncoCosFirstTone),
|
|
|
+ .Val_o ()
|
|
|
+);
|
|
|
+
|
|
|
+CordicNco
|
|
|
+#(
|
|
|
+ .ODatWidth (NcoWidth),
|
|
|
+ .PhIncWidth (WindNcoPhIncWidth),
|
|
|
+ .IterNum (13),
|
|
|
+ .EnSinN (0)
|
|
|
+)
|
|
|
+ncoInstSecondTone
|
|
|
(
|
|
|
.Clk_i (Clk_i),
|
|
|
.Rst_i (Rst_i|NcoRst_i),
|
|
|
@@ -305,8 +336,8 @@ ncoInst
|
|
|
.WindVal_i (1'b1),
|
|
|
.WinType_i (),
|
|
|
.Wind_o (),
|
|
|
- .Sin_o (ncoSin),
|
|
|
- .Cos_o (ncoCos),
|
|
|
+ .Sin_o (ncoSinSecondTone),
|
|
|
+ .Cos_o (ncoCosSecondTone),
|
|
|
.Val_o ()
|
|
|
);
|
|
|
|
|
|
@@ -351,41 +382,107 @@ generate
|
|
|
.CalibratedAdcData_o (calAdcData[g])
|
|
|
);
|
|
|
|
|
|
- DspPipeline
|
|
|
- #(
|
|
|
- .AdcDataWidth (AdcDataWidth),
|
|
|
- .AccWidth (AccWidth),
|
|
|
- .WindWidth (WindWidth),
|
|
|
- .NcoWidth (NcoWidth),
|
|
|
- .ResultWidth (ResultWidth),
|
|
|
- .WindCorrCoefWidth (WindCorrCoefWidth),
|
|
|
- .WindNormCoefWidth (WindNormCoefWidth),
|
|
|
- .IntermediateWidth (IntermediateWidth)
|
|
|
- )
|
|
|
- DspPipelineInst
|
|
|
- (
|
|
|
- .Clk_i (Clk_i),
|
|
|
- .Rst_i (Rst_i),
|
|
|
- .Val_i (measWind),
|
|
|
- .MeasWindEnd_i (measWindEnd),
|
|
|
- .StartFpConv_i (measWindEnd),
|
|
|
-
|
|
|
- .FilterCorrCoef_i ({filterCorrCoefHReg[0+:WindNcoPhIncWidth-CmdDataRegWith],filterCorrCoefLReg}),
|
|
|
- // .FilterCorrCoef_i (32'h3f800000),
|
|
|
- .AverageNoizeLvl_i (averageNoizeLvl),
|
|
|
- .AdcData_i (gatedAdcDataBus[g]),
|
|
|
- // .AdcData_i ({{2{ncoCos[17]}},ncoCos}),
|
|
|
- .Wind_i (wind),
|
|
|
- .NcoSin_i (ncoSin),
|
|
|
- .NcoCos_i (ncoCos),
|
|
|
- .NormCoef_i (windNormCoef),
|
|
|
- // .NormCoef_i (32'h3f800000),
|
|
|
- // .NormCoef_i (32'h3f03993a),
|
|
|
-
|
|
|
- .CorrResultIm_o (resultImBus[g]),
|
|
|
- .CorrResultRe_o (resultReBus[g]),
|
|
|
- .CorrResultVal_o (resultValBus[g])
|
|
|
- );
|
|
|
+ if (g==2||g==ChNum-1) begin
|
|
|
+ GrDelModeMux
|
|
|
+ #(
|
|
|
+ .AdcDataWidth (CorrAdcDataWidth),
|
|
|
+ .NcoDataWidth (NcoWidth)
|
|
|
+ )
|
|
|
+ GrDelModeMux
|
|
|
+ (
|
|
|
+ .Rst_i (Rst_i),
|
|
|
+
|
|
|
+ .MuxCtrl_i (grDelayMeasFlag),
|
|
|
+
|
|
|
+ .AdcDataOrig_i (gatedAdcDataBus[g]),
|
|
|
+ .AdcDataGrDel_i (gatedAdcDataBus[g-2]),
|
|
|
+
|
|
|
+ .NcoSinOrig_i (ncoSinFirstTone),
|
|
|
+ .NcoCosOrig_i (ncoCosFirstTone),
|
|
|
+ .NcoSinGrDel_i (ncoSinSecondTone),
|
|
|
+ .NcoCosGrDel_i (ncoCosSecondTone),
|
|
|
+
|
|
|
+ .MuxAdcData_o (AdcDataBusMuxed[g]),
|
|
|
+ .MuxNcoSin_o (ncoSinMuxedTone[g]),
|
|
|
+ .MuxNcoCos_o (ncoCosMuxedTone[g])
|
|
|
+ );
|
|
|
+ end
|
|
|
+
|
|
|
+ if (g==2||g==ChNum-1) begin
|
|
|
+ DspPipeline
|
|
|
+ #(
|
|
|
+ .AdcDataWidth (AdcDataWidth),
|
|
|
+ .AccWidth (AccWidth),
|
|
|
+ .WindWidth (WindWidth),
|
|
|
+ .NcoWidth (NcoWidth),
|
|
|
+ .ResultWidth (ResultWidth),
|
|
|
+ .WindCorrCoefWidth (WindCorrCoefWidth),
|
|
|
+ .WindNormCoefWidth (WindNormCoefWidth),
|
|
|
+ .IntermediateWidth (IntermediateWidth)
|
|
|
+ )
|
|
|
+ DspPipelineInst
|
|
|
+ (
|
|
|
+ .Clk_i (Clk_i),
|
|
|
+ .Rst_i (Rst_i),
|
|
|
+ .Val_i (measWind),
|
|
|
+ .MeasWindEnd_i (measWindEnd),
|
|
|
+ .StartFpConv_i (measWindEnd),
|
|
|
+
|
|
|
+ .FilterCorrCoef_i ({filterCorrCoefHReg[0+:WindNcoPhIncWidth-CmdDataRegWith],filterCorrCoefLReg}),
|
|
|
+ // .FilterCorrCoef_i (32'h3f800000),
|
|
|
+ .AverageNoizeLvl_i (averageNoizeLvl),
|
|
|
+ // .AdcData_i (gatedAdcDataBus[g]),
|
|
|
+ .AdcData_i (AdcDataBusMuxed[g]),
|
|
|
+ // .AdcData_i ({{2{ncoCosFirstTone[17]}},ncoCosFirstTone}),
|
|
|
+ .Wind_i (wind),
|
|
|
+ .NcoSin_i (ncoSinMuxedTone[g]),
|
|
|
+ .NcoCos_i (ncoCosMuxedTone[g]),
|
|
|
+ .NormCoef_i (windNormCoef),
|
|
|
+ // .NormCoef_i (32'h3f800000),
|
|
|
+ // .NormCoef_i (32'h3f03993a),
|
|
|
+
|
|
|
+ .CorrResultIm_o (resultImBus[g]),
|
|
|
+ .CorrResultRe_o (resultReBus[g]),
|
|
|
+ .CorrResultVal_o (resultValBus[g])
|
|
|
+ );
|
|
|
+ end else begin
|
|
|
+ DspPipeline
|
|
|
+ #(
|
|
|
+ .AdcDataWidth (AdcDataWidth),
|
|
|
+ .AccWidth (AccWidth),
|
|
|
+ .WindWidth (WindWidth),
|
|
|
+ .NcoWidth (NcoWidth),
|
|
|
+ .ResultWidth (ResultWidth),
|
|
|
+ .WindCorrCoefWidth (WindCorrCoefWidth),
|
|
|
+ .WindNormCoefWidth (WindNormCoefWidth),
|
|
|
+ .IntermediateWidth (IntermediateWidth)
|
|
|
+ )
|
|
|
+ DspPipelineInst
|
|
|
+ (
|
|
|
+ .Clk_i (Clk_i),
|
|
|
+ .Rst_i (Rst_i),
|
|
|
+ .Val_i (measWind),
|
|
|
+ .MeasWindEnd_i (measWindEnd),
|
|
|
+ .StartFpConv_i (measWindEnd),
|
|
|
+
|
|
|
+ .FilterCorrCoef_i ({filterCorrCoefHReg[0+:WindNcoPhIncWidth-CmdDataRegWith],filterCorrCoefLReg}),
|
|
|
+ // .FilterCorrCoef_i (32'h3f800000),
|
|
|
+ .AverageNoizeLvl_i (averageNoizeLvl),
|
|
|
+ .AdcData_i (gatedAdcDataBus[g]),
|
|
|
+ // .AdcData_i (AdcDataBusMuxed[g]),
|
|
|
+ // .AdcData_i ({{2{ncoCosFirstTone[17]}},ncoCosFirstTone}),
|
|
|
+ .Wind_i (wind),
|
|
|
+ .NcoSin_i (ncoSinFirstTone),
|
|
|
+ .NcoCos_i (ncoCosFirstTone),
|
|
|
+ .NormCoef_i (windNormCoef),
|
|
|
+ // .NormCoef_i (32'h3f800000),
|
|
|
+ // .NormCoef_i (32'h3f03993a),
|
|
|
+
|
|
|
+ .CorrResultIm_o (resultImBus[g]),
|
|
|
+ .CorrResultRe_o (resultReBus[g]),
|
|
|
+ .CorrResultVal_o (resultValBus[g])
|
|
|
+ );
|
|
|
+ end
|
|
|
end
|
|
|
endgenerate
|
|
|
|