Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.
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.
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 include 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');When you look at mycoefile.coe, you see the following:
; XILINX CORE Generator(tm) Distributed Arithmetic
; FIR filter coefficient (.COE) File
; Generated by MATLAB(R) 7.8 and the Filter Design Toolbox 4.5.
Radix = 10;
Coefficient_Width = 16;
CoefData = -83,
3008,...coewrite puts the filter coefficients in column-major order and reports the radix, the coefficient width, and the coefficients. These represent the minimum set of data needed in a .coe file.