cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Visitor
Visitor
9,711 Views
Registered: ‎10-02-2008

Problem generating .coe (coefficients) file for a Polyphase FIR Decimator in MATLAB

Hi everyone

I have been trying to generate a .coe file in MATLAB for the Polyphase Decimator Filter Structure for an FIR Compiler design as follows:


Hlpf  = mfilt.firdecim(...);
hq = dfilt.dffir(hlpf.Numerator);

set(hq, 'Arithmetic',  'fixed');
coewrite(hq, 10, 'coefile');

 

Though I could get a .coe file after this, I am unsure if what I did was correct. The mfilt.firdecim is a Direct Form FIR Polyphase Decimator structure while dfilt.dffir is Direct Form FIR structure. So, how do I generate coefficients for the Polyphase decimator structure for the FIR compiler?

 

Any help would be greatly appreciated.

 

Regards,

Kumar Vijay Mishra.

0 Kudos
3 Replies
Highlighted
Xilinx Employee
Xilinx Employee
9,710 Views
Registered: ‎08-16-2007

Open the .coe file created and verify that it follows the COE File Syntax defined in the Xilinx ISE Help Guide.  Open the Help Guide and search for "COE File Syntax".

 

-Chris 

0 Kudos
Highlighted
Visitor
Visitor
9,705 Views
Registered: ‎10-02-2008

Thanks Chris for your reply.

 

Well, I can certainly write the coefile manually if that is the only option left. But is my method of generating the coe file for a polyphase decimator correct?

 

Regards,

 

vizziee.

0 Kudos
Highlighted
Visitor
Visitor
8,688 Views
Registered: ‎01-16-2009

Hello vizzie

 

You can do the following :

 

1)Design your filter in Matlab using FDA tool

2)Click on " Set quantization parameters" on the left side of GUI

3)Change "filter arithmetic" to Fixed point

4)Click on the Coefficients  tab to check the number of bits ( Numerator word length = 16 etc.).

5)Change "filter arithmetic" back to Full precision

6)Export the filter coefficients "Num" into Matlab workspace by clicking File->Export

7)Go to Matlab command prompt and type the following:

 

coef_set= round(Num * (2^(bits-1)));  Note :   [ bits = 16]

dlmwrite('mycoefile.coe',coef_set);

 

8)Now you will have a .coe file which contains the coefficients as      a,b.............. a  

9) Now you need to modify it so that it is suitable for Xilinx CORE.

 

A) Add the following lines at the beginning:

 

;
Radix = 10;
Coefficient_Width = 16;
CoefData =

 

 B) Change all the ' , ' to ' ; '

C) Add  a ' ; ' in the end

 

Now your file looks like :

 

;
Radix = 10;
Coefficient_Width = 16;
CoefData =  a;  b; ........... a;

 

D)Save the file

 

Now it should be okay for the Xilinx core.

 

Good luck

Mona

0 Kudos