praveenkumar1979@rediffmail.com (praveen) wrote in message news:<ff8a3afb.0402042131.48aa1cce@posting.google.com>...
> stephendeese@hotmail.com (stevo) wrote in message news:<25cad608.0402041515.26388489@posting.google.com>...
> Hello Stephen,
>
> 1. How do I convert a decimal number (0.378 for example) into Q15
> format?
> In Q15 format the input(X) must be between -1 and 0.999.
> For positive number ie 1>X>0 then X*2^15;
> For negative number ie X<0 then 2^16+X*2^15
> For X>1 then X=2^15;
>
>
> 2. How do I do the multiplication?
> Is the number 30,000 result of Q15 format then u can multiply if not u cannot
> multiple 30,000 with 0.378.
>
> 3. How do I convert the final 32 bit number back to the equivalent 16
> bit number?
> If u have two 1.15 number the result is 2.30 format. left shift one bit to get
> 1.31 format and u can take MSB 16 bit to get the result.
>
> regards
> praveen
Hi
Just wanted to mention that you have to do signed multiplication
between two Q15 numbers to geta Q30 product . As Praveen mentioned if
30,000 is a Q15 represented number then signed multiplication of
30,000(Q15 and .378 in Q15 would result in a fraction in Q30...
This must be pretty obvious but when doing these things in filter
implementation this might be the difference in having a round off
error or no round off error
Regards
Nithin
Reply by praveen●February 5, 20042004-02-05
stephendeese@hotmail.com (stevo) wrote in message news:<25cad608.0402041515.26388489@posting.google.com>...
Hello Stephen,
1. How do I convert a decimal number (0.378 for example) into Q15
format?
In Q15 format the input(X) must be between -1 and 0.999.
For positive number ie 1>X>0 then X*2^15;
For negative number ie X<0 then 2^16+X*2^15
For X>1 then X=2^15;
2. How do I do the multiplication?
Is the number 30,000 result of Q15 format then u can multiply if not u cannot
multiple 30,000 with 0.378.
3. How do I convert the final 32 bit number back to the equivalent 16
bit number?
If u have two 1.15 number the result is 2.30 format. left shift one bit to get
1.31 format and u can take MSB 16 bit to get the result.
regards
praveen
Reply by stevo●February 4, 20042004-02-04
Hi,
I am totally new to Q formats, and need to do the following:
Multiply a unsigned 16bith number by a decimal number < 1.
For example:
30,000 * .378 = 11,340
How do I do this in a 16 bit fixed point uP with hardware multiplier
The uP has the capable of doing 16x16 signed and unsigned
multiplication resulting in a 32bit number.
1. How do I convert a decimal number (0.378 for example) into Q15
format?
2. How do I do the multiplication?
3. How do I convert the final 32 bit number back to the equivalent 16
bit number?
Thanks
Stephen