01-17-2012 06:54 PM
Hello everyone. I'm trying to use the Xilinx floating point (FP) Core v5.0 and I am having difficulty figuring out the format of the input values. I am clear that the core expects input values in the FP representation (with the exception of the fixed-to-float converter) described in DS335. However, after attempting to the follow DS335 and the Wiki page linked in another forum post, I'm not fully clear on how to properly represent the input. What I'm looking for is example inputs and the expected output. For example, if I wanted to multiply (or add) FP values 4.5 (decimal) and 2.5 (decimal), how would I represent these inputs as a 12-bit exponent and 20-bit fraction FP number to the core; the MSB of the exponent is a sign bit. The fixed point representation of 4.5 is 0x00480000 but I'm pretty certain that this hex value would not be the same in FP representation. What would I do differently?
Solved! Go to Solution.
01-18-2012 12:10 AM
take a look at the IEEE-745 floating point number standard. (Can be found in wikipedia, the german version is more helpful, with pictures and examples: http://de.wikipedia.org/wiki/IEEE_754 )
Float numbers do a normalisation of numbers, that means leading zeros are obmitted, and even the one that then appears as the first bit is dropped (because it has to be there, so it needs not to be stored).
So, your 32.20 fixed point becomes a 20.20 fixed point leaded by a 12 digit signed exponent that tells you how to shift this value to get the true number. (not to mention the sign bit at the beginning)
(There are more nasty tricks used to optimize storage and handling, see the details in the standard)
There are Java applets on the net that show how this works in detail. (google for yourself)
Actually, to use the FPcore for a single operation, you need three instances of it to simplify your life:
2) your actual operator (+-*/)
[2a)maybe some other float operations ]
Have a nice simulation
01-18-2012 07:43 AM
That wiki page is awesome and much much better than the US verson! It helped a lot for propely formating my FP values. I am doing both FP and Fixed-to-FP operations, i.e. I have some FP values and I also have fixed-point values to perform operations on. I believe I have a good understanding on what you said about fixed point values but I'm going to ask this question to get clarity on the Fixed-to-FP converter. Going back to my earlier post, the 12.20 fixed point value of 4.5 (decimal) is 32'h00480000 (Verilog), where the hex value 80000 is the 20-bit fraction part. If I use the Fixed-to-FP converter (configured as 12.20 in CoreGen) would 32'h00480000 be the proper input or would I need to do something different?
01-18-2012 11:19 PM
if configured correctly it should take the input as described (32'h00480000) and convert it to some FP number.
A short simulation and comparing the result to what you have learned now from Wikipedia should be sufficient to check this.
(Or you can simply use the Float2fixed converter core and see if it converts the number back to 4.5 decimal.)
For the details of controlling the core (handling controll signals, latency etc.) please refer to the datasheet.
Have anice simulation
01-20-2012 08:52 AM
Here is an website that contains a very useful conversion tool that may be helpful as well for checking your results.
01-23-2012 01:08 PM - edited 01-23-2012 01:08 PM
Thanks I did a few tests with the Fixed-to-float converter and verified the result with my calculated float from the web link you provided. Thanks for all the help.