This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Write Xilinx COE file




coewrite(hd) writes a XILINX Distributed Arithmetic FIR filter coefficient .COE file which can be loaded into the XILINX CORE Generator. The coefficients are extracted from the fixed-point dfilt object hd. Your fixed-point filter must be a direct form FIR structure dfilt object with one section and whose Arithmetic property is set to fixed. You cannot export single-precision, double-precision, or floating-point filters as .coe files, nor multiple-section filters. To enable you to provide a name for the file, coewrite displays a dialog box where you fill in the file name. If you do not specify the name of the output file, the default file name is untitled.coe.

coewrite(hd,radix) indicates the radix (number base) used to specify the FIR filter coefficients. Valid radix values are 2 for binary, 10 for decimal, and 16 for hexadecimal (default).

coewrite(...,filename) writes a XILINX.COE file to filename. If you omit the file extension, coewrite adds the .coe extension to the name of the file.

The coewrite function always generates the XILINX.COE file in your current folder. To use this function, you must have write permission in your current folder.


coewrite generates an ASCII text file that contains the filter coefficients in a format the XILINX CORE Generator can read and load. In this example, you create a 30th-order fixed-point filter and generate the .coe file that includes the filter coefficients as well as associated information about the filter.

b = firceqrip(30,0.4,[0.05 0.03]); hq = dfilt.dffir(b); 
set(hq,'arithmetic','fixed'); coewrite(hq,10,'mycoefile');

The coewrite function generates the output file, mycoefile.coe, in your current folder. The .coe file contains the radix, coefficient width, and filter coefficients. The file reports the filter coefficients in column-major order. The radix, coefficient width, and filter coefficients are the minimum set of data needed in a .coe file.

Introduced in R2011a

Was this topic helpful?