Sunday, December 16, 2007

Optimal Architectures

A digital filter implemented in software is typically run on a
processor with a single computational element. This forces
the filter to be implemented in a serial sum-of-products. A
FIR is implemented as a single sum-of-products and an IIR
is typically a sum of products for the feed-forward section
and another sum-of-products for the feedback section.
Hardware can be optimized for each application. Low speed
and low power can be achieved using a bit-serial
implementation. Moderate speed and power may call for a
single parallel multiplier-accumulator. High speed
applications can utilize multiple multiplier-accumulator
structures with specialized memory address schemes.
Decimating or interpolating filters can use optimized
polyphase structures, multiple stages and specialized
memory addressing schemes. Coefficient memory can be
designed to take advantage of coefficient characteristics and
accumulators can be custom-designed to take advantage of
unity gain properties.

Decimation and Interpolation

Decimation is reducing the output sampling rate
by ignoring all but every Mth sample. When a digital filter
reduces the bandwidth of a signal of interest so the filter
output is over-sampled if the input sample rate is preserved,
it is inefficient to compute outputs that will be ignored in the
decimation process. Thus, there is a one-to-one
correspondence between decimation rate and gain in
computational efficiency. However, this computational
efficiency can not be fully realized in an IIR filter because the
feedback path must be computed for every input cycle.

Saturday, December 15, 2007

Filter Response Design Methods

The total specification of the ideal filter includes the location
of passbands and stopbands, the minimum stopband
attenuation, the maximum passband ripple, the filter order,
and perhaps the shape of the response in some of the
specified bands.
Typically, there are three stages to the design of digital filter
responses for passband filters. First, the ideal filter response
is specified. Next, a floating point response is designed.
Finally, the floating point coefficients are quantized to yield a
fixed point response.
Creating a floating-point IIR filter response starts with a
prototype analog filter. Then an s-domain to z-domain
transformation is used to generate a set of digital filter
coefficients. Common methods of designing floating-point
FIR filter responses are windowing, frequency sampling, and
optimal. All are described in general digital signal processing
texts and are standard in most commercially available digital
filter design software packages.
Converting floating-point coefficients into fixed-point
coefficients requires quantizing the coefficients and
calculating the frequency domain impulse response of the
filter or filter model to verify that the filter meets the required
specification. If it does not, either the number of coefficient
bits can be increased, the filter response can be redefined
and step two repeated, or the filter arithmetic can be
redesigned, or a combination of these procedures can be
performed. When filter hardware is at a premium,
sophisticated simulated annealing techniques can be used
for both fixed-point FIR and IIR filters to produce the best set
of filter coefficients, given a fixed filter order and coefficient
width.

Strengths and Weaknesses

Because an IIR filter uses both a feed-forward polynomial
zeros as the roots) and a feedback polynomial (poles as the
roots), it has a much sharper transition characteristic for a
given filter order. Like analog filters with poles, an IIR filter
usually has nonlinear phase characteristics. Also, the
feedback loop makes IIR filters difficult to use in adaptive
filter applications.
Due to its all zero structure, the FIR filter has a linear phase
response when the filter’s coefficients are symmetric, as is
the case in most standard filtering applications. A FIR’s
implementation noise characteristics are easy to model,
especially if no intermediate truncation is used. In this
common implementation, the noise floor is at - 6.02 B + 6.02
log2NdB where B is the number of actual bits used in the
filter’s coefficient quantization and N is again the filter order.
This is why most Intersil filter ICs have more coefficient bits
than data bits.
An IIR filter’s poles may be close to or outside the unit circle
in the Z plane. This means an IIR filter may have stability
problems, especially after quantization is applied. An FIR
filter is always stable. FIR filters also allow development of
computationally efficient architectures in decimating or
interpolating applications, which will be described in more
detail later.

Mathematics Versus Physics

