FPGA, CPLD, and ASIC solutions from Altera
  • Download Center
  • Literature
Sign in/register
myAltera Account
Welcome
  •   myAltera
  •   Logout
  • Products
    • Devices
    • Design Software
    • Intellectual Property
    • Development Kits/Cables
    • Design & Support Services
    • Literature
  • End Markets
    • Automotive
    • Broadcast
    • Computer & Storage
    • Consumer
    • Industrial
    • Medical
    • Military
    • Test & Measurement
    • Wireless
    • Wireline
  • Technology
    • DSP
    • External Memory
    • Embedded Processing
    • Transceivers
    • Parallel I/O
    • Signal Integrity
    • System Integration
  • Training
    • Training Courses
    • University Program
    • Webcasts & Videos
    • Demonstrations
    • Events Calendar
  • Support
    • Design & Support Resources
    • Knowledge Database
    • Devices
    • Design Software
    • Intellectual Property
    • Development Kits/Cables
    • Design Examples
    • Downloads
    • User Communities/Forums
    • mySupport
  • About Altera
    • About Us
    • Environmental
    • Customer Successes
    • Partners
    • Newsroom
    • Investor Relations
    • Jobs
    • Contact Us
  • Buy Online
    • Devices
    • Design Software
    • Development & Education Kits
    • Cables & Programming Hardware
    • Intellectual Property
  • Entire Site
  • Part Number
  • Knowledge Database
  • Support & Technical Docs
  • Forums & Wiki
Username:  
Password:  
 
Forgot my username or password
Don't have myAltera account? Register Now.
Enter your email address:

Verilog HDL: Basic IIR Filter

Home > Support > Design Examples > Verilog HDL > Verilog HDL: Basic IIR Filter

An infinite impulse response (IIR) filter is a recursive filter where the current output depends on previous outputs. The basic equation is shown below:

This is where n represents the order of the filter, and the ai and bi terms represent the coefficients of the filter, which consequently determine the filter characteristics. The feedback feature makes IIR filters useful in high-data throughput applications that require low hardware usage. However, the feedback adds complexity to the filter design as it introduces phase distortion and finite word length effects that may cause instability. Careful design consideration must be given to avoid unbounded conditions.

This becomes more critical as the filter order increases. To prevent overflow or instability, the transfer function is divided into second order filters called biquads. This is represented in the figure below as cascaded transfer functions.

These biquads can be individually scaled and cascaded, which minimizes quantization and recursive accumulation errors.

This IIR filter design uses two biquads to implement a fourth-order filter in Stratix®. The input is a 13-bit signed integer, the filter coefficients are scaled to 10 bits, and the output is 38 bits wide. For more details, see the Implementing High-Performance DSP Functions in Stratix & Stratix GX Devices chapter of the Stratix Device Handbook (PDF).

Download the files used in this example:

  • Download iir.zip
  • Download Basic IIR Filter Design Example README File

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:

  • base_iir.v - Top-level design file
  • base_iir_biquad.v - Second-order biquad structure
  • four_mult_add.v - Multiply-add function implemented using altmult_add Megafunction
  • two_mult_add.v - Multiply-add function implemented using altmult_add Megafunction
  • adder.v - Adder to store the intermediate feedback values implemented using logic cells
  • basic_iir.m - MATLAB script to verify functionality of design

Figure 1 contains the base_iir top-level block diagram.

Figure 1. base_iir Top-Level Block Diagram

Figure 1. base_iir Top-Level Block Diagram

Table 1 shows the basic IIR design example port listing.

Table 1. Basic FIR Filter Design Example Port Listing
Port Name Type Description
x[12..0] Input The input is a 13-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[37..0] Output Output of the IIR filter. This is 38 bits wide in the 24.14 signed binary fractional (SBF) format.


For more information on using this example, go to:

  • How to Use Verilog HDL Examples
  • Implementing High-Performance DSP Functions in Stratix & Stratix GX Devices chapter of the Stratix Device Handbook (PDF)

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.

Rate This Page


  • Products
    • MAX/MAX II
    • Stratix/Stratix GX
    • Nios II
  • Functionality
    • Arithmetic
    • External Memory Interfaces
    • On-Chip Memory
    • Bus & I/O Functions
    • Logic
    • Interfaces & Peripherals
    • DSP
    • Communications
    • PLL & Clocking
  • Design Entry
    • Quartus II
    • Tcl
    • VHDL
    • Verilog HDL
    • C Code
    • DSP Builder
    • TimeQuest
    • On-Chip Debugging
      • SignalTap II
  • Simulation Tools
    • Mentor Graphics ModelSim
    • Cadence NCsim
    • Synopsys VCS
  • Legacy Examples
    • Graphic Editor
    • AHDL
    Please give us feedback
    Products | End Markets | Technology | Training | Support | About Altera | Buy Online
    Jobs | Investor Relations | Contact Us | Site Map | Privacy | Legal Notice
    Copyright © 1995-2010 Altera Corporation. All Rights Reserved.
    Altera Forum
    Altera
    Forum
    Twitter
    Twitter
    RSS
    RSS
    Facebook
    Facebook
    Flickr
    Flickr
    YouTube
    YouTube
    Email Updates
    Email
    Updates