"Paul Solomon" <psolomon@tpg.com.au> writes:> Hi Brian, > > Wow, that is great, reading that verilog code has helped heaps and it > cleared up where I was going wrong > with my CIC filter.. I just needed to add a few signed keywords and handle > the signed extension with the > $signed cast operator. > > Thank you very much.. > > Is there any chance you could do the same and post the code for a FIR filter > as well as I am having a similar > problem now trying to implement the compensating FIR filter that should come > next.. > > the filter is designed as follows... > > cfir = firceqrip(20, 0.16, [5.7565e-4 0.000001], 'passedge','invsinc', [1I would be happy to do this as another gesture of good will; I will even go one step further and suggest FIR-transposed as generally being a better structure for hardware implementation. For both we exploit the symmetric coefficients. Just ask for a trial of Filter Design and Filter Design HDL Coder toolboxes and you can do this yourself in under ten seconds! I will show both and my script: cfir = firceqrip(20, 0.16, [5.7565e-4 0.000001], 'passedge','invsinc', [1 4]) Hcfir = dfilt.dfsymfir(cfir); Hcfir.arithmetic = 'fixed'; Hcfir.coeffWordLength = 20 Hcfir.InputWordLength = 32; Hcfir.InputFracLength = 0; Hcfir.filterInternals = 'specifyPrecision'; Hcfir.RoundMode = 'floor'; Hcfir.outputWordLength = 32; generatehdl(Hcfir,'targetlanguage','verilog') Hcfirt = dfilt.dffirt(cfir); Hcfirt.arithmetic = 'fixed'; Hcfirt.coeffWordLength = 20 Hcfirt.InputWordLength = 32; Hcfirt.InputFracLength = 0; Hcfirt.filterInternals = 'specifyPrecision'; Hcfirt.RoundMode = 'floor'; Hcfirt.outputWordLength = 32; generatehdl(Hcfirt,'targetlanguage','verilog') Note that I changed the rounding mode to floor and tried to set the input, coefficient, and output widths as you said but I let the coefficient binary points and internal arithmetic be automatically scaled so only the output is quantized. Recall too that input and output registers are the default but that can be changed. By changing an option, we can also remove all the multipliers, using a shift-and-add technique known as Canonic Signed-Digit or CSD recoding or even a factored version of CSD. We can also cascade your CIC and your compensating FIR into one filter object and generate Verilog for the two filters and the cascade wrapper in one simple command. Here are the Verilog files for both Symmetric-FIR and FIR-Transposed: // ------------------------------------------------------------- // // Module: Hcfir // // Generated by MATLAB(R) 7.1 and the Filter Design HDL Coder 1.3. // // Generated on: 2005-05-23 12:22:10 // // ------------------------------------------------------------- // ------------------------------------------------------------- // HDL Code Generation Options: // // TargetLanguage: Verilog // Name: Hcfir // // Filter Settings: // // Discrete-Time FIR Filter (real) // ------------------------------- // Filter Structure : Direct-Form Symmetric FIR // Filter Length : 21 // Stable : Yes // Linear Phase : Yes (Type 1) // Arithmetic : fixed // Numerator : s20,19 -> [-1 1) // Input : s32,0 -> [-2.147484e+009 2.147484e+009) // Filter Internals : Specify Precision // Output : s32,19 -> [-4096 4096) // Tap Sum : s33,0 -> [-4.294967e+009 4.294967e+009) // Product : s52,19 -> [-4.294967e+009 4.294967e+009) // Accumulator : s52,19 -> [-4.294967e+009 4.294967e+009) // Round Mode : floor // Overflow Mode : wrap // ------------------------------------------------------------- `timescale 1 ns / 1 ns module Hcfir ( clk, clk_enable, reset, filter_in, filter_out ); input clk; input clk_enable; input reset; input signed [31:0] filter_in; //sfix32 output signed [31:0] filter_out; //sfix32_En19 // Local Functions // Type Definitions // Constants parameter signed [19:0] coeff1 = 20'b11111111111011000100; //sfix20_En19 parameter signed [19:0] coeff2 = 20'b11111111101010011100; //sfix20_En19 parameter signed [19:0] coeff3 = 20'b11111111110010100011; //sfix20_En19 parameter signed [19:0] coeff4 = 20'b00000001100100011011; //sfix20_En19 parameter signed [19:0] coeff5 = 20'b00000011101011000110; //sfix20_En19 parameter signed [19:0] coeff6 = 20'b00000000000011100000; //sfix20_En19 parameter signed [19:0] coeff7 = 20'b11110100111011001001; //sfix20_En19 parameter signed [19:0] coeff8 = 20'b11110000101111001100; //sfix20_En19 parameter signed [19:0] coeff9 = 20'b00000110011011010001; //sfix20_En19 parameter signed [19:0] coeff10 = 20'b00101101111111101001; //sfix20_En19 parameter signed [19:0] coeff11 = 20'b01000010100100000111; //sfix20_En19 // Signals reg signed [31:0] delay_pipeline [0:20] ; // sfix32 wire signed [32:0] tapsum1; // sfix33 wire signed [31:0] add_signext; // sfix32 wire signed [31:0] add_signext_1; // sfix32 wire signed [32:0] tapsum_mcand; // sfix33 wire signed [32:0] tapsum2; // sfix33 wire signed [31:0] add_signext_2; // sfix32 wire signed [31:0] add_signext_3; // sfix32 wire signed [32:0] tapsum_mcand_1; // sfix33 wire signed [32:0] tapsum3; // sfix33 wire signed [31:0] add_signext_4; // sfix32 wire signed [31:0] add_signext_5; // sfix32 wire signed [32:0] tapsum_mcand_2; // sfix33 wire signed [32:0] tapsum4; // sfix33 wire signed [31:0] add_signext_6; // sfix32 wire signed [31:0] add_signext_7; // sfix32 wire signed [32:0] tapsum_mcand_3; // sfix33 wire signed [32:0] tapsum5; // sfix33 wire signed [31:0] add_signext_8; // sfix32 wire signed [31:0] add_signext_9; // sfix32 wire signed [32:0] tapsum_mcand_4; // sfix33 wire signed [32:0] tapsum6; // sfix33 wire signed [31:0] add_signext_10; // sfix32 wire signed [31:0] add_signext_11; // sfix32 wire signed [32:0] tapsum_mcand_5; // sfix33 wire signed [32:0] tapsum7; // sfix33 wire signed [31:0] add_signext_12; // sfix32 wire signed [31:0] add_signext_13; // sfix32 wire signed [32:0] tapsum_mcand_6; // sfix33 wire signed [32:0] tapsum8; // sfix33 wire signed [31:0] add_signext_14; // sfix32 wire signed [31:0] add_signext_15; // sfix32 wire signed [32:0] tapsum_mcand_7; // sfix33 wire signed [32:0] tapsum9; // sfix33 wire signed [31:0] add_signext_16; // sfix32 wire signed [31:0] add_signext_17; // sfix32 wire signed [32:0] tapsum_mcand_8; // sfix33 wire signed [32:0] tapsum10; // sfix33 wire signed [31:0] add_signext_18; // sfix32 wire signed [31:0] add_signext_19; // sfix32 wire signed [32:0] tapsum_mcand_9; // sfix33 wire signed [51:0] product11; // sfix52_En19 wire signed [51:0] product10; // sfix52_En19 wire signed [52:0] mul_temp; // sfix53_En19 wire signed [51:0] product9; // sfix52_En19 wire signed [52:0] mul_temp_1; // sfix53_En19 wire signed [51:0] product8; // sfix52_En19 wire signed [52:0] mul_temp_2; // sfix53_En19 wire signed [51:0] product7; // sfix52_En19 wire signed [52:0] mul_temp_3; // sfix53_En19 wire signed [51:0] product6; // sfix52_En19 wire signed [52:0] mul_temp_4; // sfix53_En19 wire signed [51:0] product5; // sfix52_En19 wire signed [52:0] mul_temp_5; // sfix53_En19 wire signed [51:0] product4; // sfix52_En19 wire signed [52:0] mul_temp_6; // sfix53_En19 wire signed [51:0] product3; // sfix52_En19 wire signed [52:0] mul_temp_7; // sfix53_En19 wire signed [51:0] product2; // sfix52_En19 wire signed [52:0] mul_temp_8; // sfix53_En19 wire signed [51:0] product1; // sfix52_En19 wire signed [52:0] mul_temp_9; // sfix53_En19 wire signed [51:0] sum1; // sfix52_En19 wire signed [51:0] add_signext_20; // sfix52_En19 wire signed [51:0] add_signext_21; // sfix52_En19 wire signed [52:0] add_temp; // sfix53_En19 wire signed [51:0] sum2; // sfix52_En19 wire signed [51:0] add_signext_22; // sfix52_En19 wire signed [51:0] add_signext_23; // sfix52_En19 wire signed [52:0] add_temp_1; // sfix53_En19 wire signed [51:0] sum3; // sfix52_En19 wire signed [51:0] add_signext_24; // sfix52_En19 wire signed [51:0] add_signext_25; // sfix52_En19 wire signed [52:0] add_temp_2; // sfix53_En19 wire signed [51:0] sum4; // sfix52_En19 wire signed [51:0] add_signext_26; // sfix52_En19 wire signed [51:0] add_signext_27; // sfix52_En19 wire signed [52:0] add_temp_3; // sfix53_En19 wire signed [51:0] sum5; // sfix52_En19 wire signed [51:0] add_signext_28; // sfix52_En19 wire signed [51:0] add_signext_29; // sfix52_En19 wire signed [52:0] add_temp_4; // sfix53_En19 wire signed [51:0] sum6; // sfix52_En19 wire signed [51:0] add_signext_30; // sfix52_En19 wire signed [51:0] add_signext_31; // sfix52_En19 wire signed [52:0] add_temp_5; // sfix53_En19 wire signed [51:0] sum7; // sfix52_En19 wire signed [51:0] add_signext_32; // sfix52_En19 wire signed [51:0] add_signext_33; // sfix52_En19 wire signed [52:0] add_temp_6; // sfix53_En19 wire signed [51:0] sum8; // sfix52_En19 wire signed [51:0] add_signext_34; // sfix52_En19 wire signed [51:0] add_signext_35; // sfix52_En19 wire signed [52:0] add_temp_7; // sfix53_En19 wire signed [51:0] sum9; // sfix52_En19 wire signed [51:0] add_signext_36; // sfix52_En19 wire signed [51:0] add_signext_37; // sfix52_En19 wire signed [52:0] add_temp_8; // sfix53_En19 wire signed [51:0] sum10; // sfix52_En19 wire signed [51:0] add_signext_38; // sfix52_En19 wire signed [51:0] add_signext_39; // sfix52_En19 wire signed [52:0] add_temp_9; // sfix53_En19 wire signed [31:0] output_typeconvert; // sfix32_En19 reg signed [31:0] output_register; // sfix32_En19 // Block Statements always @( posedge clk or posedge reset) begin: Delay_Pipeline_process if (reset == 1'b1) begin delay_pipeline[0] <= 0; delay_pipeline[1] <= 0; delay_pipeline[2] <= 0; delay_pipeline[3] <= 0; delay_pipeline[4] <= 0; delay_pipeline[5] <= 0; delay_pipeline[6] <= 0; delay_pipeline[7] <= 0; delay_pipeline[8] <= 0; delay_pipeline[9] <= 0; delay_pipeline[10] <= 0; delay_pipeline[11] <= 0; delay_pipeline[12] <= 0; delay_pipeline[13] <= 0; delay_pipeline[14] <= 0; delay_pipeline[15] <= 0; delay_pipeline[16] <= 0; delay_pipeline[17] <= 0; delay_pipeline[18] <= 0; delay_pipeline[19] <= 0; delay_pipeline[20] <= 0; end else begin if (clk_enable == 1'b1) begin delay_pipeline[0] <= filter_in; delay_pipeline[1] <= delay_pipeline[0]; delay_pipeline[2] <= delay_pipeline[1]; delay_pipeline[3] <= delay_pipeline[2]; delay_pipeline[4] <= delay_pipeline[3]; delay_pipeline[5] <= delay_pipeline[4]; delay_pipeline[6] <= delay_pipeline[5]; delay_pipeline[7] <= delay_pipeline[6]; delay_pipeline[8] <= delay_pipeline[7]; delay_pipeline[9] <= delay_pipeline[8]; delay_pipeline[10] <= delay_pipeline[9]; delay_pipeline[11] <= delay_pipeline[10]; delay_pipeline[12] <= delay_pipeline[11]; delay_pipeline[13] <= delay_pipeline[12]; delay_pipeline[14] <= delay_pipeline[13]; delay_pipeline[15] <= delay_pipeline[14]; delay_pipeline[16] <= delay_pipeline[15]; delay_pipeline[17] <= delay_pipeline[16]; delay_pipeline[18] <= delay_pipeline[17]; delay_pipeline[19] <= delay_pipeline[18]; delay_pipeline[20] <= delay_pipeline[19]; end end end // Delay_Pipeline_process assign add_signext = delay_pipeline[0]; assign add_signext_1 = delay_pipeline[20]; assign tapsum1 = add_signext + add_signext_1; assign tapsum_mcand = tapsum1; assign add_signext_2 = delay_pipeline[1]; assign add_signext_3 = delay_pipeline[19]; assign tapsum2 = add_signext_2 + add_signext_3; assign tapsum_mcand_1 = tapsum2; assign add_signext_4 = delay_pipeline[2]; assign add_signext_5 = delay_pipeline[18]; assign tapsum3 = add_signext_4 + add_signext_5; assign tapsum_mcand_2 = tapsum3; assign add_signext_6 = delay_pipeline[3]; assign add_signext_7 = delay_pipeline[17]; assign tapsum4 = add_signext_6 + add_signext_7; assign tapsum_mcand_3 = tapsum4; assign add_signext_8 = delay_pipeline[4]; assign add_signext_9 = delay_pipeline[16]; assign tapsum5 = add_signext_8 + add_signext_9; assign tapsum_mcand_4 = tapsum5; assign add_signext_10 = delay_pipeline[5]; assign add_signext_11 = delay_pipeline[15]; assign tapsum6 = add_signext_10 + add_signext_11; assign tapsum_mcand_5 = tapsum6; assign add_signext_12 = delay_pipeline[6]; assign add_signext_13 = delay_pipeline[14]; assign tapsum7 = add_signext_12 + add_signext_13; assign tapsum_mcand_6 = tapsum7; assign add_signext_14 = delay_pipeline[7]; assign add_signext_15 = delay_pipeline[13]; assign tapsum8 = add_signext_14 + add_signext_15; assign tapsum_mcand_7 = tapsum8; assign add_signext_16 = delay_pipeline[8]; assign add_signext_17 = delay_pipeline[12]; assign tapsum9 = add_signext_16 + add_signext_17; assign tapsum_mcand_8 = tapsum9; assign add_signext_18 = delay_pipeline[9]; assign add_signext_19 = delay_pipeline[11]; assign tapsum10 = add_signext_18 + add_signext_19; assign tapsum_mcand_9 = tapsum10; assign product11 = delay_pipeline[10] * coeff11; assign mul_temp = tapsum_mcand_9 * coeff10; assign product10 = mul_temp[51:0]; assign mul_temp_1 = tapsum_mcand_8 * coeff9; assign product9 = mul_temp_1[51:0]; assign mul_temp_2 = tapsum_mcand_7 * coeff8; assign product8 = mul_temp_2[51:0]; assign mul_temp_3 = tapsum_mcand_6 * coeff7; assign product7 = mul_temp_3[51:0]; assign mul_temp_4 = tapsum_mcand_5 * coeff6; assign product6 = mul_temp_4[51:0]; assign mul_temp_5 = tapsum_mcand_4 * coeff5; assign product5 = mul_temp_5[51:0]; assign mul_temp_6 = tapsum_mcand_3 * coeff4; assign product4 = mul_temp_6[51:0]; assign mul_temp_7 = tapsum_mcand_2 * coeff3; assign product3 = mul_temp_7[51:0]; assign mul_temp_8 = tapsum_mcand_1 * coeff2; assign product2 = mul_temp_8[51:0]; assign mul_temp_9 = tapsum_mcand * coeff1; assign product1 = mul_temp_9[51:0]; assign add_signext_20 = product1; assign add_signext_21 = product2; assign add_temp = add_signext_20 + add_signext_21; assign sum1 = add_temp[51:0]; assign add_signext_22 = sum1; assign add_signext_23 = product3; assign add_temp_1 = add_signext_22 + add_signext_23; assign sum2 = add_temp_1[51:0]; assign add_signext_24 = sum2; assign add_signext_25 = product4; assign add_temp_2 = add_signext_24 + add_signext_25; assign sum3 = add_temp_2[51:0]; assign add_signext_26 = sum3; assign add_signext_27 = product5; assign add_temp_3 = add_signext_26 + add_signext_27; assign sum4 = add_temp_3[51:0]; assign add_signext_28 = sum4; assign add_signext_29 = product6; assign add_temp_4 = add_signext_28 + add_signext_29; assign sum5 = add_temp_4[51:0]; assign add_signext_30 = sum5; assign add_signext_31 = product7; assign add_temp_5 = add_signext_30 + add_signext_31; assign sum6 = add_temp_5[51:0]; assign add_signext_32 = sum6; assign add_signext_33 = product8; assign add_temp_6 = add_signext_32 + add_signext_33; assign sum7 = add_temp_6[51:0]; assign add_signext_34 = sum7; assign add_signext_35 = product9; assign add_temp_7 = add_signext_34 + add_signext_35; assign sum8 = add_temp_7[51:0]; assign add_signext_36 = sum8; assign add_signext_37 = product10; assign add_temp_8 = add_signext_36 + add_signext_37; assign sum9 = add_temp_8[51:0]; assign add_signext_38 = sum9; assign add_signext_39 = product11; assign add_temp_9 = add_signext_38 + add_signext_39; assign sum10 = add_temp_9[51:0]; assign output_typeconvert = sum10[31:0]; always @ (posedge clk or posedge reset) begin: Output_Register_process if (reset == 1'b1) begin output_register <= 0; end else begin if (clk_enable == 1'b1) begin output_register <= output_typeconvert; end end end // Output_Register_process // Assignment Statements assign filter_out = output_register; endmodule // Hcfir ==================================================================== // ------------------------------------------------------------- // // Module: Hcfirt // // Generated by MATLAB(R) 7.1 and the Filter Design HDL Coder 1.3. // // Generated on: 2005-05-23 12:22:11 // // ------------------------------------------------------------- // ------------------------------------------------------------- // HDL Code Generation Options: // // TargetLanguage: Verilog // Name: Hcfirt // // Filter Settings: // // Discrete-Time FIR Filter (real) // ------------------------------- // Filter Structure : Direct-Form FIR Transposed // Filter Length : 21 // Stable : Yes // Linear Phase : Yes (Type 1) // Arithmetic : fixed // Numerator : s20,19 -> [-1 1) // Input : s32,0 -> [-2.147484e+009 2.147484e+009) // Filter Internals : Specify Precision // Output : s32,19 -> [-4096 4096) // States : s52,19 -> [-4.294967e+009 4.294967e+009) // Product : s51,19 -> [-2.147484e+009 2.147484e+009) // Accumulator : s52,19 -> [-4.294967e+009 4.294967e+009) // Round Mode : floor // Overflow Mode : wrap // ------------------------------------------------------------- `timescale 1 ns / 1 ns module Hcfirt ( clk, clk_enable, reset, filter_in, filter_out ); input clk; input clk_enable; input reset; input signed [31:0] filter_in; //sfix32 output signed [31:0] filter_out; //sfix32_En19 // Local Functions // Type Definitions // Constants parameter signed [19:0] coeff1 = 20'b11111111111011000100; //sfix20_En19 parameter signed [19:0] coeff2 = 20'b11111111101010011100; //sfix20_En19 parameter signed [19:0] coeff3 = 20'b11111111110010100011; //sfix20_En19 parameter signed [19:0] coeff4 = 20'b00000001100100011011; //sfix20_En19 parameter signed [19:0] coeff5 = 20'b00000011101011000110; //sfix20_En19 parameter signed [19:0] coeff6 = 20'b00000000000011100000; //sfix20_En19 parameter signed [19:0] coeff7 = 20'b11110100111011001001; //sfix20_En19 parameter signed [19:0] coeff8 = 20'b11110000101111001100; //sfix20_En19 parameter signed [19:0] coeff9 = 20'b00000110011011010001; //sfix20_En19 parameter signed [19:0] coeff10 = 20'b00101101111111101001; //sfix20_En19 parameter signed [19:0] coeff11 = 20'b01000010100100000111; //sfix20_En19 parameter signed [19:0] coeff12 = 20'b00101101111111101001; //sfix20_En19 parameter signed [19:0] coeff13 = 20'b00000110011011010001; //sfix20_En19 parameter signed [19:0] coeff14 = 20'b11110000101111001100; //sfix20_En19 parameter signed [19:0] coeff15 = 20'b11110100111011001001; //sfix20_En19 parameter signed [19:0] coeff16 = 20'b00000000000011100000; //sfix20_En19 parameter signed [19:0] coeff17 = 20'b00000011101011000110; //sfix20_En19 parameter signed [19:0] coeff18 = 20'b00000001100100011011; //sfix20_En19 parameter signed [19:0] coeff19 = 20'b11111111110010100011; //sfix20_En19 parameter signed [19:0] coeff20 = 20'b11111111101010011100; //sfix20_En19 parameter signed [19:0] coeff21 = 20'b11111111111011000100; //sfix20_En19 // Signals reg signed [31:0] inputreg; // sfix32 reg signed [51:0] delay_pipeline [0:19] ; // sfix52_En19 wire signed [51:0] sumvector [0:19] ; // sfix52_En19 wire signed [50:0] product11; // sfix51_En19 wire signed [51:0] mul_temp; // sfix52_En19 wire signed [50:0] product12; // sfix51_En19 wire signed [51:0] mul_temp_1; // sfix52_En19 wire signed [50:0] product13; // sfix51_En19 wire signed [51:0] mul_temp_2; // sfix52_En19 wire signed [50:0] product14; // sfix51_En19 wire signed [51:0] mul_temp_3; // sfix52_En19 wire signed [50:0] product15; // sfix51_En19 wire signed [51:0] mul_temp_4; // sfix52_En19 wire signed [50:0] product16; // sfix51_En19 wire signed [51:0] mul_temp_5; // sfix52_En19 wire signed [50:0] product17; // sfix51_En19 wire signed [51:0] mul_temp_6; // sfix52_En19 wire signed [50:0] product18; // sfix51_En19 wire signed [51:0] mul_temp_7; // sfix52_En19 wire signed [50:0] product19; // sfix51_En19 wire signed [51:0] mul_temp_8; // sfix52_En19 wire signed [50:0] product20; // sfix51_En19 wire signed [51:0] mul_temp_9; // sfix52_En19 wire signed [50:0] product21; // sfix51_En19 wire signed [51:0] mul_temp_10; // sfix52_En19 wire signed [51:0] finalsum; // sfix52_En19 wire signed [51:0] add_signext; // sfix52_En19 wire signed [51:0] add_signext_1; // sfix52_En19 wire signed [52:0] add_temp; // sfix53_En19 wire signed [51:0] add_signext_2; // sfix52_En19 wire signed [51:0] add_signext_3; // sfix52_En19 wire signed [52:0] add_temp_1; // sfix53_En19 wire signed [51:0] add_signext_4; // sfix52_En19 wire signed [51:0] add_signext_5; // sfix52_En19 wire signed [52:0] add_temp_2; // sfix53_En19 wire signed [51:0] add_signext_6; // sfix52_En19 wire signed [51:0] add_signext_7; // sfix52_En19 wire signed [52:0] add_temp_3; // sfix53_En19 wire signed [51:0] add_signext_8; // sfix52_En19 wire signed [51:0] add_signext_9; // sfix52_En19 wire signed [52:0] add_temp_4; // sfix53_En19 wire signed [51:0] add_signext_10; // sfix52_En19 wire signed [51:0] add_signext_11; // sfix52_En19 wire signed [52:0] add_temp_5; // sfix53_En19 wire signed [51:0] add_signext_12; // sfix52_En19 wire signed [51:0] add_signext_13; // sfix52_En19 wire signed [52:0] add_temp_6; // sfix53_En19 wire signed [51:0] add_signext_14; // sfix52_En19 wire signed [51:0] add_signext_15; // sfix52_En19 wire signed [52:0] add_temp_7; // sfix53_En19 wire signed [51:0] add_signext_16; // sfix52_En19 wire signed [51:0] add_signext_17; // sfix52_En19 wire signed [52:0] add_temp_8; // sfix53_En19 wire signed [51:0] add_signext_18; // sfix52_En19 wire signed [51:0] add_signext_19; // sfix52_En19 wire signed [52:0] add_temp_9; // sfix53_En19 wire signed [51:0] add_signext_20; // sfix52_En19 wire signed [51:0] add_signext_21; // sfix52_En19 wire signed [52:0] add_temp_10; // sfix53_En19 wire signed [51:0] add_signext_22; // sfix52_En19 wire signed [51:0] add_signext_23; // sfix52_En19 wire signed [52:0] add_temp_11; // sfix53_En19 wire signed [51:0] add_signext_24; // sfix52_En19 wire signed [51:0] add_signext_25; // sfix52_En19 wire signed [52:0] add_temp_12; // sfix53_En19 wire signed [51:0] add_signext_26; // sfix52_En19 wire signed [51:0] add_signext_27; // sfix52_En19 wire signed [52:0] add_temp_13; // sfix53_En19 wire signed [51:0] add_signext_28; // sfix52_En19 wire signed [51:0] add_signext_29; // sfix52_En19 wire signed [52:0] add_temp_14; // sfix53_En19 wire signed [51:0] add_signext_30; // sfix52_En19 wire signed [51:0] add_signext_31; // sfix52_En19 wire signed [52:0] add_temp_15; // sfix53_En19 wire signed [51:0] add_signext_32; // sfix52_En19 wire signed [51:0] add_signext_33; // sfix52_En19 wire signed [52:0] add_temp_16; // sfix53_En19 wire signed [51:0] add_signext_34; // sfix52_En19 wire signed [51:0] add_signext_35; // sfix52_En19 wire signed [52:0] add_temp_17; // sfix53_En19 wire signed [51:0] add_signext_36; // sfix52_En19 wire signed [51:0] add_signext_37; // sfix52_En19 wire signed [52:0] add_temp_18; // sfix53_En19 wire signed [51:0] add_signext_38; // sfix52_En19 wire signed [51:0] add_signext_39; // sfix52_En19 wire signed [52:0] add_temp_19; // sfix53_En19 wire signed [31:0] output_typeconvert; // sfix32_En19 reg signed [31:0] output_register; // sfix32_En19 // Block Statements always @ (posedge clk or posedge reset) begin: input_reg_process if (reset == 1'b1) begin inputreg <= 0; end else begin if (clk_enable == 1'b1) begin inputreg <= filter_in; end end end // input_reg_process always @ (posedge clk or posedge reset) begin: Delay_Pipeline_process if (reset == 1'b1) begin delay_pipeline[0] <= 0; delay_pipeline[1] <= 0; delay_pipeline[2] <= 0; delay_pipeline[3] <= 0; delay_pipeline[4] <= 0; delay_pipeline[5] <= 0; delay_pipeline[6] <= 0; delay_pipeline[7] <= 0; delay_pipeline[8] <= 0; delay_pipeline[9] <= 0; delay_pipeline[10] <= 0; delay_pipeline[11] <= 0; delay_pipeline[12] <= 0; delay_pipeline[13] <= 0; delay_pipeline[14] <= 0; delay_pipeline[15] <= 0; delay_pipeline[16] <= 0; delay_pipeline[17] <= 0; delay_pipeline[18] <= 0; delay_pipeline[19] <= 0; end else begin if (clk_enable == 1'b1) begin delay_pipeline[0] <= sumvector[0]; delay_pipeline[1] <= sumvector[1]; delay_pipeline[2] <= sumvector[2]; delay_pipeline[3] <= sumvector[3]; delay_pipeline[4] <= sumvector[4]; delay_pipeline[5] <= sumvector[5]; delay_pipeline[6] <= sumvector[6]; delay_pipeline[7] <= sumvector[7]; delay_pipeline[8] <= sumvector[8]; delay_pipeline[9] <= sumvector[9]; delay_pipeline[10] <= sumvector[10]; delay_pipeline[11] <= sumvector[11]; delay_pipeline[12] <= sumvector[12]; delay_pipeline[13] <= sumvector[13]; delay_pipeline[14] <= sumvector[14]; delay_pipeline[15] <= sumvector[15]; delay_pipeline[16] <= sumvector[16]; delay_pipeline[17] <= sumvector[17]; delay_pipeline[18] <= sumvector[18]; delay_pipeline[19] <= sumvector[19]; end end end // Delay_Pipeline_process assign mul_temp = inputreg * coeff11; assign product11 = mul_temp[50:0]; assign mul_temp_1 = inputreg * coeff12; assign product12 = mul_temp_1[50:0]; assign mul_temp_2 = inputreg * coeff13; assign product13 = mul_temp_2[50:0]; assign mul_temp_3 = inputreg * coeff14; assign product14 = mul_temp_3[50:0]; assign mul_temp_4 = inputreg * coeff15; assign product15 = mul_temp_4[50:0]; assign mul_temp_5 = inputreg * coeff16; assign product16 = mul_temp_5[50:0]; assign mul_temp_6 = inputreg * coeff17; assign product17 = mul_temp_6[50:0]; assign mul_temp_7 = inputreg * coeff18; assign product18 = mul_temp_7[50:0]; assign mul_temp_8 = inputreg * coeff19; assign product19 = mul_temp_8[50:0]; assign mul_temp_9 = inputreg * coeff20; assign product20 = mul_temp_9[50:0]; assign mul_temp_10 = inputreg * coeff21; assign product21 = mul_temp_10[50:0]; assign add_signext = $signed({{1{product21[50]}}, product21}); assign add_signext_1 = delay_pipeline[0]; assign add_temp = add_signext + add_signext_1; assign finalsum = add_temp[51:0]; assign add_signext_2 = $signed({{1{product20[50]}}, product20}); assign add_signext_3 = delay_pipeline[1]; assign add_temp_1 = add_signext_2 + add_signext_3; assign sumvector[0] = add_temp_1[51:0]; assign add_signext_4 = $signed({{1{product19[50]}}, product19}); assign add_signext_5 = delay_pipeline[2]; assign add_temp_2 = add_signext_4 + add_signext_5; assign sumvector[1] = add_temp_2[51:0]; assign add_signext_6 = $signed({{1{product18[50]}}, product18}); assign add_signext_7 = delay_pipeline[3]; assign add_temp_3 = add_signext_6 + add_signext_7; assign sumvector[2] = add_temp_3[51:0]; assign add_signext_8 = $signed({{1{product17[50]}}, product17}); assign add_signext_9 = delay_pipeline[4]; assign add_temp_4 = add_signext_8 + add_signext_9; assign sumvector[3] = add_temp_4[51:0]; assign add_signext_10 = $signed({{1{product16[50]}}, product16}); assign add_signext_11 = delay_pipeline[5]; assign add_temp_5 = add_signext_10 + add_signext_11; assign sumvector[4] = add_temp_5[51:0]; assign add_signext_12 = $signed({{1{product15[50]}}, product15}); assign add_signext_13 = delay_pipeline[6]; assign add_temp_6 = add_signext_12 + add_signext_13; assign sumvector[5] = add_temp_6[51:0]; assign add_signext_14 = $signed({{1{product14[50]}}, product14}); assign add_signext_15 = delay_pipeline[7]; assign add_temp_7 = add_signext_14 + add_signext_15; assign sumvector[6] = add_temp_7[51:0]; assign add_signext_16 = $signed({{1{product13[50]}}, product13}); assign add_signext_17 = delay_pipeline[8]; assign add_temp_8 = add_signext_16 + add_signext_17; assign sumvector[7] = add_temp_8[51:0]; assign add_signext_18 = $signed({{1{product12[50]}}, product12}); assign add_signext_19 = delay_pipeline[9]; assign add_temp_9 = add_signext_18 + add_signext_19; assign sumvector[8] = add_temp_9[51:0]; assign add_signext_20 = $signed({{1{product11[50]}}, product11}); assign add_signext_21 = delay_pipeline[10]; assign add_temp_10 = add_signext_20 + add_signext_21; assign sumvector[9] = add_temp_10[51:0]; assign add_signext_22 = $signed({{1{product12[50]}}, product12}); assign add_signext_23 = delay_pipeline[11]; assign add_temp_11 = add_signext_22 + add_signext_23; assign sumvector[10] = add_temp_11[51:0]; assign add_signext_24 = $signed({{1{product13[50]}}, product13}); assign add_signext_25 = delay_pipeline[12]; assign add_temp_12 = add_signext_24 + add_signext_25; assign sumvector[11] = add_temp_12[51:0]; assign add_signext_26 = $signed({{1{product14[50]}}, product14}); assign add_signext_27 = delay_pipeline[13]; assign add_temp_13 = add_signext_26 + add_signext_27; assign sumvector[12] = add_temp_13[51:0]; assign add_signext_28 = $signed({{1{product15[50]}}, product15}); assign add_signext_29 = delay_pipeline[14]; assign add_temp_14 = add_signext_28 + add_signext_29; assign sumvector[13] = add_temp_14[51:0]; assign add_signext_30 = $signed({{1{product16[50]}}, product16}); assign add_signext_31 = delay_pipeline[15]; assign add_temp_15 = add_signext_30 + add_signext_31; assign sumvector[14] = add_temp_15[51:0]; assign add_signext_32 = $signed({{1{product17[50]}}, product17}); assign add_signext_33 = delay_pipeline[16]; assign add_temp_16 = add_signext_32 + add_signext_33; assign sumvector[15] = add_temp_16[51:0]; assign add_signext_34 = $signed({{1{product18[50]}}, product18}); assign add_signext_35 = delay_pipeline[17]; assign add_temp_17 = add_signext_34 + add_signext_35; assign sumvector[16] = add_temp_17[51:0]; assign add_signext_36 = $signed({{1{product19[50]}}, product19}); assign add_signext_37 = delay_pipeline[18]; assign add_temp_18 = add_signext_36 + add_signext_37; assign sumvector[17] = add_temp_18[51:0]; assign add_signext_38 = $signed({{1{product20[50]}}, product20}); assign add_signext_39 = delay_pipeline[19]; assign add_temp_19 = add_signext_38 + add_signext_39; assign sumvector[18] = add_temp_19[51:0]; assign sumvector[19] = $signed({{1{product21[50]}}, product21}); assign output_typeconvert = finalsum[31:0]; always @ (posedge clk or posedge reset) begin: output_register_process if (reset == 1'b1) begin output_register <= 0; end else begin if (clk_enable == 1'b1) begin output_register <= output_typeconvert; end end end // output_register_process // Assignment Statements assign filter_out = output_register; endmodule // Hcfirt