element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
FPGA
  • Technologies
  • More
FPGA
Blog The Art of FPGA Design Season 2 Post 21
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join FPGA to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: fpgaguru
  • Date Created: 5 Aug 2025 2:16 AM Date Created
  • Views 767 views
  • Likes 8 likes
  • Comments 8 comments
  • xilinx
  • fpgafeatured
  • fpga
  • dsp
  • guest writer
Related
Recommended

The Art of FPGA Design Season 2 Post 21

fpgaguru
fpgaguru
5 Aug 2025

You cannot always trust AIs

I asked four major AI chat bots the same question: 

"What is the most efficient way to implement IIR filters? Reply in 40 words or less."

Here are the responses: 

Perplexity AI:

"Use a cascade of second-order (biquad) sections in Direct Form II for IIR filter implementation. This approach ensures computational efficiency, numerical stability, and is suitable for both software and hardware, especially when paired with careful scaling and quantization."

ChatGPT 4:

"The most efficient way to implement IIR filters is using Direct Form II Transposed structure, which minimizes memory usage and improves numerical stability by reducing the number of delay elements and limiting quantization noise propagation."

Claude Sonnet 4:

"Use Direct Form II (transposed) structure for best numerical stability and minimal memory. Implement with fixed-point arithmetic on embedded systems or floating-point for general use. Cascade second-order sections for higher-order filters to reduce quantization errors."

Grok 4:

"The most efficient way to implement IIR filters is using direct form II transposed structure, minimizing memory and computational complexity with biquad sections, optimized coefficients, and fixed-point arithmetic for real-time processing on DSPs or microcontrollers." 

All of them recommend the Direct Form II using a biquad cascade architecture and all of them are completely wrong. By a factor of 2.5x.

An IIR filter of order N will require 2.5N multiplications/output sample when implemented with a biquad cascade (every byquad has order 2 and uses 5 multiplications). This architecture also suffers from all the drawbacks mentioned in an earlier post, potential instability, coefficient quantization sensitivity issues, limit cycles, very difficult to pipeline, etc.

A much better architecture is a Lattice Wave Digital Filter structure, a 2-phase polyphase decomposition, with two branches implemented as cascades of second order all-pass sections, which I will describe in greater detail in a future post. An LWDF IIR filter of order N only needs N multiplications and there is even a bireciprocal version, very similar to FIR half-band filters, where half of the coefficients are zero, so only 0.5N multiplications/output sample.  

The most common topology for all pass sections is called Richards, coming from microwave transmission line theory. There are two equivalent discrete implementations, Type 1 and Type 2. They are functionally equivalent and differ only in the numerical rounding noise propagation as a function of the coefficient value. 

image

Type 1-B and 2-B can be used as first order all pass sections and cascading A and B Types creates a second order all pass section. Cascading second order sections and optionally one first order section if N is odd can create an all pass IIR filter of any order N. So the first and second order all-pass sections using this Richards topology look like this: 

image     image

The problem with these all pass building blocks is that they minimize the number of delays at the cost of extra adders. A second order Richards all pas section has two multiplications, two delays and six additions. For an FPGA implementation this is suboptimal, we would like to use two DSP primitives and no fabric adders, which means two multipliers and four adders. Fortunately, there is an alternate all pass section implementation, which only uses two multipliers and four adders, at the cost of more delays, which is not a problem for an FPGA implementation. Here are how the first and second order sections look like: 

image                image

and these are their H(z) transfer functions and the conditions for stability: 

image                      image

In general we also want to consider a packing factor n, where we replace every delay with n delays and z-1 becomes z-n in all formulas above.

The magnitude of the transfer function is obviously always 1.0, that's what all pass filters are all about. Calculating the phase of the transfer function is relatively easy but I drew the line at manually computing the derivative for the group delays. So I used the free Mathematica Online tool to calculate that for both first and second order all-pass sections with a packing factor n:

image               image

We can now use these formulas to compute both the phase and the group delay at any frequency f. Since a cascade of all pass sections is still all pass, both its phase and group delay are the sums of individual sections phases and group delays and we can use that to analyze any IIR filter built with first and second order sections. . 

In the next posts, I will show first how to pipeline the first and second order all pass blocks so that they fit efficiently into DSP primitives and run at the maximum possible clock frequency. Next we will see how these efficient all pass sections can be used to implement many types of IIR filters, including almost linear phase ones. 

In conclusion, there is no reason one should use biquad cascades, the LWDF architecture is superior in every way. 

To close on the whole AI subject and for full disclosure, I used Perplexity.AI to come up with the correct Mathematica syntax. 

Back to the top: The Art of FPGA Design Season 2

  • Sign in to reply

Top Comments

  • fpgaguru
    fpgaguru 2 months ago in reply to BigG +2
    The first two links are AI slop, not necessarily incorrect, but providing little to no useful information. The third link is interesting but there is very little detail on the FPGA side of things. I skimmed…
Parents
  • DAB
    DAB 2 months ago

    There is no short cut to understanding how to properly implement filters with FPGA technology.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • DAB
    DAB 2 months ago

    There is no short cut to understanding how to properly implement filters with FPGA technology.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube