Tim Wescott <tim@seemywebsite.com> wrote in news:jYednV4ZmrFxqoDYnZ2dnUVZ_t6dnZ2d@web-ster.com:> * In a DSP chip that you've already bought the multiply costs the same > as an add, because it has a built-in 1-cycle multiply -- but the DSP > chip cost you more in the first place.The OP specified "real". I knew DSP's handled integer multiplies fast, but do they handle floats as quickly? -- Scott Reverse name to reply
Cost of multiplication relative to addition
Started by ●September 28, 2006
Reply by ●September 29, 20062006-09-29
Reply by ●September 29, 20062006-09-29
Scott Seidman wrote:> Tim Wescott <tim@seemywebsite.com> wrote in > news:jYednV4ZmrFxqoDYnZ2dnUVZ_t6dnZ2d@web-ster.com: > > >>* In a DSP chip that you've already bought the multiply costs the same >> as an add, because it has a built-in 1-cycle multiply -- but the DSP >> chip cost you more in the first place. > > > > The OP specified "real". I knew DSP's handled integer multiplies fast, but > do they handle floats as quickly? > >My head kind of floated over that, interpreting as 'actual'. There are no real numbers in digital math -- just integers without mantissas, and integers with mantissas. If he'd said 'floating point' then I would have caught that. I have never had occasion to work with a floating point DSP -- all my designs have been cost effective :-D. I honestly don't know how fast the floating point DSP chips do their math. I would hope that they have a fast MAC instruction, but I don't know. For _that_ answer the OP can study data sheets, just like I'd have to do. If the OP is truly interested in floating point math in a more general sense then the answer becomes very complex. Why? Because there are a number of different ways to implement floating point. In a simple floating point system a multiply has the same integer multiply operation at its core, plus the signed sum of the mantissas. Floating point addition is often more complex, because you have to perform the operation, then figure out what the new mantissa should be, then adjust things to fit. If you were to implement a fully compliant IEEE floating point system then you'd have to account for all of the various operations that have invalid results (divide by zero, multiplication by NaN, multiplications that overflow the mantissa, subtractions that underflow, etc.). AFAIK handling these exceptions accurately and completely adds quite a bit of complexity to a floating point math engine. -- 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
Reply by ●September 29, 20062006-09-29
Tim Wescott wrote:> Scott Seidman wrote: > >> Tim Wescott <tim@seemywebsite.com> wrote in >> news:jYednV4ZmrFxqoDYnZ2dnUVZ_t6dnZ2d@web-ster.com: >> >> >>> * In a DSP chip that you've already bought the multiply costs the same >>> as an add, because it has a built-in 1-cycle multiply -- but the DSP >>> chip cost you more in the first place. >> >> >> >> >> The OP specified "real". I knew DSP's handled integer multiplies >> fast, but do they handle floats as quickly? >> >> > My head kind of floated over that, interpreting as 'actual'. > > There are no real numbers in digital math -- just integers without > mantissas, and integers with mantissas. If he'd said 'floating point' > then I would have caught that. > > I have never had occasion to work with a floating point DSP -- all my > designs have been cost effective :-D. I honestly don't know how fast > the floating point DSP chips do their math. I would hope that they have > a fast MAC instruction, but I don't know. For _that_ answer the OP can > study data sheets, just like I'd have to do. > > If the OP is truly interested in floating point math in a more general > sense then the answer becomes very complex. Why? Because there are a > number of different ways to implement floating point. > > In a simple floating point system a multiply has the same integer > multiply operation at its core, plus the signed sum of the mantissas. > Floating point addition is often more complex, because you have to > perform the operation, then figure out what the new mantissa should be, > then adjust things to fit. > > If you were to implement a fully compliant IEEE floating point system > then you'd have to account for all of the various operations that have > invalid results (divide by zero, multiplication by NaN, multiplications > that overflow the mantissa, subtractions that underflow, etc.). AFAIK > handling these exceptions accurately and completely adds quite a bit of > complexity to a floating point math engine. >Maybe he did mean floating point when he said real. I never thought of that. I haven't seen them called reals since I last programmed in Fortran 20 odd years ago. :-) Floating point DSPs work pretty well. What surprises me is how cheap they can be. They seem to be devices for niche applications, and that usually means expensive because the volumes aren't there. You can get a lot of FLOPS per dollar these days, though. Steve
Reply by ●September 29, 20062006-09-29
Tim Wescott <tim@seemywebsite.com> wrote in news:- pmdnVPZiIGUz4DYnZ2dnUVZ_vidnZ2d@web-ster.com:> > I have never had occasion to work with a floating point DSP -- all my > designs have been cost effective :-D. I honestly don't know how fast > the floating point DSP chips do their math. I would hope that they have > a fast MAC instruction, but I don't know. For _that_ answer the OP can > study data sheets, just like I'd have to do.If "real" does mean what I thought, the OP would be best served to try sticking to integer math for many of the reasons you discussed. If he's talking about trying to save a few clock cycles per multiply when doing integer math, you're dead on. Most DSP's, if not all, can do single cycle math. Also, I tend to look at optimizations of this type as optimizing a mechanical system where some component or other is too heavy. You think about drilling holes in it to save weight, but if you find yourself thinking that way, often there's nothing short of a major redesign that will ever get the component light enough! -- Scott Reverse name to reply
Reply by ●September 29, 20062006-09-29
Steve Underwood <steveu@dis.org> wrote in news:efjkh6$808$1 @nnews.pacific.net.hk:> I haven't seen them called reals since I last programmed in > Fortran 20 odd years ago. :-) >God is real, unless declared integer! -- Scott Reverse name to reply
Reply by ●September 29, 20062006-09-29
Scott Seidman wrote:> Tim Wescott <tim@seemywebsite.com> wrote in > news:jYednV4ZmrFxqoDYnZ2dnUVZ_t6dnZ2d@web-ster.com: > >> * In a DSP chip that you've already bought the multiply costs the same >> as an add, because it has a built-in 1-cycle multiply -- but the DSP >> chip cost you more in the first place. > > > The OP specified "real". I knew DSP's handled integer multiplies fast, but > do they handle floats as quickly?One cycle is one cycle, so yes. Pentiums take more than one cycle for multiplies, but floats execute faster than fixed-point. Jerry -- "The rights of the best of men are secured only as the rights of the vilest and most abhorrent are protected." - Chief Justice Charles Evans Hughes, 1927 ���������������������������������������������������������������������
Reply by ●September 29, 20062006-09-29
Scott Seidman wrote:> Tim Wescott <tim@seemywebsite.com> wrote in > news:jYednV4ZmrFxqoDYnZ2dnUVZ_t6dnZ2d@web-ster.com: > > >>* In a DSP chip that you've already bought the multiply costs the same >> as an add, because it has a built-in 1-cycle multiply -- but the DSP >> chip cost you more in the first place. > > > > The OP specified "real". I knew DSP's handled integer multiplies fast, but > do they handle floats as quickly?Like PCs, DSP usually take a number of cycles to complete a floating operation. However, they can start a new one each cycle. There is just some latency before the answers appear. If you need the answer from one calculation in order to commence the next this is a serious problem. For many calculations it is no handicap at all. Steve
Reply by ●September 29, 20062006-09-29
Scott Seidman wrote:> Tim Wescott <tim@seemywebsite.com> wrote in > news:jYednV4ZmrFxqoDYnZ2dnUVZ_t6dnZ2d@web-ster.com: > > > * In a DSP chip that you've already bought the multiply costs the same > > as an add, because it has a built-in 1-cycle multiply -- but the DSP > > chip cost you more in the first place. > > > The OP specified "real". I knew DSP's handled integer multiplies fast, but > do they handle floats as quickly? >For a non-floating point DSP, a software emulated floating point multiply takes about the same number of clock cycles as a software emulated floating point add.
Reply by ●September 29, 20062006-09-29
steve wrote:> Scott Seidman wrote: >> Tim Wescott <tim@seemywebsite.com> wrote in >> news:jYednV4ZmrFxqoDYnZ2dnUVZ_t6dnZ2d@web-ster.com: >> >>> * In a DSP chip that you've already bought the multiply costs the same >>> as an add, because it has a built-in 1-cycle multiply -- but the DSP >>> chip cost you more in the first place. >> >> The OP specified "real". I knew DSP's handled integer multiplies fast, but >> do they handle floats as quickly? >> > For a non-floating point DSP, a software emulated floating point > multiply takes about the same number of clock cycles as a software > emulated floating point add.Floating-point addition is more complex than multiplication if a fixed-point multiplier is available. If the addend exponents differ, they must be made the same before addition or subtraction can take place, then the result may need to be renormalized. Jerry -- "The rights of the best of men are secured only as the rights of the vilest and most abhorrent are protected." - Chief Justice Charles Evans Hughes, 1927 ���������������������������������������������������������������������
Reply by ●September 30, 20062006-09-30
Jerry Avins wrote:> Floating-point addition is more complex than multiplication if a > fixed-point multiplier is available. If the addend exponents differ, > they must be made the same before addition or subtraction can take > place, then the result may need to be renormalized. >ok, but on the DSP's I have used the emulated foating point multiply was only about 10% faster then the emulated floating point ADD (and 100 times slower (full IEEE 754) then fixed point for the typical algorithms I run)






