The IIR filter in verilog created by filterbuilder cannot work!

5 views (last 30 days)
I need a lot of verilog IIR filter in my FPGA project and I used the filterbuilder to created the HDL filters.
After configuration it produced the verilog file and a testbench.
Well, I used modelsim to test the testbench created by the filterbuilder it worked well and passed the test.
Later I used a wave file data to replace the data in the testbench, the output became "xxxxxxxx". I don't know why this happened!
The head in the IIR file:
// ------------------------------------------------------------- // // Module: Hbp // // Generated by MATLAB® 8.0 and the Filter Design HDL Coder 2.9.2. // // Generated on: 2013-03-07 17:41:14 // // -------------------------------------------------------------
// ------------------------------------------------------------- // HDL Code Generation Options: // // TargetDirectory: C:\Documents and Settings\Administrator\桌面 // AddPipelineRegisters: on // Name: Hbp // TargetLanguage: Verilog // TestBenchName: Hbp_tb // TestBenchStimulus: step ramp chirp
// Filter Specifications: // // Sampling Frequency : 44 kHz // Response : Bandpass // Specification : N,Fp1,Fp2,Ap // Filter Order : 6 // First Passband Edge : 1 kHz // Second Passband Edge : 15 kHz // Passband Ripple : 1 dB // -------------------------------------------------------------
// ------------------------------------------------------------- // HDL Implementation : Fully parallel // Multipliers : 8 // Folding Factor : 1 // ------------------------------------------------------------- // Filter Settings: // // Discrete-Time IIR Filter (real) // ------------------------------- // Filter Structure : Direct-Form II, Second-Order Sections // Number of Sections : 3 // Stable : Yes // Linear Phase : No // Arithmetic : fixed // Numerator : s32,29 -> [-4 4) // Denominator : s32,30 -> [-2 2) // Scale Values : s32,29 -> [-4 4) // Input : s32,25 -> [-64 64) // Section Input : s32,17 -> [-16384 16384) // Section Output : s32,20 -> [-2048 2048) // Output : s32,20 -> [-2048 2048) // State : s32,25 -> [-64 64) // Numerator Prod : s64,54 -> [-512 512) // Denominator Prod : s64,55 -> [-256 256) // Numerator Accum : s80,54 -> [-33554432 33554432) // Denominator Accum : s80,55 -> [-16777216 16777216) // Round Mode : convergent // Overflow Mode : wrap // Cast Before Sum : true // -------------------------------------------------------------
The original testbench data (examples): filter_in_data_log_force[ 0] <= 32'h00000000; filter_in_data_log_force[ 1] <= 32'h02000000; filter_in_data_log_force[ 2] <= 32'h02000000; filter_in_data_log_force[ 3] <= 32'h02000000; filter_in_data_log_force[ 4] <= 32'h02000000; filter_in_data_log_force[ 5] <= 32'h02000000; filter_in_data_log_force[ 6] <= 32'h02000000; filter_in_data_log_force[ 7] <= 32'h02000000; filter_in_data_log_force[ 8] <= 32'h02000000; filter_in_data_log_force[ 9] <= 32'h02000000; filter_in_data_log_force[ 10] <= 32'h02000000; filter_in_data_log_force[ 11] <= 32'h02000000; filter_in_data_log_force[ 12] <= 32'h02000000; filter_in_data_log_force[ 13] <= 32'h02000000; filter_in_data_log_force[ 14] <= 32'h02000000; filter_in_data_log_force[ 15] <= 32'h02000000; filter_in_data_log_force[ 16] <= 32'h02000000; filter_in_data_log_force[ 17] <= 32'h02000000; filter_in_data_log_force[ 18] <= 32'h02000000; filter_in_data_log_force[ 19] <= 32'h02000000; filter_in_data_log_force[ 20] <= 32'h02000000; filter_in_data_log_force[ 21] <= 32'h02000000; filter_in_data_log_force[ 22] <= 32'h02000000; filter_in_data_log_force[ 23] <= 32'h02000000; filter_in_data_log_force[ 24] <= 32'h02000000; filter_in_data_log_force[ 25] <= 32'h02000000; ...
Wave file data: filter_in_data_log_force[ 1] <= 32'h00000233; filter_in_data_log_force[ 2] <= 32'h00000277; filter_in_data_log_force[ 3] <= 32'h00000328; filter_in_data_log_force[ 4] <= 32'h00000380; filter_in_data_log_force[ 5] <= 32'h00000433; filter_in_data_log_force[ 6] <= 32'h00000480; filter_in_data_log_force[ 7] <= 32'h00000518; filter_in_data_log_force[ 8] <= 32'h00000543; filter_in_data_log_force[ 9] <= 32'h00000546; filter_in_data_log_force[ 10] <= 32'h00000526; filter_in_data_log_force[ 11] <= 32'h00000480; filter_in_data_log_force[ 12] <= 32'h00000418; filter_in_data_log_force[ 13] <= 32'h00000346; filter_in_data_log_force[ 14] <= 32'h00000277; filter_in_data_log_force[ 15] <= 32'h00000220; filter_in_data_log_force[ 16] <= 32'h00000183; filter_in_data_log_force[ 17] <= 32'h00000166; filter_in_data_log_force[ 18] <= 32'h00000162; filter_in_data_log_force[ 19] <= 32'h00000162; filter_in_data_log_force[ 20] <= 32'h00000157; filter_in_data_log_force[ 21] <= 32'h00000139; filter_in_data_log_force[ 22] <= 32'h00000106; filter_in_data_log_force[ 23] <= 32'h00000062; filter_in_data_log_force[ 24] <= 32'h00000010; filter_in_data_log_force[ 25] <= 32'h00000037; ...
Errors: # ERROR in filter_out at time 32000 : Expected 'fffffff5' Actual 'xxxxxxxx' # ERROR in filter_out at time 32010 : Expected 'fffffff9' Actual 'xxxxxxxx' # ERROR in filter_out at time 32020 : Expected 'fffffff9' Actual 'xxxxxxxx' # ERROR in filter_out at time 32030 : Expected 'fffffff9' Actual 'xxxxxxxx' # ERROR in filter_out at time 32040 : Expected 'fffffff9' Actual 'xxxxxxxx' # ERROR in filter_out at time 32050 : Expected 'fffffff9' Actual 'xxxxxxxx' # ERROR in filter_out at time 32060 : Expected 'fffffffc' Actual 'xxxxxxxx' # ERROR in filter_out at time 32070 : Expected 'fffffff9' Actual 'xxxxxxxx' # ERROR in filter_out at time 32080 : Expected 'fffffffc' Actual 'xxxxxxxx' # ERROR in filter_out at time 32090 : Expected '00000000' Actual 'xxxxxxxx' # ERROR in filter_out at time 32100 : Expected 'fffffffc' Actual 'xxxxxxxx' # ERROR in filter_out at time 32110 : Expected '00000000' Actual 'xxxxxxxx' # ERROR in filter_out at time 32120 : Expected '00000004' Actual 'xxxxxxxx' # ERROR in filter_out at time 32130 : Expected '00000000' Actual 'xxxxxxxx' # ERROR in filter_out at time 32140 : Expected '00000000' Actual 'xxxxxxxx' # ERROR in filter_out at time 32150 : Expected '00000004' Actual 'xxxxxxxx' # ERROR in filter_out at time 32160 : Expected '00000004' Actual 'xxxxxxxx' # ERROR in filter_out at time 32170 : Expected '00000004' Actual 'xxxxxxxx' # ERROR in filter_out at time 32180 : Expected '00000004' Actual 'xxxxxxxx' # ERROR in filter_out at time 32190 : Expected '00000004' Actual 'xxxxxxxx' # ERROR in filter_out at time 32200 : Expected '00000004' Actual 'xxxxxxxx'
Ignore the 'Expected', I didn't modify these. I mean the 'Actual' why it became x?

Answers (1)

Bharath Venkataraman
Bharath Venkataraman on 3 Dec 2015
Are you able to see whether the filter input has Xs when you look at it in the ModelSim wave viewer? You can also analyze the other multiplier and adder output signals in ModelSim to see where the Xs are being propagated from.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!