DNA2683
Advanced Member level 4
- Joined
- Sep 3, 2012
- Messages
- 106
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,296
- Activity points
- 2,290
hi
i need to use a fixpoint in VHDL but i don't understand the principle...i have 32bit vector 16bit to fraction and 16 bit to integer
for example i need convert 2 numbers:
1. a positive number 266.7244 => what i did was converted the integer part to binary .and the fraction part to binary (i was multiplied the fraction by 2 and save the reminder ...)
for the integer i got "010A"(16) and for the fraction i got "00B9"(16) so i add the integer and the fraction and i got "010A00B9".
2. in the negative numbers i have a problem i'm trying to convert the number (-157.9295) so i used the same way as positive numbers i converted the integer part and got "FF63" and converted the fraction part an got "00ED" so i got "FF6300ED"(16) i know that i wrong....
how i calculate a negative number in fixed point?
do i calculate the positive numbers currectly?
thanks
i need to use a fixpoint in VHDL but i don't understand the principle...i have 32bit vector 16bit to fraction and 16 bit to integer
for example i need convert 2 numbers:
1. a positive number 266.7244 => what i did was converted the integer part to binary .and the fraction part to binary (i was multiplied the fraction by 2 and save the reminder ...)
for the integer i got "010A"(16) and for the fraction i got "00B9"(16) so i add the integer and the fraction and i got "010A00B9".
2. in the negative numbers i have a problem i'm trying to convert the number (-157.9295) so i used the same way as positive numbers i converted the integer part and got "FF63" and converted the fraction part an got "00ED" so i got "FF6300ED"(16) i know that i wrong....
how i calculate a negative number in fixed point?
do i calculate the positive numbers currectly?
thanks