| Author |
Message |
omara007
Joined: 06 Jan 2003 Posts: 1279 Helped: 39 Location: Dubai
|
02 Nov 2009 1:28 How to multiply 2 signed Fixed-Point numbers ? |
|
|
|
|
Hi guys
I have two 16-bit bit vectors .. each one represents a signed binary number. The format of each vector is as follows:
XXXX . XXXXXXXXXXXX
Where the (dot) represents the binary point that separates the integer part from the fraction part.
The Most Significant Bit order is (15), while the Least Significant Bit order is (0).
As the vector is signed, bits (12, 13, 14) represent the integer value while bit (15) is the sign bit. The numbers are represented in 2's complement format.
Now, I want to multiply these 2 vectors. I know that the result will be placed in a 32-bit vector. Yet, where will be the position of the binary point ? .. Please notice that it's a signed multiplication process.
|
|
| Back to top |
|
 |
GeorgeM
Joined: 19 Nov 2003 Posts: 37
|
02 Nov 2009 13:05 Re: How to multiply 2 signed Fixed-Point numbers ? |
|
|
|
|
| The fraction part is 12+12=24 bit long. Doesn't matter either it signed or not.
|
|
| Back to top |
|
 |
FvM
Joined: 22 Jan 2008 Posts: 5154 Helped: 766 Location: Bochum, Germany
|
02 Nov 2009 20:10 How to multiply 2 signed Fixed-Point numbers ? |
|
|
|
|
| Yes, so you have to drop 12 fractional bits and use saturation logic for the integer part.
|
|
| Back to top |
|
 |
Google AdSense

|
02 Nov 2009 20:10 Ads |
|
|
|
|
|
|
| Back to top |
|
 |
omara007
Joined: 06 Jan 2003 Posts: 1279 Helped: 39 Location: Dubai
|
03 Nov 2009 22:07 Re: How to multiply 2 signed Fixed-Point numbers ? |
|
|
|
|
| FvM wrote: |
| Yes, so you have to drop 12 fractional bits and use saturation logic for the integer part. |
Didn't understand what you said exactly .. please elaborate more ..
|
|
| Back to top |
|
 |
GeorgeM
Joined: 19 Nov 2003 Posts: 37
|
04 Nov 2009 12:53 Re: How to multiply 2 signed Fixed-Point numbers ? |
|
|
|
|
| You were told in plain english: the product fraction size will be 24 bit. That is (4.12) x (4.12) = (8.24).
|
|
| Back to top |
|
 |
FvM
Joined: 22 Jan 2008 Posts: 5154 Helped: 766 Location: Bochum, Germany
|
04 Nov 2009 13:30 How to multiply 2 signed Fixed-Point numbers ? |
|
|
|
|
Drop (or cut) 12 fractional bits is self-explanatory, I think. If you have doubts about needing saturation logic, you may want
to play around with numeric examples and consider, how you intend to handle a numeric overflow.
|
|
| Back to top |
|
 |
omara007
Joined: 06 Jan 2003 Posts: 1279 Helped: 39 Location: Dubai
|
05 Nov 2009 12:00 Re: How to multiply 2 signed Fixed-Point numbers ? |
|
|
|
|
| GeorgeM wrote: |
| You were told in plain english: the product fraction size will be 24 bit. That is (4.12) x (4.12) = (8.24). |
Thanks GeorgeM .. Yet, I don't think my last comment was intended for you .. did you notice that I quoted FvM ?
| FvM wrote: |
Drop (or cut) 12 fractional bits is self-explanatory, I think. If you have doubts about needing saturation logic, you may want
to play around with numeric examples and consider, how you intend to handle a numeric overflow. |
Yes FvM .. it's about Saturation Logic .. did you assume I won't use a 32bit register for the output ?
|
|
| Back to top |
|
 |