File Name: iirbiqdf1_012301.zip
File Contents: read_me.txt
filter.h
iir.asm
iir.bat
iir.sta
mds_def.h
tiir.c
tiir.h
timerfrio.dll
Module Name: iir
Label Name: __iir
Description: This program implements a biquad, DF1 form, IIR filter for 1.15 format data and coefficients.
The coefficient buffer that is passed should be in the order b2,b1,b0,a2,a1,Bb2,Bb1,Bb0,
Aa2,Aa1.......... The value of a0 is unity. The first two elements of the delay line are
x(-2) and x(-1). The rest of delay line buffer must be ordered as y(n-2), y(n-1) for each stage.
This program provides valid output only if the number of biquad stages is greater than one
(only for filter order greater than 2). The equation implemented is:
y(n) = b0 * x(n) + b1 * x(n-1) + b2 * x(n-2) - a1 * y(n-1) - a2 * y(n-2)
Note: The coefficients b's and a's generated using MATLAB can be used as it is. However, the
'a' coefficients have to be negated in some cases where the coefficient generation software
by itself gives negative 'a' coefficients.
Registers used:
R0, R1, R2, R3, R6, R7
I0 -> Address of the input buffer x[]
I1 -> Address of delay line buffer d[]
I2 -> Address of coefficient buffer c[]
I3 -> Address of Output y[]
P0 -> (No: of input samples+1) / 2
P1 -> Number of stages
P2
P5 -> Address of delay line buffer
[SP+12] -> Address of structure s
Function Prototype :
void iir(const fract16 x[],fract16 y[],int n,iir_state_fr16 *s);
x[] - input array
y[] - output array
n - number of input samples(even)
s - Structure of type iir_state_fr16:
typedef struct iir_state_fr16
{
fract16 *c, // coefficients
fract16 *d, // start of delay line
int k // no. of bi-quad stages
} iir_state_fr16;
Computation Time:
Total execution time for Number of Samples= Ni & number of biquad stages = B:
Kernal Cycle Count : (Ni/2){4 + ((B-1)*6) + 4}
: 3*Ni*B + Ni/2
Initialization : 33 + 7 = 40
For Ni=64 & B=2
Total execution time = 456 cycles
IIR filter code size : 222 bytes
IIR filter core size : 108 bytes