07-06-2009 01:42 PM
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.
07-06-2009 02:08 PM
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
07-06-2009 03:22 PM
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.
01-20-2010 10:00 AM
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