|
@@ -18,7 +18,7 @@ real signal;
|
|
|
reg [31:0] tbCnt;
|
|
reg [31:0] tbCnt;
|
|
|
|
|
|
|
|
wire [31:0] startValue = 32'd10;
|
|
wire [31:0] startValue = 32'd10;
|
|
|
-wire [31:0] pNum = 10;
|
|
|
|
|
|
|
+wire [31:0] pNum = 1000;
|
|
|
wire [31:0] stopValue = startValue+pNum-1;
|
|
wire [31:0] stopValue = startValue+pNum-1;
|
|
|
|
|
|
|
|
// wire oscWind = (tbCnt>=10&tbCnt<=509)? 1'b1:1'b0;
|
|
// wire oscWind = (tbCnt>=10&tbCnt<=509)? 1'b1:1'b0;
|
|
@@ -30,12 +30,14 @@ wire signed [13:0] ncoSin3;
|
|
|
|
|
|
|
|
wire signed [MaxWidth-1:0] filteredDataOut;
|
|
wire signed [MaxWidth-1:0] filteredDataOut;
|
|
|
wire signed [MaxWidth-1:0] impResponse;
|
|
wire signed [MaxWidth-1:0] impResponse;
|
|
|
|
|
+wire signed [MaxWidth-1:0] impResponseTest;
|
|
|
|
|
|
|
|
wire resultVal;
|
|
wire resultVal;
|
|
|
wire impRespVal;
|
|
wire impRespVal;
|
|
|
|
|
+wire impRespValTest;
|
|
|
|
|
|
|
|
|
|
|
|
|
-// wire signed [27:0] adcDataMixed = oscWfind?(ncoSin1*ncoSin2):28'd0;
|
|
|
|
|
|
|
+// wire signed [27:0] adcDataMixed = oscWind?(ncoSin1*ncoSin2):28'd0;
|
|
|
wire signed [27:0] adcDataMixed = (ncoSin1*ncoSin2);
|
|
wire signed [27:0] adcDataMixed = (ncoSin1*ncoSin2);
|
|
|
wire signed [13:0] adcDataMixedCut = adcDataMixed[26-:14];
|
|
wire signed [13:0] adcDataMixedCut = adcDataMixed[26-:14];
|
|
|
|
|
|
|
@@ -45,19 +47,20 @@ wire signed [13:0] sinAdd = (ncoSin1>>>1)+(ncoSin2>>>1);
|
|
|
|
|
|
|
|
|
|
|
|
|
// wire signed [13:0] singlePulse = (tbCnt==10)? 14'h1fff:14'h0;
|
|
// wire signed [13:0] singlePulse = (tbCnt==10)? 14'h1fff:14'h0;
|
|
|
-wire signed [13:0] singlePulse = (tbCnt==10)? 14'h1:14'h0;
|
|
|
|
|
-// wire signed [13:0] singlePulse = (tbCnt>=10&tbCnt<=12)? 14'h1fff:14'h0;
|
|
|
|
|
|
|
+// wire signed [15:0] singlePulse = (tbCnt==10)? 16'h1fff:14'h0;
|
|
|
|
|
+// wire signed [15:0] singlePulse = (tbCnt==10)? 16'h1:14'h0;
|
|
|
|
|
+wire signed [15:0] singlePulse = (tbCnt>=10&tbCnt<=11)? 14'h1fff:14'h0;
|
|
|
//==========================================================================================
|
|
//==========================================================================================
|
|
|
//clocks gen
|
|
//clocks gen
|
|
|
always #10 Clk50 = ~Clk50;
|
|
always #10 Clk50 = ~Clk50;
|
|
|
|
|
|
|
|
//==========================================================================================
|
|
//==========================================================================================
|
|
|
-parameter N = 3;
|
|
|
|
|
|
|
+parameter N = 6;
|
|
|
parameter M = 1;
|
|
parameter M = 1;
|
|
|
|
|
|
|
|
always @(posedge Clk50) begin
|
|
always @(posedge Clk50) begin
|
|
|
if (!Rst) begin
|
|
if (!Rst) begin
|
|
|
- decimFactor <= 2;
|
|
|
|
|
|
|
+ decimFactor <= 6;
|
|
|
end else begin
|
|
end else begin
|
|
|
decimFactor <= 0;
|
|
decimFactor <= 0;
|
|
|
end
|
|
end
|
|
@@ -67,7 +70,7 @@ 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'h19999999;
|
|
|
|
|
|
|
+parameter [31:0] Nco1PhaseInc = 32'h051eb851;
|
|
|
parameter [31:0] Nco2PhaseInc = 32'h33333333;
|
|
parameter [31:0] Nco2PhaseInc = 32'h33333333;
|
|
|
|
|
|
|
|
initial begin
|
|
initial begin
|
|
@@ -182,7 +185,7 @@ DecimFilter
|
|
|
|
|
|
|
|
DecimFilterWrapperTest
|
|
DecimFilterWrapperTest
|
|
|
#(
|
|
#(
|
|
|
- .AdcDataWidth (14),
|
|
|
|
|
|
|
+ .AdcDataWidth (16),
|
|
|
.N (N),
|
|
.N (N),
|
|
|
.M (M),
|
|
.M (M),
|
|
|
.FilteredDataWidth (MaxWidth),
|
|
.FilteredDataWidth (MaxWidth),
|
|
@@ -204,10 +207,8 @@ ImpulseResponseFilter
|
|
|
.Data_o (impResponse),
|
|
.Data_o (impResponse),
|
|
|
.DataVal_o (impRespVal)
|
|
.DataVal_o (impRespVal)
|
|
|
);
|
|
);
|
|
|
-
|
|
|
|
|
|
|
|
|
|
integer inSignal,filteredData, impResp;
|
|
integer inSignal,filteredData, impResp;
|
|
|
-parameter PNum = 5000;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -228,7 +229,7 @@ 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-2]);
|
|
// wire writeEn = (oscWindDelay[N*2+N*2+decimFactor-2]);
|
|
|
-wire writeEn = (tbCnt>= (startValue+(N*2)+1) & tbCnt <= (stopValue+(N*2)+1));
|
|
|
|
|
|
|
+wire writeEn = (tbCnt>= (startValue+(N*2)) & tbCnt <= (stopValue+(N*2)));
|
|
|
|
|
|
|
|
always @(posedge Clk50)begin
|
|
always @(posedge Clk50)begin
|
|
|
if (!Rst) begin
|
|
if (!Rst) begin
|
|
@@ -255,8 +256,8 @@ always @(posedge Clk50) begin
|
|
|
if (tbCnt==32'd1) begin
|
|
if (tbCnt==32'd1) begin
|
|
|
impResp = $fopen("C:/S5243_FFT_REPO/src/src/Sim/ImpResp.txt","w");
|
|
impResp = $fopen("C:/S5243_FFT_REPO/src/src/Sim/ImpResp.txt","w");
|
|
|
end else begin
|
|
end else begin
|
|
|
- if (writeEn) begin
|
|
|
|
|
- // if (impRespVal) begin
|
|
|
|
|
|
|
+ // if (writeEn) begin
|
|
|
|
|
+ if (impRespVal) begin
|
|
|
$fwrite(impResp,"%d\n", impResponse);
|
|
$fwrite(impResp,"%d\n", impResponse);
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|