207 lines
6.2 KiB
Verilog
207 lines
6.2 KiB
Verilog
//+FHDR--------------------------------------------------------------------------------------------------------
|
|
// Company:
|
|
//-----------------------------------------------------------------------------------------------------------------
|
|
// File Name : Z_dsp.v
|
|
// Department :
|
|
// Author : thfu
|
|
// Author's Tel :
|
|
//-----------------------------------------------------------------------------------------------------------------
|
|
// Relese History
|
|
// Version Date Author Description
|
|
// 0.3 2024-11-09 thfu to fit the addition of IP core
|
|
//-----------------------------------------------------------------------------------------------------------------
|
|
// Keywords :
|
|
//
|
|
//-----------------------------------------------------------------------------------------------------------------
|
|
// Parameter
|
|
//
|
|
//-----------------------------------------------------------------------------------------------------------------
|
|
// Purpose :
|
|
//
|
|
//-----------------------------------------------------------------------------------------------------------------
|
|
// Target Device:
|
|
// Tool versions:
|
|
//-----------------------------------------------------------------------------------------------------------------
|
|
// Reuse Issues
|
|
// Reset Strategy:
|
|
// Clock Domains:
|
|
// Critical Timing:
|
|
// Asynchronous I/F:
|
|
// Synthesizable (y/n):
|
|
// Other:
|
|
//-FHDR--------------------------------------------------------------------------------------------------------
|
|
|
|
module z_dsp
|
|
(
|
|
input clk,
|
|
input rstn,
|
|
input en, //enable
|
|
input [1:0] dac_mode_sel, //2'b00:NRZ mode;2'b01:Double data mode;
|
|
//2'b10:Double Double data mode;2'b11:reserve;
|
|
input tc_bypass,
|
|
input [1:0] intp_mode, //2'b00:x1;2'b01:x2,'b10:x4;other:reserve;
|
|
input vldi,
|
|
input signed [15:0] din_re,
|
|
input signed [15:0] din_im,
|
|
input signed [31:0] a0_re, //a0's real part
|
|
input signed [31:0] a0_im, //a0's image part
|
|
input signed [31:0] b0_re,
|
|
input signed [31:0] b0_im,
|
|
input signed [31:0] a1_re,
|
|
input signed [31:0] a1_im,
|
|
input signed [31:0] b1_re,
|
|
input signed [31:0] b1_im,
|
|
input signed [31:0] a2_re,
|
|
input signed [31:0] a2_im,
|
|
input signed [31:0] b2_re,
|
|
input signed [31:0] b2_im,
|
|
input signed [31:0] a3_re,
|
|
input signed [31:0] a3_im,
|
|
input signed [31:0] b3_re,
|
|
input signed [31:0] b3_im,
|
|
input signed [31:0] a4_re,
|
|
input signed [31:0] a4_im,
|
|
input signed [31:0] b4_re,
|
|
input signed [31:0] b4_im,
|
|
input signed [31:0] a5_re,
|
|
input signed [31:0] a5_im,
|
|
input signed [31:0] b5_re,
|
|
input signed [31:0] b5_im,
|
|
output signed [15:0] dout0,
|
|
output signed [15:0] dout1,
|
|
output signed [15:0] dout2,
|
|
output signed [15:0] dout3,
|
|
output vldo,
|
|
output saturation_0,
|
|
output saturation_1,
|
|
output saturation_2,
|
|
output saturation_3,
|
|
output saturation_4,
|
|
output saturation_5
|
|
);
|
|
|
|
parameter Delay = 9-1;
|
|
|
|
wire signed [15:0] IIR_out;
|
|
|
|
reg [Delay:0] vldo_r;
|
|
|
|
always@(posedge clk or negedge rstn)
|
|
if(!rstn)
|
|
begin
|
|
vldo_r <= 'h0;
|
|
end
|
|
else if(en)
|
|
begin
|
|
vldo_r <= {vldo_r[Delay:0], vldi};//Delay with 8 clk
|
|
end
|
|
else
|
|
begin
|
|
vldo_r <= vldo_r;
|
|
end
|
|
|
|
assign vldo = vldo_r[Delay];
|
|
|
|
TailCorr_top inst_TailCorr_top
|
|
(
|
|
.clk (clk ),
|
|
.rstn (rstn ),
|
|
.en (en ),
|
|
.tc_bypass (tc_bypass ),
|
|
.din_re (din_re ),
|
|
.din_im (din_im ),
|
|
.a0_re (a0_re ),
|
|
.a0_im (a0_im ),
|
|
.b0_re (b0_re ),
|
|
.b0_im (b0_im ),
|
|
.a1_re (a1_re ),
|
|
.a1_im (a1_im ),
|
|
.b1_re (b1_re ),
|
|
.b1_im (b1_im ),
|
|
.a2_re (a2_re ),
|
|
.a2_im (a2_im ),
|
|
.b2_re (b2_re ),
|
|
.b2_im (b2_im ),
|
|
.a3_re (a3_re ),
|
|
.a3_im (a3_im ),
|
|
.b3_re (b3_re ),
|
|
.b3_im (b3_im ),
|
|
.a4_re (a4_re ),
|
|
.a4_im (a4_im ),
|
|
.b4_re (b4_re ),
|
|
.b4_im (b4_im ),
|
|
.a5_re (a5_re ),
|
|
.a5_im (a5_im ),
|
|
.b5_re (b5_re ),
|
|
.b5_im (b5_im ),
|
|
.dout (IIR_out ),
|
|
.saturation_0 (saturation_0 ),
|
|
.saturation_1 (saturation_1 ),
|
|
.saturation_2 (saturation_2 ),
|
|
.saturation_3 (saturation_3 ),
|
|
.saturation_4 (saturation_4 ),
|
|
.saturation_5 (saturation_5 )
|
|
);
|
|
|
|
wire signed [15:0] dout_0;
|
|
wire signed [15:0] dout_1;
|
|
wire signed [15:0] dout_2;
|
|
wire signed [15:0] dout_3;
|
|
wire signed [15:0] dout_4;
|
|
wire signed [15:0] dout_5;
|
|
wire signed [15:0] dout_6;
|
|
wire signed [15:0] dout_7;
|
|
|
|
|
|
MeanIntp_8 inst_MeanIntp_8
|
|
(
|
|
.clk (clk ),
|
|
.rstn (rstn ),
|
|
.en (en ),
|
|
.intp_mode (intp_mode ),
|
|
.din (IIR_out ),
|
|
.dout_0 (dout_0 ),
|
|
.dout_1 (dout_1 ),
|
|
.dout_2 (dout_2 ),
|
|
.dout_3 (dout_3 ),
|
|
.dout_4 (dout_4 ),
|
|
.dout_5 (dout_5 ),
|
|
.dout_6 (dout_6 ),
|
|
.dout_7 (dout_7 )
|
|
|
|
);
|
|
|
|
reg signed [15:0] doutf_0;
|
|
reg signed [15:0] doutf_1;
|
|
reg signed [15:0] doutf_2;
|
|
reg signed [15:0] doutf_3;
|
|
|
|
|
|
always@(posedge clk or negedge rstn)
|
|
if(!rstn) begin
|
|
doutf_0 <= 0;
|
|
doutf_1 <= 0;
|
|
doutf_2 <= 0;
|
|
doutf_3 <= 0;
|
|
end
|
|
else if(en) begin
|
|
doutf_0 <= dout_0;
|
|
doutf_1 <= dout_1;
|
|
doutf_2 <= dout_2;
|
|
doutf_3 <= dout_3;
|
|
end
|
|
|
|
else begin
|
|
doutf_0 <= dout_4;
|
|
doutf_1 <= dout_5;
|
|
doutf_2 <= dout_6;
|
|
doutf_3 <= dout_7;
|
|
end
|
|
|
|
assign dout0 = doutf_0;
|
|
assign dout1 = doutf_1;
|
|
assign dout2 = doutf_2;
|
|
assign dout3 = doutf_3;
|
|
|
|
endmodule
|