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!

AR# 15254

8.1i CORE Generator - Can negative numbers be used in the Memory Core COE base-10 format?


The CORE Generator RAM\ROM coefficient file does not allow me to use negative numbers when I set the .coe file to the base-10 (decimal) format.


CORE Generator 8.1i and earlier versions cannot properly parse COE files with negative numbers.

To work around this, convert the number into the twos complement, then use the decimal version of the twos-complement number. 


For example


The number -10 in 7 bits is: (twos-complement) 




If the format was not twos-complement, the value in decimal for the same binary numbers would be 54. 


This is determined by the following formula: 


2*2^(N-1) + original value = changed value. 


This will give the correct decimal values needed to achieve the correct binary format.

When the output is assumed to be twos-complement, the intended negative decimal values will be correct.


The following script allows MATLAB to convert the .coe file: 


function out = coe_create(t) 


for (i=1:length(t)) 


if (t(i) < 0 ) 


t(i) = t(i) + (2* (2^11)); 






out = t; 


This MATLAB script processes an array of values and produces the correct values.

AR# 15254
Date 08/11/2014
Status Archive
Type General Article
  • ISE Design Suite
Page Bookmarked