12-03-2009 04:32 PM
As an example for what I would like to do: A floating point number can be coded as true form HEX like that (fxp 18/4):
-1,6554565429687500e+00 -> 1001 / 1010 / 0111 / 1100 / 1100 thus 9A7CC (9 is the signed integer part - MSB 1 beacause negativ). Is there a good way to make this translation?
Solved! Go to Solution.
12-03-2009 04:51 PM
12-03-2009 10:01 PM
ven_to wrote:
Next time I will be more carefull![]()
Does this mean the problem is solved or do you still need help?
12-04-2009 02:45 AM
The mantissa part of a float/double should hold the bit pattern you're interested in. Copy it to an integer and shift to match your fixed pattern. I think that's all.
/Y
12-04-2009 04:18 AM
Oh no.... unfortunately I still have the problem. I just formulated it not correctly in my first (ever) posting.
I have filter coefficients represented in floating point - the transformation in FPGA usable presentation (in my case 18bit/4Int) looks like represented below. Since this is a standard representation I suppose there is an easy way to represent this in LabView, but I don't find it.
-1,6554565429687500e+00 -> bin 1 110 01011000001110 -> 0x3960E
12-04-2009 04:59 AM
I dont think there's an easy way to do it, but it shouldn't be too hard either.
My previous answer still holds, but might need some explanation.
A float is stored as mantissa+exponent (much like the way you wrote the number). Assuming exponent is 0 (typically a number slightly between 0,5 - 1) the mantissa part IS your number. As such, bitmask that number to an integer and you've got it as fixed point (32/0). Shift the number as needed to move the "binal" point.
0,34512*2^0 (mantissa+exp)
0,34512 (mantissa)
34512 (fixed point version)
/Y
12-04-2009 10:13 AM - edited 12-04-2009 10:14 AM
Just cast the FXP to a U32, shift right by 14 bits, and display....
12-04-2009 02:36 PM
Thank you Altenbach, Knight of NI 🙂 !!!
Thank you, too Yamaeda!
Everything work fine now.