Forums

Floating point to fixed point conversion.

Started by Gowtham July 23, 2003
Hi,
I am Gowtham, i am doing project on DSP in speech compression, i have
written a program in C and i need to implement this on a fixed point
chip,so now i have to convert the floating point numbers into fixed
point and then implement the fixed point operations on the chip, i
would appreciate if anyone can help me in this regard.

Thanking all
Gowtham
Gowtham wrote:
> > Hi, > I am Gowtham, i am doing project on DSP in speech compression, i have > written a program in C and i need to implement this on a fixed point > chip,so now i have to convert the floating point numbers into fixed > point and then implement the fixed point operations on the chip, i > would appreciate if anyone can help me in this regard. > > Thanking all > Gowtham
There's a good paper at http://home.earthlink.net/~yatescr/fp.pdf "Fp" in this case stands for "fixed point". I wonder how to title a paper on floating point! :^) Google for more, but beware: There's a lot of gobbledygook out there. If you don't understand it, it's likely the author's problem than yours. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
HI Gowtham,

Just Google for these PDFs "Fixed-Point Arithmetic: An Introduction"
and "Practical Considerations in Fixed-Point FIR Filter
Implementations" both by Randy Yates ( He is also a member of this
group).

They are very informative and will be useful for ur proj

Regards,
Bhanu 