The characteristics of an analog filter are directly attributable
to the physics of the device that implements it. In contrast,
the characteristics of a digital filter are only indirectly
attributable to the physics of the device that implements it.
A digital filter’s passband ripple, shape factor, stopband
attenuation, and phase characteristics are all functions of
the order and type of polynomial used to approximate the
ideal impulse response, the number of bits used in
performing the arithmetic, and the type of architecture used
to implement the arithmetic. Actual frequencies have no
meaning in a digital filter except in their relation to the
sampling frequency. This is because the impulse response is
generated as a function of z-1, the sample interval (the time
between samples). For a smaller shape factor, the order of
the filter and the number of bits in the arithmetic can be
increased. The only physical limitation is the amount of
arithmetic processing that can be integrated on a device or
devices given the filter order and the input sampling rate.

Frequency-Domain Versus Time Domain Thinking

Thinking about analog filters, most engineers are
comfortable in the time domain. For example, the operation
of an RC lowpass filter can easily be envisioned as a
capacitor charging and discharging through a resistor.
Likewise, it is easy to envision how a negative-feedback
active filter uses phase shift as a function of frequency,
which is a time domain operation.
A digital filter is better conceptualized in the frequency
domain. The filter implementation simply performs a
convolution of the time domain impulse response and the
sampled signal. A filter is designed with a frequency domain
impulse response which is as close to the desired ideal
response as can be generated given the constraints of the
implementation. The frequency domain impulse response is
then transformed into a time domain impulse response
which is converted to the coefficients of the filter.

Analog Filters, Software-Based and

Owing to the way that analog and digital filters are physically
implemented, an analog filter is inherently more size-and
power-efficient, although more component-sensitive, than its
digital counterpart - if it can be implemented in a
straightforward manner. In general, as signal frequency
increases, the disparity in efficiency increases.
Characteristics of applications where digital filters are more
size and power efficient than analog filters are: linear phase,
very high stop band attenuation, very low pass band ripple;
the filter’s response must be programmable or adaptive; the
filter must manipulate phase and, very low shape factors (a
digital filter’s shape factor is the ratio of the filter’s pass band
width plus the filter’s transition band width to the filter’s pass
band width).
General-purpose digital signal microprocessors, now
commodity devices, are used in a broad range of
applications and can implement moderately complex digital
filters in the audio frequency range. Many standard signal
processing algorithms, including digital filters, are available
in software packages from digital signal processor and third
party vendors. As a result, software development costs are
trivial when amortized over production quantities.
The architectures of digital signal microprocessors are
usually optimized to perform a sum-of-products calculation
with data from RAM or ROM. They are not optimized for any
specific DSP function. However, to get extended sampling
rate performance from a digital filter requires hardware
designed to perform the intended filter function at the
desired sampling frequencies.
For example, Intersil Corporation offers a family of standard
digital filter products with several others in development.
Some hardware-specific digital filters can now sample at
rates approaching 75 Megasamples Per Second (MSPS).
Higher performance is possible for high volume applications
by limiting the range of parameters. Standard filter products
strike a balance between optimized filter architectures and
programmability by offering a line of configurable filters. That
is, these products are function-specific, with optimized
architectures and programmable parameters.

Essentials of Digital Filtering

A digital filter is simply a discrete-time, discrete-amplitude
convolver. An example is shown in Figure 1 for three-bit
amplitude quantization. Basic Fourier transform theory states
that the linear convolution of two sequences in the time
domain is the same as multiplication of two corresponding
spectral sequences in the frequency domain. Filtering is in
essence the multiplication of the signal spectrum by the
frequency domain impulse response of the filter. For an ideal
lowpass filter the pass band part of the signal spectrum is
multiplied by one and the stopband part of the signal by zero.

Recursive and non-recursive filters

