|
@@ -25,7 +25,7 @@ wire signed [13:0] ncoSin1;
|
|
|
wire signed [13:0] ncoSin2;
|
|
wire signed [13:0] ncoSin2;
|
|
|
wire signed [13:0] ncoSin3;
|
|
wire signed [13:0] ncoSin3;
|
|
|
|
|
|
|
|
-wire signed [15:0] filteredDataOut;
|
|
|
|
|
|
|
+wire signed [MaxWidth-1:0] filteredDataOut;
|
|
|
wire signed [MaxWidth-1:0] impResponse;
|
|
wire signed [MaxWidth-1:0] impResponse;
|
|
|
|
|
|
|
|
wire resultVal;
|
|
wire resultVal;
|
|
@@ -39,15 +39,13 @@ wire signed [13:0] adcDataMixedCut = adcDataMixed[26-:14];
|
|
|
// wire signed [13:0] sinAdd = (ncoSin1>>>2)+(ncoSin2>>>2)+(ncoSin3>>>2);
|
|
// wire signed [13:0] sinAdd = (ncoSin1>>>2)+(ncoSin2>>>2)+(ncoSin3>>>2);
|
|
|
wire signed [13:0] sinAdd = (ncoSin1>>>1)+(ncoSin2>>>1);
|
|
wire signed [13:0] sinAdd = (ncoSin1>>>1)+(ncoSin2>>>1);
|
|
|
// wire signed [13:0] sinAdd = ncoSin1;
|
|
// wire signed [13:0] sinAdd = ncoSin1;
|
|
|
-wire signed [15:0] sinAddExt16 = {{2{ncoSin2[14-1]}},ncoSin2};
|
|
|
|
|
-wire signed [17:0] sinAddExt18 = {{4{sinAdd[14-1]}},sinAdd};
|
|
|
|
|
|
|
|
|
|
reg signed [13:0] currTestData;
|
|
reg signed [13:0] currTestData;
|
|
|
|
|
|
|
|
wire signed [17:0] wind;
|
|
wire signed [17:0] wind;
|
|
|
|
|
|
|
|
// wire signed [13:0] singlePulse = (tbCnt>=4500&tbCnt<=4550)? 14'h1fff:14'h0;
|
|
// wire signed [13:0] singlePulse = (tbCnt>=4500&tbCnt<=4550)? 14'h1fff:14'h0;
|
|
|
-wire signed [13:0] singlePulse = (tbCnt==4551)? 14'h1fff:14'h0;
|
|
|
|
|
|
|
+wire signed [13:0] singlePulse = (tbCnt==4502)? 14'h1fff:14'h0;
|
|
|
wire signed [17:0] singlePulseExt = (tbCnt==4500)? 18'h1ffff:14'h0;
|
|
wire signed [17:0] singlePulseExt = (tbCnt==4500)? 18'h1ffff:14'h0;
|
|
|
// wire signed [15:0] singlePulseExt = (tbCnt>=4500&tbCnt<=4501)? 16'h7fff:14'h0;
|
|
// wire signed [15:0] singlePulseExt = (tbCnt>=4500&tbCnt<=4501)? 16'h7fff:14'h0;
|
|
|
wire inglePulseExtVal = (tbCnt==4500)? 1:0;
|
|
wire inglePulseExtVal = (tbCnt==4500)? 1:0;
|
|
@@ -56,18 +54,15 @@ wire inglePulseExtVal = (tbCnt==4500)? 1:0;
|
|
|
always #10 Clk50 = ~Clk50;
|
|
always #10 Clk50 = ~Clk50;
|
|
|
|
|
|
|
|
//==========================================================================================
|
|
//==========================================================================================
|
|
|
-parameter N = 8;
|
|
|
|
|
-parameter M = 2;
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+parameter N = 1;
|
|
|
|
|
+parameter M = 1;
|
|
|
|
|
|
|
|
parameter LsbForR1 = 10'd16;
|
|
parameter LsbForR1 = 10'd16;
|
|
|
parameter LsbForR2 = 10'd18;
|
|
parameter LsbForR2 = 10'd18;
|
|
|
parameter LsbForR4 = 10'd18;
|
|
parameter LsbForR4 = 10'd18;
|
|
|
|
|
|
|
|
-parameter [31:0] Nco1PhaseInc = 32'h051eb852; //3mhz
|
|
|
|
|
-parameter [31:0] Nco2PhaseInc = 32'h40000000; //15
|
|
|
|
|
-parameter [31:0] Nco3PhaseInc = 32'h428f5c28;
|
|
|
|
|
|
|
+parameter [31:0] Nco1PhaseInc = 32'h19999999;
|
|
|
|
|
+parameter [31:0] Nco2PhaseInc = 32'h33333333;
|
|
|
|
|
|
|
|
initial begin
|
|
initial begin
|
|
|
Clk50 = 1'b1;
|
|
Clk50 = 1'b1;
|
|
@@ -76,8 +71,6 @@ initial begin
|
|
|
Rst = 1'b0;
|
|
Rst = 1'b0;
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
always @(posedge Clk50) begin
|
|
always @(posedge Clk50) begin
|
|
|
if (!Rst) begin
|
|
if (!Rst) begin
|
|
|
tbCnt <= tbCnt+32'd1;
|
|
tbCnt <= tbCnt+32'd1;
|
|
@@ -188,28 +181,6 @@ ncoInst2
|
|
|
.Val_o ()
|
|
.Val_o ()
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
-CordicNco
|
|
|
|
|
-#(
|
|
|
|
|
- .ODatWidth (14),
|
|
|
|
|
- .PhIncWidth (32),
|
|
|
|
|
- .IterNum (10),
|
|
|
|
|
- .EnSinN (1)
|
|
|
|
|
-)
|
|
|
|
|
-ncoInst3
|
|
|
|
|
-(
|
|
|
|
|
- .Clk_i (Clk50),
|
|
|
|
|
- .Rst_i (Rst),
|
|
|
|
|
- .Val_i (1'b1),
|
|
|
|
|
- .PhaseInc_i (Nco3PhaseInc),
|
|
|
|
|
- .WindVal_i (1'b1),
|
|
|
|
|
- .WinType_i (),
|
|
|
|
|
- .Wind_o (),
|
|
|
|
|
- .Sin_o (ncoSin3),
|
|
|
|
|
- .Cos_o (),
|
|
|
|
|
- .Val_o ()
|
|
|
|
|
-);
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
DecimFilterWrapperTest
|
|
DecimFilterWrapperTest
|
|
|
#(
|
|
#(
|
|
|
.AdcDataWidth (14),
|
|
.AdcDataWidth (14),
|
|
@@ -229,8 +200,8 @@ DecimFilter
|
|
|
.Rst_i (Rst),
|
|
.Rst_i (Rst),
|
|
|
.DataVal_i (oscWind),
|
|
.DataVal_i (oscWind),
|
|
|
|
|
|
|
|
- // .Data_i (sinAdd),
|
|
|
|
|
- .Data_i (adcDataMixedCut),
|
|
|
|
|
|
|
+ .Data_i (sinAdd),
|
|
|
|
|
+ // .Data_i (adcDataMixedCut),
|
|
|
// .Data_i (adcData),
|
|
// .Data_i (adcData),
|
|
|
// .Data_i (ncoSin2),
|
|
// .Data_i (ncoSin2),
|
|
|
|
|
|
|
@@ -262,58 +233,11 @@ ImpulseResponseFilter
|
|
|
.Data_o (impResponse),
|
|
.Data_o (impResponse),
|
|
|
.DataVal_o ()
|
|
.DataVal_o ()
|
|
|
);
|
|
);
|
|
|
-
|
|
|
|
|
-// reg [32-1:0] windArg;
|
|
|
|
|
-// wire [31:0] WindPhInc = 32'h418937<<<decimFactor-2;
|
|
|
|
|
-
|
|
|
|
|
-// always @(posedge Clk50) begin
|
|
|
|
|
- // if (!Rst) begin
|
|
|
|
|
- // if (resultVal) begin
|
|
|
|
|
- // windArg <= windArg+WindPhInc;
|
|
|
|
|
- // end
|
|
|
|
|
- // end else begin
|
|
|
|
|
- // windArg <= WindPhInc>>1;
|
|
|
|
|
- // end
|
|
|
|
|
-// end
|
|
|
|
|
-
|
|
|
|
|
-// reg [1:0] valReg;
|
|
|
|
|
-// always @(posedge Clk50) begin
|
|
|
|
|
- // if (!Rst) begin
|
|
|
|
|
- // valReg[0] <= resultVal;
|
|
|
|
|
- // valReg[1] <= valReg[0];
|
|
|
|
|
- // end else begin
|
|
|
|
|
- // valReg <= 2'b0;
|
|
|
|
|
- // end
|
|
|
|
|
-// end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
integer inSignal,filteredData, impResp;
|
|
integer inSignal,filteredData, impResp;
|
|
|
parameter PNum = 5000;
|
|
parameter PNum = 5000;
|
|
|
|
|
|
|
|
-// wire signed [17:0] firDataOut;
|
|
|
|
|
-// wire signed [17:0] firRespout;
|
|
|
|
|
-// wire firDataVal;
|
|
|
|
|
-// wire firRespVal;
|
|
|
|
|
-
|
|
|
|
|
-// systolicFilter DataFitler (
|
|
|
|
|
- // .Clk_i(Clk50),
|
|
|
|
|
- // .Rst_i(Rst),
|
|
|
|
|
- // .Data_i(sinAddExt18),
|
|
|
|
|
- // .DataNd_i(oscWind),
|
|
|
|
|
- // .Data_o(firDataOut),
|
|
|
|
|
- // .DataValid_o(firDataVal)
|
|
|
|
|
-// );
|
|
|
|
|
-
|
|
|
|
|
-// systolicFilter RespFilter (
|
|
|
|
|
- // .Clk_i(Clk50),
|
|
|
|
|
- // .Rst_i(Rst),
|
|
|
|
|
- // .Data_i(singlePulseExt),
|
|
|
|
|
- // .DataNd_i(oscWind),
|
|
|
|
|
- // .Data_o(firRespout),
|
|
|
|
|
- // .DataValid_o(firRespVal)
|
|
|
|
|
-// );
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
always @(posedge Clk50) begin
|
|
always @(posedge Clk50) begin
|
|
@@ -323,8 +247,8 @@ always @(posedge Clk50) begin
|
|
|
if (oscWind) begin
|
|
if (oscWind) begin
|
|
|
// $display("AdcData is %d", sinAdd);
|
|
// $display("AdcData is %d", sinAdd);
|
|
|
// $fwrite(inSignal,"%d\n", sinAddExt18);
|
|
// $fwrite(inSignal,"%d\n", sinAddExt18);
|
|
|
- $fwrite(inSignal,"%d\n", adcDataMixedCut);
|
|
|
|
|
- // $fwrite(inSignal,"%d\n", adcData);
|
|
|
|
|
|
|
+ // $fwrite(inSignal,"%d\n", adcDataMixedCut);
|
|
|
|
|
+ $fwrite(inSignal,"%d\n", sinAdd);
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
@@ -332,7 +256,7 @@ end
|
|
|
reg [31:0] testCnt;
|
|
reg [31:0] testCnt;
|
|
|
wire [10:0] test = N*2+N*2+decimFactor;
|
|
wire [10:0] test = N*2+N*2+decimFactor;
|
|
|
wire [10:0] test1 = N*2+N*2+decimFactor-1;
|
|
wire [10:0] test1 = N*2+N*2+decimFactor-1;
|
|
|
-wire writeEn = (oscWindDelay[N*2+N*2+decimFactor]);
|
|
|
|
|
|
|
+wire writeEn = (oscWindDelay[N*2+N*2+decimFactor-1]);
|
|
|
|
|
|
|
|
always @(posedge Clk50)begin
|
|
always @(posedge Clk50)begin
|
|
|
if (!Rst) begin
|
|
if (!Rst) begin
|