Hardware Digital Filter Design

Finite and Infinite Impulse Response digital filters using VHDL

 

 Output screen shows how good a filter attenuates-and-amplifies specified frequencies. First graph shows input data (sound wave), second graph depicts output sound wave, third graph shows spectrogram, the last one shows Power-Spectral-Density. Output wave is produced by simulation process, which is compiled VHDL design.



Output screen of a design script. We can see all generated FIR filter taps values.

Design an optimal digital filter for hardware is not an easy task. There is a lot of nuances, which a hardware designer should take into account.

FIR vs IIR

Digital filter is a device capable to discriminate among incoming frequencies. Its task is to allow a given band of frequencies to pass through, while other frequencies will be stopped. There
are three common filter types: low-pass, band-pass and high-pass. A low-pass filter allows only frequencies below some cutoff value to pass through. A band-pass filter passes an arbitrary band of given frequencies and attenuates other frequencies. Low pass and band-pass digital filters form most part of the presented Channel Vocoder Analyzer.
    Two general classes of digital filters are Finite Impulse Response (FIR) and Infinite Impulse Response (IIR). The impulse response means the filter’s unique response to an unit impulse. A FIR filter has a finite impulse response, outputting only zero values after a finite number of non-zero values was produced.
IIR filter’s impulse response is non-zero over an infinite length of time. Implemented in hardware, IIR digital filters are fast, but they have poorer band-pass filtering characteristics and stability problems. FIR filters are stable but require more digital logic. In contrary, IIR filters can be unstable, but they can be usefull for high-frequencies filtering.

    The first task is to define the order of the FIR filters, or just to define the number of coefficients each FIR filter has. This number is proportional to the quality of the signal filtering. This number also depends on the sampling rate of the incoming signal.
    The second task is to calculate the coefficients for each FIR filter. There are different methods to do it. Most popular methods are the Parks-McClellan (also called Remez exchange algorithm) and the Windowing design method

Source code

C source and Makefile to build byte code for microcontroller
pong.mpu.tar.bz2 

Pong source and a python module to use serial port directly from a python application
pong.cpu.tar.bz2