Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

Embedded Systems

Fixed-Point DSP and Algorithm Implementation


Application Example – Filters
A simplified definition of a filter is a function which allows certain frequencies to pass unaltered while reducing or eliminating frequencies in other ranges. Filtering is a very common DSP algorithm implementation. Filters implemented within DSP processors are called digital filters. It is possible to implement digital filters which could be easily implemented with analog circuitry. It is also possible to implement digital filters which would be very difficult or complex to implement in the analog domain. There are many different named digital filter types with different characteristics, complexities and implementations. Two of the most common filter forms are the FIR and IIR filters. The following table presents some essential digital filter definitions and terminology.

TermDefinition
Impulse ResponseA digital filter's output sequence after a single cycle impulse (maximum value) input where the impulse is preceded and followed by an infinite number of zero-valued inputs
Finite Impulse Response Filter (FIR)A class of non-recursive digital filters with no internal data feedback paths. An FIR's output values will eventually return to zero after an input impulse. FIR filters are unconditionally stable.
Infinite Impulse Response Filter (IIR)A class of recursive digital filters with internal data feedback paths. An IIR's output values do not ever have to return to zero (theoretically) after an input impulse, however in practice output values do eventually reach negligibly small values. This filter form is prone to instability due to the feedback paths.
Filter coefficientsThe set of constants (also called tap weights) which are multiplied against filter data values within a filter structure
TapAn operation within a filter structure which multiplies a filter coefficient times a data value. The data value can be a current or delayed input, output or intermediate value.
Limit cycle effectA filter's output will decay down to a specific range and then exhibit continuing oscillation within a limited amplitude range if the filter input is presented non-zero value inputs (excited) followed by a long string of zero-value inputs
Filter orderEqual to the number of delayed data values which must be stored in order to calculate a filter's output value.
Recursive filterA filter structure in which feedback takes place and previous input and output samples are used in the calculation of the current filter output value
Table 2. Digital Filter Terminology

In general IIR filters are more susceptible to finite word length effects such as truncation and arithmetic errors since errors in filter calculation recirculate via feedback paths and errors can build up over time. Further, the higher the order of the filter the more it suffers from quantization effects. In fact IIR filters are so sensitive that few are implemented higher than second order. This is why IIR filters are usually realized in combinations of second order filter sections.

An interesting fixed word length effect can occur in a fixed word length implementation of an IIR filter. In an infinite precision IIR filter implementation the output of the filter will decay asymptotically toward zero if a non-zero input is followed by a long string of zeros. For the same filter implemented in a fixed word length DSP implementation with the same input string the output may decay down to a certain magnitude, after which it will exhibit an oscillating output bounded by some small amplitude range. This is referred to as zero-input limit cycle behavior.

Limit cycling behavior is a result of the truncation of the coefficient values implemented within the feedback paths of the filter. Evaluation of this behavior is complex and difficult. Limit cycle effects do not affect FIR filter implementations since FIR filter implementation forms do not contain any feedback paths. FIR filter implementations generally require one MAC operation for each filter tap.

Algorithm Implementation &ndash Scaling Factor Determination
Scaling factors must be chosen carefully. Scaling factor value determination is based on system characteristics including input signal range, intermediate operation groups, and the implemented order of arithmetic operations.

A companion technique which can reduce the amount of scaling required is rearranging the structure of an algorithm's implementation. By choosing to implement a cascaded rather than direct filter form (detailed in advanced texts) the designer has the option of implementing intermediate sub-stage specific scaling. This intermediate scaling often results in smaller sub-stage scaling than would be required for an equivalent direct form filter implementation.

Detailed discussion of analytical and simulation-based algorithm overflow detection and prevention and implementation of data scaling to minimize signal quantization effects caused by truncation are discussed in great detail in various comprehensive DSP texts.

Conclusion
Implementation of DSP algorithms on fixed point DSP processors requires formatting and storing data values and coefficients in signed binary format within finite length registers. The effects of fixed word length numeric calculations and representation are significant sources of inaccuracy and noise in digital systems. The forced quantization of both incoming data and pre-calculated coefficients results in some loss of system accuracy. Internal arithmetic operations also contribute to system accuracy loss. Some of these error sources can be reduced through algorithm implementation analysis and implementation modifications.

While there are some extra implementation and programming efforts which must be made to implement algorithms in fixed point DSPs there are major advantages as well. If a fixed point DSP can do the job and the final product is both high volume and cost sensitive, the use of a lower cost fixed point DSP processor can be justified from an overall system value analysis.


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.