Verilog HDL: Butterworth IIR Filter
Butterworth filters are also known as "maximally flat" filters because they have no passband ripple. They also have a monotonic response in both the stopband and passband. Butterworth filters tradeoff roll off steepness for their no-ripple characteristic.
The complexity of calculating the result of the Butterworth filter can be greatly reduced if the filter is broken down into several second order systems known as biquads. The higher the filter order, the better its characteristics, but the more complex it is to implement. By breaking a complex filter into biquads, this complexity is greatly reduced.
The transfer function of a Butterworth filter is shown below:
Since the coefficient for the z-1 term is twice that of the other terms in the numerator, it can be implemented using a series of shift and add operations. This optimization reduces the number of multipliers in each biquad to just two. A gain factor is introduced, but this can be corrected at the end of the cascade chain through a single multiplier.
This Butterworth infinite impulse response (IIR) filter design uses two biquads to implement a 4th order filter in Stratix™. The input is a 12-bit signed integer, the filter coefficients are scaled to 10 bits, and the output is 21 bits wide. For more details, see the Implementing High-Performance DSP Functions in Stratix & Stratix GX Devices chapter of the Stratix Device Handbook.
Download the files used in this example:
The use of this design is governed by, and subject to, the terms and conditions of the Altera Hardware Reference Design License Agreement.
Files in the download include:
- butterworth_iir.v - Top-level design file
- butterworth_iir_biquad.v - Second-order biquad structure
- two_mult_add.v - Multiply-add function implemented using altmult_add Megafunction
- fb_adder.v - Adder in the feedback path implemented using the lpm_add_sub Megafunction
- ff_adder1.v, ff_adder2.v - Adders in the feedforward path implemented using the lpm_add_sub Megafunction
- gain_blk.v - Gain block compensates for the gain factor at the end of the filtering stage
- butter_iir.m - MATLAB script to verify functionality of design
Figure 1 contains the butterworth_iir top-level block diagram.
Figure 1. butterworth_iir Top-Level Block Diagram
Table 1 shows the Butterworth IIR design example port listing.
| Table 1. Butterworth IIR Design Example Port Listing |
| Port Name |
Type |
Description |
| x[11..0] |
Input |
The input is a 12-bit signed integer. This is the x[n] time sample represented as an 18-bit signed input. |
| clk |
Input |
Clock |
| clken |
Input |
Clock enable |
| reset |
Input |
Reset |
| result[20..0] |
Output |
Output of the IIR filter. This is 21 bits wide in the 17.4 signed binary fractional (SBF) format. |
For more information on using this example, go to:
Design Examples Disclaimer
These design examples may only be used within Altera Corporation devices and remain the property of Altera. They are being provided on an “as-is” basis and as an accommodation; therefore, all warranties, representations, or guarantees of any kind (whether express, implied, or statutory) including, without limitation, warranties of merchantability, non-infringement, or fitness for a particular purpose, are specifically disclaimed. Altera expressly does not recommend, suggest, or require that these examples be used in combination with any other product not provided by Altera.
|