text to mif conversion ¶
By: johnludhi on Feb. 22, 2021, 2:50 a.m.
I am looking for something that would convert a text file (with fractional entries), with values to be stored in a LUT, into a mif file with hexadecimal entries.
For example, let a fractional value be 0.123456
For a 16-bit result, taking dec2hex( 0.123456* 2^14 ) would give out the hex conversion of decimal.
Overall, positive fractional values get converted into range 0 to 2^14, and 2^16 is added to the negative fractional values to get them in range 2^14 to 2^15.
If I now have both decimal AND fractional in a value, for example -15.123456 and I need to convert it to 16-bit-binary/4-bit-hexadecimal, how would I convert these to hex and maintain the range in which positive and negative values land?
Thank you in advance for your help.