so -1.5 will become 1111.1100
Nobody else seems to notice that you keep saying -1.5 is equal to 1111.1100, I don't see how you get that value.
In 2's comp -1.5 = 1110.1000 = -2^3 + 2^2 + 2^1 + 2^-1 = -8 + 4 + 2 + .5 = -1.5
and 1111.1100 = -8 + 4 + 2 + 1 + .5 + .25 = -.25
So in the case of any Xilinx IP core, which performs 2's comp arithmetic (which is exactly the same as binary) the value -1.5 isn't 1111.1100 as you seem to think.
To produce the values using your non-standard format. You would have to take the 2's comp of the value 1110.1000 (-1.5).
e.g.
1110.1000 -1.5 (note value is '-' and save in a flag)
0001.0111 invert
0000.0001 add 1
0001.1000 +1.5
separate into integer and fractional...
0001 .1000 1 & .5
note flag from previously...
1110+0001 .1000 (2's comp of 1) & .5
1111 .1000 -1 & .5
dipin said:
in this case the problem is we need to output quotient and fraction seperately.
so it will become -1 and .5
I have no idea why you would want to do something like this. It doesn't make any sense to store the integer and fractional parts of a number separately. If you need the fractional part separately from the integer part at some point just perform the 2's comp conversion at that point and extract the fractional part.
Regards
- - - Updated - - -
After looking at some of your other posts...
There is no representation of a negative fraction without an integer portion as you have to have a '-1' to add positive fractional values to. I think the problem is you aren't thinking of the numbers as exponentially weighted sums, so negative fractions are really a weighted sum of fractions added to a negative unity value.
-0.5 in 1.4 2's comp = 1.1000 = -2^1 + 2^-1 = -1 + .5
and 0.5 in 1.4 2's comp = 0.1000 = 2^-1