**************************************************************************** IIR.asm Infinite impulse response filter (IIR) Analog Devices, Inc. DSP Division Three Technology Way P.O. Box 9106 Norwood, MA 02062 23-JUNE-2001 BJM This directory contains an example ADSP-2191, single-core Infinite Impulse Response (IIR) filter. The IIR code uses coefficients, in an ordered array and applies them to the filter. A detailed discussion of the IIR algorithm can be found in the source header comments of "IIR.ASM". Files contained in this directory: iir.asm ADSP-2191 source for an example IIR filter iir_test.asm ADSP-2191 source to call iir.asm adsp-2191.ldf Linker description file for the IIR example iir.dpj The VDSP project file for the IIR example. inreal_256.dat Input data for IIR example in 1.15 format. coefs_hex.dat Coefficients for IIR example in 1.15 format. _________________________________________________________________ CONTENTS I. FUNCTION/ALGORITHM DESCRIPTION II. IMPLEMENTATION DESCRIPTION III. DESCRIPTION OF INPUT DATA I. FUNCTION/ALGORITHM DESCRIPTION The IIR filter code executes a canonical form (also called direct form II) realization structure. The equation of the canonical form is w(n)=x(n) + b1*w(n-1) + b2*w(n-2) y(n)=w(n) + a1*w(n-1) + a2*w(n-2) The input sample is x(n) and the output is y(n). The term w(n) is the intermediate value; w(n-1) is the previous value and w(n-2) the one before that. The variables a and b are the coefficients for the filter. This example of canonical equation uses a variant that limits the summation in the canonical form to two. This type of IIR is called a biquad and is a second order filter. Higher order filters can be achieved by cascading several sections of biquads together. II. IMPLEMENTATION DESCRIPTION The assembly language module IIR_TEST.ASM initializes the input and coefficient buffers and then calls IIR.ASM. The first buffer declared, INBUF, is N_samp sample locations long. The next buffer declared, OUTBUF, is also N_samp samples long, and stores the output of the filter. DLINE is the third buffer declared. This buffer holds the delay line for each biquad. That is w(n-1) and w(n-2) for each biquad section of the filter. Since there are two past intermediate vales for each stage of the biquad, the length of this buffer is twice as long as the stages. The coefficient buffer, COEFS, contains the IIR filter coefficients. The coefficients are typically generated by a filter design software package. The linker descriptive file is ADSP-2191.LDF, which describes the hardware in terms of memory spaces and peripherals. Because there is no data dependency between DSP cores, it is possible to do perform an IIR in DSP core 1, while also performing an IIR in DSP core 2 on separate input data, using different coefficients. III. DESCRIPTION OF INPUT DATA 1. INPUT SAMPLES: ----------------- This IIR routine expects input data which conforms to the following criteria: Generate input data such that an array of input fixed point values are in 1.15 format, with the data being arranged in the following order: INPUT DATA indata(0) indata(1) indata(2) indata(3) etc... 2. COEFFICIENT DATA: ----------------------- This IIR routine expects [Biquad_secs*4] fixed point values to be used as coefficients. COEFFICIENT DATA A2(0) A1(0) B2(0) B1(0) ... ... ...