Forums

Type fixed piont

Started by SDV May 30, 2006
Hi,
I'm working with an ADSP-BF533 which uses fixed point arithmetic.
Have I, for this reason, some limitation with type declaration (like double, 
float, ...)?

-- 
My english is bad...if I made some mistaches you'll tell me please! 


SDV wrote:
> Hi, > I'm working with an ADSP-BF533 which uses fixed point arithmetic. > Have I, for this reason, some limitation with type declaration (like double, > float, ...)?
No, no limitation, if you use float types the complier will just generate software emulated floating point code using fixed point math, the code will be a lot slower then if you had a processor with hardware floating point, and the code will take up more memory, but it will work fine otherwise. steve
SDV wrote:
> Hi, > I'm working with an ADSP-BF533 which uses fixed point arithmetic. > Have I, for this reason, some limitation with type declaration (like double, > float, ...)? >
Your english isn't that bad. I assume you're working in C, but the answer would apply to other languages. If you declare something as float or double you're telling the compiler to use floating point arithmetic on it. Whatever bad thing is driving you to use fixed point will happen when you try to do arithmetic on the data. The 'bad things' that I have seen include failures to link (because there was no floating point library), crashes at run time when the arithmetic was attempted (because the floating point library was broken for the particular hardware), slow operation (because there was no FP hardware and software floating point is, well, slow). In a system where the only issue is speed of execution I will often use floating point in the setup portions of the code so that people following me will have an easier time reading it. Then I'll do the actual signal processing in fixed point. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Posting from Google? See http://cfaj.freeshell.org/google/ "Applied Control Theory for Embedded Systems" came out in April. See details at http://www.wescottdesign.com/actfes/actfes.html
If I want to take the code faster, without emulation of floating point, what 
kind of type can I use?

-- 
My english is bad...if I made some mistaches you'll tell me please!

"steve" <bungalow_steve@yahoo.com> ha scritto nel messaggio 
news:1149009313.948838.198010@u72g2000cwu.googlegroups.com...
> > SDV wrote: >> Hi, >> I'm working with an ADSP-BF533 which uses fixed point arithmetic. >> Have I, for this reason, some limitation with type declaration (like >> double, >> float, ...)? > > No, no limitation, if you use float types the complier will just > generate software emulated floating point code using fixed point math, > the code will be a lot slower then if you had a processor with hardware > floating point, and the code will take up more memory, but it will work > fine otherwise. > > steve >
SDV wrote:

(top posting fixed)

 >-- My english is bad...if I made some mistaches you'll tell me please! 
 >"steve" <bungalow_steve@yahoo.com> ha scritto nel messaggio 
 >news:1149009313.948838.198010@u72g2000cwu.googlegroups.com...

 >>
 >> SDV wrote:
 >
 >>>> Hi,
 >>>> I'm working with an ADSP-BF533 which uses fixed point arithmetic.
 >>>> Have I, for this reason, some limitation with type declaration (like
 >>>> double,
 >>>> float, ...)?
 >
 >>
 >> No, no limitation, if you use float types the complier will just
 >> generate software emulated floating point code using fixed point math,
 >> the code will be a lot slower then if you had a processor with hardware
 >> floating point, and the code will take up more memory, but it will work
 >> fine otherwise.
 >>
 >> steve

> If I want to take the code faster, without emulation of floating point, what > kind of type can I use? >
Fixed point, of course. Try doing a web search on "fractional" and "DSP". -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Posting from Google? See http://cfaj.freeshell.org/google/ "Applied Control Theory for Embedded Systems" came out in April. See details at http://www.wescottdesign.com/actfes/actfes.html
SDV wrote:
> If I want to take the code faster, without emulation of floating point, what > kind of type can I use? >
you need to use the int type and use fixed point math, it will be 50x faster, but I assume you don't any experience with fixed point math. You probably need to use a SHARC processor, this processor has hardware support for floating point, in this case you just use the float types with no impact to speed. If you are stuck using the ADSP-BF533 blackfin, then you have to learn fixed point math, which is not trival, or, if you are doing very common DSP things you can use fixed point math routines already written. You can call them and build a shell around them, doing high level type stuff using floating point emulation. That way you get the benefits of fixed point speed without the high learning curve.
You'll see that I'm a beginner in the DSP programmation...
I'm doing a real-time audio application in which foating point can take the 
execution slower!
Now I must make a culture in fixed point math! I'll write back surely for 
other question...
Tnx Steve and tnx Tim
-- 
My english is bad...if I made some mistaches you'll tell me please!

"Tim Wescott" <tim@seemywebsite.com> ha scritto nel messaggio 
news:O_6dneI1j74N4-HZnZ2dnUVZ_smdnZ2d@web-ster.com...
> SDV wrote: >> Hi, >> I'm working with an ADSP-BF533 which uses fixed point arithmetic. >> Have I, for this reason, some limitation with type declaration (like >> double, float, ...)? >> > Your english isn't that bad. > > I assume you're working in C, but the answer would apply to other > languages. > > If you declare something as float or double you're telling the compiler to > use floating point arithmetic on it. Whatever bad thing is driving you to > use fixed point will happen when you try to do arithmetic on the data. > The 'bad things' that I have seen include failures to link (because there > was no floating point library), crashes at run time when the arithmetic > was attempted (because the floating point library was broken for the > particular hardware), slow operation (because there was no FP hardware and > software floating point is, well, slow). > > In a system where the only issue is speed of execution I will often use > floating point in the setup portions of the code so that people following > me will have an easier time reading it. Then I'll do the actual signal > processing in fixed point. > > -- > > Tim Wescott > Wescott Design Services > http://www.wescottdesign.com > > Posting from Google? See http://cfaj.freeshell.org/google/ > > "Applied Control Theory for Embedded Systems" came out in April. > See details at http://www.wescottdesign.com/actfes/actfes.html
No limitation.
You can declare the types depending on the your hardware platform.
If you want to see any good example code, You can search any fixed
point vocoder such as EVRC, G.723.1.