This is one of the simple post series that'll write about because besides it simplicity, it could be very useful for somebody that's just looking for a simple implementation of a filter type IIR.

The IIR filter is the acronym of Infinite Impulse Response, what means that this type of filter does not becomes zero at the output in a certain amount of time, but it continues derivating indefinitely. The basic difference in it construction is that we have poles and zeros instead of FIR (Finite Impulse Response) where we have only zeros. Also, the IIR filters have nonlinear phase, what can cause some distortion into the signal that pass through the filter. The transfer function of this type of filter can be described as:

Where "a" are the terms of poles and "b" are the zeros of transfer function. If we rearrange the terms and isolate the output Y, we have the following equation of the filter:

So it's important highlight that we're treating in terms of Zs (Z transformation), where it holds by discrete filters, it can be analogous in Laplace transformation but as I implemented in Verilog, I'll just post it in digital terms. To compute the terms of the filter, we usually work with mathematical approximations such as:

  • Butterworth
  • Chebyshev type I
  • Chebyshev type II
  • Elliptic
  • Bessel
  • ...

I also use a program as Matlab Filter Design to generate the coefficients for me because it's not efficiency compute by hand each time that we wanna create one and change its specifications.

Trade-off IIR vs FIR

The filter implemented in the diagram of blocks above follows the direct form I, so I'm describing this because there're a lot of different ways to rearrange this filters and each implementation has it advantages. In my opinion, this is one of the best "as view" ways of implement it in hardware description languages or in embedded firmware devices.

The trade off between implement IIR or FIR is the amount of effort and time do you want to spend to create the filter according your specifications. Usually in FIR filters your coefficients will be integer numbers and you will need to aggregate much more terms to reach your specificiations than a IIR filters (higher order filter). But in IIR filters, each term of your filter will be a floating point coefficient and this could be hard to implement in hardware, if you work with fixed point number representation, truncating coefficients will significantly get worse your filter response. So, it depends on your target and specifications to decide which to implement it or not.

Example of implementation

As I needed to implement a simple version to test, I found out that it's kind of hard to find a implementation of this filter working, even a simpler than this. By this reason I decide to publish my implementation that could help somebody that aims to create something like that. So the specifications and the filter response (also as the link) can be found below:
Filter IIR in Verilog - Low pass filters

Low pass filter

  • Fs : 48000 Samples/s
  • Fc : 1000 Hz
  • Fs : 1500 Hz
  • Apass: 1dB
  • Astop: -15dB
  • Filter Structure : Direct-Form I, Second-Order Sections
  • Architecture: Cascade
  • Number of Sections : 3
  • Stable : Yes
  • Linear Phase : No
  • Arithmetic : fixed

Filter response

Testing it with ASK modulation:

Testing it with random noise:

If you enjoyed, just share and/or subscribe!