For all the examples of digital filters discussed so far, the current output (yn) is calculated solely from the
current and previous input values (xn, xn-1, xn-2, ...). This type of filter is said to be non-recursive.
A recursive filter is one which in addition to input values also uses previous output values. These, like the
previous input values, are stored in the processor's memory.
The word recursive literally means "running back", and refers to the fact that previously-calculated output
values go back into the calculation of the latest output. The expression for a recursive filter therefore contains
not only terms involving the input values (xn, xn-1, xn-2, ...) but also terms in yn-1, yn-2, ...
From this explanation, it might seem as though recursive filters require more calculations to be performed,
since there are previous output terms in the filter expression as well as input terms. In fact, the reverse is
usually the case: to achieve a given frequency response characteristic using a recursive filter generally requires
a much lower order filter (and therefore fewer terms to be evaluated by the processor) than the equivalent nonrecursive
filter. This will be demonstrated later.

Order of a digital filter

The order of a digital filter is the number of previous inputs (stored in the processor's memory) used to
calculate the current output.
Thus:
1. Examples (1) and (2) above are zero-order filters, as the current output yn depends only on the current input
xn and not on any previous inputs.
2. Examples (3), (4) and (5) are all of first order, as one previous input (xn-1) is required to calculate yn. (Note
that the filter of example (3) is classed as first-order because it uses one previous input, even though the
current input is not used).
3. In examples (6) and (7), two previous inputs (xn-1 and xn-2) are needed, so these are second-order filters.
Filters may be of any order from zero upwards.

Operation of digital filters

In this section, we will develop the basic theory of the operation of digital filters. This is essential to an
understanding of how digital filters are designed and used.
Suppose the "raw" signal which is to be digitally filtered is in the form of a voltage waveform described by the
function
V x t = ( )
where t is time.
This signal is sampled at time intervals h (the sampling interval). The sampled value at time t = ih is
x x ih i = ( )
Thus the digital values transferred from the ADC to the processor can be represented by the sequence
x , x , x , x , ... 0 1 2 3
corresponding to the values of the signal waveform at
t = 0, h, 2h, 3h, ...
and t = 0 is the instant at which sampling begins.
At time t = nh (where n is some positive integer), the values available to the processor, stored in memory, are
x , x , x , x , ... x 0 1 2 3 n
Note that the sampled values xn+1, xn+2 etc. are not available, as they haven't happened yet!
The digital output from the processor to the DAC consists of the sequence of values
y , y , y , y , ... y 0 1 2 3 n
In general, the value of yn is calculated from the values x0, x1, x2, x3, ... , xn. The way in which the y's are
calculated from the x's determines the filtering action of the digital filter.
In the next section, we will look at some examples of simple digital filters.

Advantages of using digital filters

The following list gives some of the main advantages of digital over analog filters.
1. A digital filter is programmable, i.e. its operation is determined by a program stored in the processor's
memory. This means the digital filter can easily be changed without affecting the circuitry (hardware).
An analog filter can only be changed by redesigning the filter circuit.
2. Digital filters are easily designed, tested and implemented on a general-purpose computer or
workstation.
3. The characteristics of analog filter circuits (particularly those containing active components) are
subject to drift and are dependent on temperature. Digital filters do not suffer from these problems,
and so are extremely stable with respect both to time and temperature.
4. Unlike their analog counterparts, digital filters can handle low frequency signals accurately. As the
speed of DSP technology continues to increase, digital filters are being applied to high frequency
signals in the RF (radio frequency) domain, which in the past was the exclusive preserve of analog
technology.
5. Digital filters are very much more versatile in their ability to process signals in a variety of ways; this
includes the ability of some types of digital filter to adapt to changes in the characteristics of the
signal.
6. Fast DSP processors can handle complex combinations of filters in parallel or cascade (series),
making the hardware requirements relatively simple and compact in comparison with the equivalent
analog circuitry.

Analog and digital filters

In signal processing, the function of a filter is to remove unwanted parts of the signal, such as random noise, or
to extract useful parts of the signal, such as the components lying within a certain frequency range.
The following block diagram illustrates the basic idea.
There are two main kinds of filter, analog and digital. They are quite different in their physical makeup and in
how they work.
An analog filter uses analog electronic circuits made up from components such as resistors, capacitors and op
amps to produce the required filtering effect. Such filter circuits are widely used in such applications as noise
reduction, video signal enhancement, graphic equalisers in hi-fi systems, and many other areas.
There are well-established standard techniques for designing an analog filter circuit for a given requirement.
At all stages, the signal being filtered is an electrical voltage or current which is the direct analogue of the
physical quantity (e.g. a sound or video signal or transducer output) involved.
A digital filter uses a digital processor to perform numerical calculations on sampled values of the signal. The
processor may be a general-purpose computer such as a PC, or a specialised DSP (Digital Signal Processor)
chip.
The analog input signal must first be sampled and digitised using an ADC (analog to digital converter). The
resulting binary numbers, representing successive sampled values of the input signal, are transferred to the
processor, which carries out numerical calculations on them. These calculations typically involve multiplying
the input values by constants and adding the products together. If necessary, the results of these calculations,
which now represent sampled values of the filtered signal, are output through a DAC (digital to analog
converter) to convert the signal back to analog form.
Note that in a digital filter, the signal is represented by a sequence of numbers, rather than a voltage or current.
The following diagram shows the basic setup of such a system.

Pole-Zero Placement Filter Design

Figure 3 shows the Pole-Zero Placement filter design panel. The panel includes a graphical interface with the z-plane
pole and zero cursors on the left side, and a text-based interface with digital controls on the right side. This panel can
be used to design IIR digital filters by manipulating the filter poles and zeros in the z plane. The poles and zeros
initially may have come from classical IIR designs. You can also use this panel to move or delete existing poles and
zeros directly on the z plane plot for accurate control of their important characteristics. You can describe the poles
and zeros by using either the text entry or the cursors in the z-plane plot. As the cursors are changed, the text entries
update automatically. Likewise, as the text entries are modified, the pole/zero cursors update automatically. The pole
and zero locations in the z-plane, the characteristics of each pole and zero, the gain, and the sampling rate fully
describe pole-zero filter designs. Any change in these parameters corresponds to a change in the filter coefficients.
The DFD Toolkit matches the poles and zeros and creates stable second-order stages for IIR filter coefficients. It then
uses these coefficients to compute the filter magnitude response. The Magnitude vs Frequency plot updates
automatically whenever the poles or zeros are changed giving an immediate graphical feedback to the users pole-zero
filter designs.

Classical FIR Filter Design

The classical FIR Design panel (Fig. 2) is used to design FIR filters. These filters include the classic types such as
lowpass, highpass, bandpass, and bandstop and employ the Parks-Mclellan equiripple FIR filter design algorithm.
This panel is very similar to the Classical IIR Design panel and operates in much the same way. The panel includes
a graphical interface with the Magnitude vs Frequency cursors and plot on the left side and a text-based interface with
digital controls on the right side. You design classical FIR filters adjusting the desired filter specifications. The
desired passband and stopband requirements define a filter specification. You define the filter requirements by using
either text entry or the cursors in the Magnitude vs Frequency graph. As the cursors are moved, the text entries are
updated accordingly.

Classical IIR Filter Design

The Classical IIR Filter Design (Fig. 1) panel is used to design classical IIR digital filters. These filters include the
classic types such as lowpass, highpass, bandpass, and the classic designs such as Butterworth, Chebyshev, Inverse
Chebyshev, and Elliptic. The IIR Design panel consists of a graphical interface with the Magnitude vs Frequency
cursors and plot on the left side and a text-based interface with digital controls on the right side. You design classical
IIR filters by adjusting the filter specifications on the panel. You design the passband and stopband requirements
either by using the text entry or the cursors in the Magnitude vs Freqeuncy graph. As the cursors are moved, the text
entries are updated accordingly.

Digital Filter Design Application

The Digital Filter Design (DFD) Toolkit is a complete filter design and analysis tool that you can use to design
digital filters to meet required filter specifications. The underlying filter design software is implemented in LabVIEW
(References 2 and 3), a complete graphical software development system. With the toolkit, users can graphically
design IIR and FIR filters, interactively review filter responses, save filter design work, and load design work from
previous sessions. In addition, the DFD Toolkit includes a digital filter DLL that can be accessed from other
Windows applications such as Visual Basic or Microsoft C. Plus, the DFD Toolkit includes functions so that other
applications such as LabVIEW and LabWindows/CVI can load the filter coefficient and execute the filter design
within the environment. Lastly, interactive real-world filter testing can be performed within the DFD application
using a standard National Instruments data acquisition device. You can view the time waveforms or the spectra of
both the input signal and the filtered output signal to show how the present filter performs on real-world signals.
This feature delivers the ability to test the filter design before it is implemented in a custom application in
LabVIEW, LabWindows, Visual Basic, or Microsoft C.

Digital Filter Design Process

Digital filters are used in a wide variety of signal processing applications, such as spectrum analysis, digital image
processing, and pattern recognition. Digital filters eliminate a number of problems associated with their classical
analog counterparts and thus are preferably used in place of analog filters. Digital filters belong to the class of
discrete-time LTI (linear time invariant) systems, which are characterized by the properties of causality, recursibility,
and stability. They can be characterized in the time domain by their unit-impulse response, and in the transform
domain by their transfer function. Obviously, the unit-impulse response sequence of a causal LTI system could be of
either finite or infinite duration and this property determines their classification into either finite impulse response
(FIR) or infinite impulse response (IIR) system. To illustrate this, we consider the most general case of a discretetime
LTI system with the input sequence denoted by x(kT) and the resulting output sequence y(kT). As it can be seen
from (1), if for at least one v, a n ¹ 0, the corresponding system is recursive; its impulse response is of infinite
duration (IIR system). If a n = 0, the corresponding system is nonrecursive (FIR system); its impulse response is of
finite duration and the transfer function H(z) is a polynomial in z-1 . Commonly, bm is called the mth forward
filter coefficient and a n the nth feedback or reverse filter coefficient.
The design of digital filters involves the following basic steps:
· Determine the desired response. The desired response is normally specified in the frequency domain in terms of
the desired magnitude response and/or the desired phase response.
· Select a class of filters (for example, linear-phase FIR filters or IIR filters) to approximate the desired response.
· Select the best member in the filter class.
Implement the best filter using a general purpose computer, a DSP, or a custom hardware chip.
· Analyze the filter performance to determine whether the filter satisfies all the given criteria.

Introduction

The importance of digital filters is well established. Digital filters, and more generally digital signal processing
algorithms, are classified as discrete-time systems. They are commonly implemented on a general purpose computer
or on a dedicated digital signal processing (DSP) chip. Due to their well-known advantages, digital filters are often
replacing classical analog filters. In this application note, we introduce a new digital filter design and analysis tool
implemented in LabVIEW with which developers can graphically design classical IIR and FIR filters, interactively
review filter responses, and save filter coefficients. In addition, real-world filter testing can be performed within the
digital filter design application using a plug-in data acquisition board.Digital Signal Processing (DSP) affords greater flexibility, higher
performance (in terms of attenuation and selectivity), better
time and environment stability and lower equipment production
costs than traditional analog techniques. Additionally, more and
more microprocessor circuitry is being displaced with costeffective
DSP techniques and products; an example of this is
the emergence of DSP in cellular base stations. Components
available today let DSP extend from baseband to intermediate
frequencies (IFs). This makes DSP useful for tuning and signal
selectivity, and frequency up and down conversion.
These new DSP applications result from advances in digital
filtering. This Application Note will overview digital filtering by
addressing concepts which can be extended to baseband
processing on programmable digital signal processors.