gowtsn@vandemataram.com (Gowtham) wrote in message news:<4ac858c.0307230157.6bcd266@posting.google.com>...
> Hi, > I am Gowtham, i am doing project on DSP in speech compression, i have > written a program in C and i need to implement this on a fixed point > chip,so now i have to convert the floating point numbers into fixed > point and then implement the fixed point operations on the chip, i > would appreciate if anyone can help me in this regard. > > Thanking all > Gowtham
"Gowtham" <gowtsn@vandemataram.com> wrote in message
news:4ac858c.0307230157.6bcd266@posting.google.com...
> Hi, > I am Gowtham, i am doing project on DSP in speech compression, i have > written a program in C and i need to implement this on a fixed point > chip,so now i have to convert the floating point numbers into fixed > point and then implement the fixed point operations on the chip, i > would appreciate if anyone can help me in this regard.
If you are rewriting your program in assembler, most assemblers accept floating-point values and convert them to fixed-point for you. Leon -- Leon Heller, G1HSM leon_heller@hotmail.com http://www.geocities.com/leon_heller
Leon Heller wrote:
> > "Gowtham" <gowtsn@vandemataram.com> wrote in message > news:4ac858c.0307230157.6bcd266@posting.google.com... > > Hi, > > I am Gowtham, i am doing project on DSP in speech compression, i have > > written a program in C and i need to implement this on a fixed point > > chip,so now i have to convert the floating point numbers into fixed > > point and then implement the fixed point operations on the chip, i > > would appreciate if anyone can help me in this regard. > > If you are rewriting your program in assembler, most assemblers accept > floating-point values and convert them to fixed-point for you. > > Leon > -- > Leon Heller, G1HSM > leon_heller@hotmail.com > http://www.geocities.com/leon_heller
That's not enough to make an algorithm work. Most of the time, the numbers need to be scaled, and often, multiplication needs to be handled differently. Jerry -- Engineering is the art of making what you want from things you can get. &#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
Jerry Avins <jya@ieee.org> wrote in message news:<3F1EEE31.61803387@ieee.org>...
> Leon Heller wrote: > > > > "Gowtham" <gowtsn@vandemataram.com> wrote in message > > news:4ac858c.0307230157.6bcd266@posting.google.com... > > > Hi, > > > I am Gowtham, i am doing project on DSP in speech compression, i have > > > written a program in C and i need to implement this on a fixed point > > > chip,so now i have to convert the floating point numbers into fixed > > > point and then implement the fixed point operations on the chip, i > > > would appreciate if anyone can help me in this regard. > > > > If you are rewriting your program in assembler, most assemblers accept > > floating-point values and convert them to fixed-point for you. > > > > Leon > > -- > > Leon Heller, G1HSM > > leon_heller@hotmail.com > > http://www.geocities.com/leon_heller > > That's not enough to make an algorithm work. Most of the time, the > numbers need to be scaled, and often, multiplication needs to be handled > differently. > > Jerry
One of the ways that you could do it is scale down the floating point values,e.g: you could scale all values by the max value and map all values in range (1,-1). In this case, you could then use the Q-format reperesentation for fixed point implementation. But you need to be careful while choosing the Q-format based on the DSP and the dynamic range of values. The quantization error might override the performance of the algorithm.A good analysis of the performance of the fixed point version and probably a few modifications to the algorithm might do the trick. Hope this helps! -Nithin
>... map all > values in range (1,-1). In this case, you could then use the Q-format > reperesentation for fixed point implementation.
Hello, I don't think so. Moreover I think almost in every function will be itself scaler against overflow. But the small scalers lead to big distortion. I gave amid and check in overflow suspicion points. Secondly check in suspicion points direct to zero rezult and again correct some scalers. Cheers, Victor
h2vic@yahoo.com (Vic) wrote in message news:<f52da19.0307240314.18dd84be@posting.google.com>...
> >... map all > > values in range (1,-1). In this case, you could then use the Q-format > > reperesentation for fixed point implementation. > > Hello, > I don't think so. Moreover I think almost in every function will be > itself scaler against overflow. But the small scalers lead to big > distortion. I gave amid and check in overflow suspicion points. > Secondly check in suspicion points direct to zero rezult and again > correct some scalers. > > Cheers, > Victor
Hi But if distortion can kept within acceptable limits scaling is not necessary to handle overflow especially in case of recursive algorithms. U may as well treat oveflows with saturation. Does'nt this work better? -Nithin
Nithin wrote:
> > h2vic@yahoo.com (Vic) wrote in message news:<f52da19.0307240314.18dd84be@posting.google.com>... > > >... map all > > > values in range (1,-1). In this case, you could then use the Q-format > > > reperesentation for fixed point implementation. > > > > Hello, > > I don't think so. Moreover I think almost in every function will be > > itself scaler against overflow. But the small scalers lead to big > > distortion. I gave amid and check in overflow suspicion points. > > Secondly check in suspicion points direct to zero rezult and again > > correct some scalers. > > > > Cheers, > > Victor > > Hi > > But if distortion can kept within acceptable limits scaling is not > necessary to handle overflow especially in case of recursive > algorithms. U may as well treat oveflows with saturation. Does'nt this > work better? > > -Nithin
Saturation is a form of distortion that is less objectionable than its alternative: wraparound. It can sometimes be inaudible and is occasionally used (in conjunction with low-pass filtering) to give voice signals more "punch" in the presence of noise at the expense of naturalness. The harmonics produced by saturation can lead to aliasing, not always correctable with a filter. Avoiding it is a good thing. Engineering involves compromise. Jerry -- Engineering is the art of making what you want from things you can get. &#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
I worked on audio compression on a 24 bits fixed point processor.
How many bits are your data registers? how many the accumulator?

for example:
if you have 24 bits data, the multiplication result would bit 48 bits long.
When you sum the multiplication results, you'll have a (48 bits + log N)
long result
where N is the the number of the addition operands and log is a radix-2
logarithm.

At the end you must shift and round the addition result back to 24 bits. So,
with a simulation (in matlab or whatsoever) look at the length of the
results and if it is L, you'll have to shift the result by (L-24) positions.

These are basic ideas to start.
Then if you have to deal with variable register length for filter
coefficients, you'll have to be really careful and see how the filter
response changes, especially in the case of IIR.

good luck
Emanuele

PS finally I'm a telecom engineer too!!! I graduated 2 days ago :-))))

"Gowtham" <gowtsn@vandemataram.com> ha scritto nel messaggio
news:4ac858c.0307230157.6bcd266@posting.google.com...
> Hi, > I am Gowtham, i am doing project on DSP in speech compression, i have > written a program in C and i need to implement this on a fixed point > chip,so now i have to convert the floating point numbers into fixed > point and then implement the fixed point operations on the chip, i > would appreciate if anyone can help me in this regard. > > Thanking all > Gowtham