|
|
@@ -115,7 +115,7 @@ module DspInterface
|
|
|
wire signed [AdcDataWidth-1:0] currDataChannelDecim;
|
|
|
wire currDataChannelDecimVal;
|
|
|
|
|
|
- wire signed [31:0] filteredDecimDataI;
|
|
|
+ wire signed [31:0] filteredDecimData;
|
|
|
wire signed [31:0] filteredDecimDataQ;
|
|
|
wire filteredDecimDataVal;
|
|
|
//================================================================================
|
|
|
@@ -229,30 +229,144 @@ DspSlaveSpi
|
|
|
.Miso_o (Miso_o)
|
|
|
);
|
|
|
|
|
|
-DecimFilterWrapperTest DecimFilter
|
|
|
-(
|
|
|
- .Clk_i (Clk_i),
|
|
|
- .Rst_i (Rst_i),
|
|
|
- .DataVal_i (OscWind_i),
|
|
|
- .DecimFactor_i (DecimFactor_i),
|
|
|
+// DecimFilterWrapperTest DecimFilter
|
|
|
+// (
|
|
|
+ // .Clk_i (Clk_i),
|
|
|
+ // .Rst_i (Rst_i),
|
|
|
+ // .DataVal_i (OscWind_i),
|
|
|
+ // .DecimFactor_i (DecimFactor_i),
|
|
|
|
|
|
|
|
|
- .Data_i (currDataChannel),
|
|
|
+ // .Data_i (currDataChannel),
|
|
|
// .TestData_o (testData),
|
|
|
|
|
|
- .Data_o (filteredDecimDataI),
|
|
|
- .DataVal_o (filteredDecimDataVal)
|
|
|
+ // .Data_o (filteredDecimData),
|
|
|
+ // .DataVal_o (filteredDecimDataVal)
|
|
|
+// );
|
|
|
+
|
|
|
+reg [15:0] currDecimFactor;
|
|
|
+reg [15:0] currDecimFactorR;
|
|
|
+
|
|
|
+reg changeFlag;
|
|
|
+reg decimChangeVal;
|
|
|
+
|
|
|
+reg [15:0] s_axis_config_tdata;
|
|
|
+reg s_axis_config_tvalid;
|
|
|
+wire s_axis_config_tready;
|
|
|
+
|
|
|
+reg [15:0] s_axis_data_tdata;
|
|
|
+reg s_axis_data_tvalid;
|
|
|
+wire s_axis_data_tready;
|
|
|
+wire [31:0] m_axis_data_tdata;
|
|
|
+wire m_axis_data_tvalid;
|
|
|
+
|
|
|
+reg [2:0] corrDecimFactor;
|
|
|
+
|
|
|
+always @(posedge Clk_i) begin
|
|
|
+ if (!Rst_i) begin
|
|
|
+ if (DecimFactor_i <= 3'd4) begin
|
|
|
+ corrDecimFactor <= 3'd4;
|
|
|
+ end else begin
|
|
|
+ corrDecimFactor <= DecimFactor_i;
|
|
|
+ end
|
|
|
+ end else begin
|
|
|
+ corrDecimFactor <= 0;
|
|
|
+ end
|
|
|
+end
|
|
|
+
|
|
|
+always @(posedge Clk_i) begin
|
|
|
+ if (Rst_i) begin
|
|
|
+ currDecimFactor <= 0;
|
|
|
+ currDecimFactorR <= 0;
|
|
|
+ end else begin
|
|
|
+ currDecimFactor <= {12'd0,corrDecimFactor};
|
|
|
+ currDecimFactorR <= currDecimFactor;
|
|
|
+ end
|
|
|
+end
|
|
|
+
|
|
|
+always @(posedge Clk_i) begin
|
|
|
+ if (Rst_i) begin
|
|
|
+ changeFlag <= 0;
|
|
|
+ end else begin
|
|
|
+ changeFlag <= (currDecimFactor!=currDecimFactorR);
|
|
|
+ end
|
|
|
+end
|
|
|
+
|
|
|
+always @(posedge Clk_i) begin
|
|
|
+ if (!Rst_i) begin
|
|
|
+ if (changeFlag) begin
|
|
|
+ decimChangeVal <= 1'b1;
|
|
|
+ end
|
|
|
+ if (s_axis_config_tvalid) begin
|
|
|
+ decimChangeVal <= 1'b0;
|
|
|
+ end
|
|
|
+ end else begin
|
|
|
+ decimChangeVal <= 1'b0;
|
|
|
+ end
|
|
|
+end
|
|
|
+
|
|
|
+always @(posedge Clk_i) begin
|
|
|
+ if (!Rst_i) begin
|
|
|
+ if (decimChangeVal) begin
|
|
|
+ if (s_axis_config_tready) begin
|
|
|
+ s_axis_config_tdata <= currDecimFactor;
|
|
|
+ s_axis_config_tvalid <= 1'b1;
|
|
|
+ end else begin
|
|
|
+ s_axis_config_tvalid <= 1'b0;
|
|
|
+ end
|
|
|
+ end else begin
|
|
|
+ s_axis_config_tdata <= s_axis_config_tdata;
|
|
|
+ s_axis_config_tvalid <= 1'b0;
|
|
|
+ end
|
|
|
+ end else begin
|
|
|
+ s_axis_config_tdata <= 0;
|
|
|
+ s_axis_config_tvalid <= 1'b0;
|
|
|
+ end
|
|
|
+end
|
|
|
+
|
|
|
+always @(posedge Clk_i) begin
|
|
|
+ if (!Rst_i) begin
|
|
|
+ if (OscWind_i) begin
|
|
|
+ if (s_axis_data_tready) begin
|
|
|
+ s_axis_data_tdata <={{2{currDataChannel[AdcDataWidth-1]}},currDataChannel};
|
|
|
+ s_axis_data_tvalid <= 1'b1;
|
|
|
+ end else begin
|
|
|
+ s_axis_data_tvalid <= 1'b0;
|
|
|
+ end
|
|
|
+ end else begin
|
|
|
+ s_axis_data_tdata <= s_axis_data_tdata;
|
|
|
+ s_axis_data_tvalid <= 1'b0;
|
|
|
+ end
|
|
|
+ end else begin
|
|
|
+ s_axis_data_tdata <= 0;
|
|
|
+ s_axis_data_tvalid <= 1'b0;
|
|
|
+ end
|
|
|
+end
|
|
|
+
|
|
|
+CicTest CicCompilerTest (
|
|
|
+ .aclk(Clk_i), // input wire aclk
|
|
|
+ .s_axis_config_tdata(s_axis_config_tdata), // input wire [15 : 0] s_axis_config_tdata
|
|
|
+ .s_axis_config_tvalid(s_axis_config_tvalid), // input wire s_axis_config_tvalid
|
|
|
+ .s_axis_config_tready(s_axis_config_tready), // output wire s_axis_config_tready
|
|
|
+
|
|
|
+ .s_axis_data_tdata(s_axis_data_tdata), // input wire [15 : 0] s_axis_data_tdata
|
|
|
+ .s_axis_data_tvalid(s_axis_data_tvalid), // input wire s_axis_data_tvalid
|
|
|
+ .s_axis_data_tready(s_axis_data_tready), // output wire s_axis_data_tready
|
|
|
+
|
|
|
+ .m_axis_data_tdata(filteredDecimData), // output wire [31 : 0] m_axis_data_tdata
|
|
|
+ .m_axis_data_tvalid(filteredDecimDataVal) // output wire m_axis_data_tvalid
|
|
|
);
|
|
|
|
|
|
OscDataFormer DecimDataFormer
|
|
|
(
|
|
|
.Clk_i (Clk_i),
|
|
|
.Rst_i (Rst_i),
|
|
|
- .OscWind_i (OscWind_i),
|
|
|
+ .OscWind_i (s_axis_data_tvalid),
|
|
|
+ // .OscWind_i (OscWind_i),
|
|
|
.MeasNum_i (MeasNum_i),
|
|
|
|
|
|
.AdcDataVal_i (filteredDecimDataVal),
|
|
|
- .AdcData_i (filteredDecimDataI),
|
|
|
+ .AdcData_i (filteredDecimData),
|
|
|
|
|
|
.OscDataBus_o (decimDataBus),
|
|
|
.OscDataBusVal_o (decimDataBusVal)
|