UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Visitor vizzie
Visitor
9,293 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
Xilinx Employee
Xilinx Employee
9,292 Views
Registered: ‎08-16-2007

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

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
Visitor vizzie
Visitor
9,287 Views
Registered: ‎10-02-2008

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

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
Visitor sjulius2007
Visitor
8,270 Views
Registered: ‎01-16-2009

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

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