Hi Guys i want to implement iir filter in assembly in c64x processor. preferably fixed point algorithm. Here is the c code of iir filter which i have written.
#include<stdio.h>
void main()
{
float ip1_seq[10]={1,1,1,1};
float b[10]={0.049,0.074,0.105,0.074,0.049},a[10]={-1.715,1.726,-0.85,0.195};
int len_ip=4,al=5,bl=5;
int n,k,i,len_seq=0;
float op_seq[10]={0},op1_seq[10]={0},op2_seq[10]={0};
len_seq=al;
if(al!=bl)
len_seq=(al<bl)?bl:al;
if(len_seq!=len_ip)
len_seq=(len_seq<len_ip)?len_ip:len_seq;
for(i=len_ip;i<len_seq;i++)//padding zeros
ip1_seq[i]=0;
for(i=al;i<len_seq;i++)//padding zeros
a[i]=0;
for(i=bl;i<len_seq;i++)//padding zeros
b[i]=0;
//CIRCULAR CONVOLUTION EQUA IMPLEMENTATION
for(n=0;n<len_seq;n++)
{
for(k=0;k<=n;k++)
{
op1_seq[n]+=b[k]*ip1_seq[n-k];
}
for(k=0;k<=n;k++)
{
op2_seq[n]+=(-a[k])*op_seq[n-k];
}
op_seq[n+1]=op1_seq[n]+op2_seq[n];
}
//END OF CIRCULAR CONVOLUTION EQUATION
//DISPLAY OUTPUT
for(k=1;k<len_ip+1;k++)
printf("%f\n",op_seq[k]);
//END OF DISPLAY OUTPUT
}