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.
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:
This MATLAB script processes an array of values and produces the correct values.