User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Assembly section within the Software Development category of DaniWeb, a massive community of 403,029 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,841 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Assembly advertiser: Programming Forums
Views: 552 | Replies: 1
Reply
Join Date: May 2008
Posts: 1
Reputation: greg6666 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
greg6666 greg6666 is offline Offline
Newbie Poster

IIR Filter implementation in TMS320C6416?

  #1  
May 16th, 2008
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.

  1.  
  2. #include<stdio.h>
  3. void main()
  4. {
  5.  
  6. float ip1_seq[10]={1,1,1,1};
  7. float b[10]={0.049,0.074,0.105,0.074,0.049},a[10]={-1.715,1.726,-0.85,0.195};
  8. int len_ip=4,al=5,bl=5;
  9. int n,k,i,len_seq=0;
  10. float op_seq[10]={0},op1_seq[10]={0},op2_seq[10]={0};
  11.  
  12. len_seq=al;
  13. if(al!=bl)
  14. len_seq=(al<bl)?bl:al;
  15. if(len_seq!=len_ip)
  16. len_seq=(len_seq<len_ip)?len_ip:len_seq;
  17.  
  18.  
  19. for(i=len_ip;i<len_seq;i++)//padding zeros
  20. ip1_seq[i]=0;
  21.  
  22. for(i=al;i<len_seq;i++)//padding zeros
  23. a[i]=0;
  24.  
  25. for(i=bl;i<len_seq;i++)//padding zeros
  26. b[i]=0;
  27.  
  28. //CIRCULAR CONVOLUTION EQUA IMPLEMENTATION
  29.  
  30. for(n=0;n<len_seq;n++)
  31. {
  32.  
  33. for(k=0;k<=n;k++)
  34. {
  35. op1_seq[n]+=b[k]*ip1_seq[n-k];
  36. }
  37.  
  38. for(k=0;k<=n;k++)
  39. {
  40. op2_seq[n]+=(-a[k])*op_seq[n-k];
  41. }
  42. op_seq[n+1]=op1_seq[n]+op2_seq[n];
  43. }
  44.  
  45.  
  46. //END OF CIRCULAR CONVOLUTION EQUATION
  47.  
  48.  
  49. //DISPLAY OUTPUT
  50.  
  51. for(k=1;k<len_ip+1;k++)
  52. printf("%f\n",op_seq[k]);
  53.  
  54. //END OF DISPLAY OUTPUT
  55.  
  56.  
  57.  
  58.  
  59.  
  60. }
Last edited by Ancient Dragon : May 17th, 2008 at 1:46 am. Reason: add code tags
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2005
Posts: 3,411
Reputation: Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of 
Rep Power: 21
Solved Threads: 388
Colleague
Salem's Avatar
Salem Salem is offline Offline
void main'ers are DOOMed

Re: IIR Filter implementation in TMS320C6416?

  #2  
May 17th, 2008
So what do you want us to do about it?

Do you have a C compiler which targets your processor?
The GCC compiler does - http://gcc.gnu.org/onlinedocs/gcc-4....bmodel-Options

Having found that, does your existing algorithm have adequate performance without resorting to hand-crafting fixed point for everything?

As a first step, I would consider wrapping each of the floating point operations as function calls, to make for easier substitution later on. Of course, if you did this in C++, it would be a breeze as you could just write a fixed point class with a few inline functions and let it do all th e work for you.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
Do not PM me for help; You'll be ignored, or told to learn to read.
Do not ask me if I'm muslim - I'm not. Nor do I care about yours or anyone else's mysticism. Religion is a matrix, take the RED PILL.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Assembly Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the Assembly Forum

All times are GMT -4. The time now is 10:49 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC