Best processors for trig?

Hi - I was just wondering, are there any processors out there that have been optimized for trig operations? I'm hoping to find a processor that can do trig ops (sin, cos, tan, asin, acos, atan, etc.) quickly. The faster the better. I would really like to be able to do such operations in the single digit microsecond range or less, though that's probably a longshot. I'm looking for floating point values - ideally in the C data type "double". Does anything like this exist? Ideally in a non-BGA package, as I hate debugging the little buggers.

Thanks!

-Mike

Reply to
Mike Noone
Loading thread data ...

You'd better look at some of the floating-point DSP's. They have that kind on arithmetic oomph you're after.

--
Tauno Voipio
tauno voipio (at) iki fi
 Click to see the full signature
Reply to
Tauno Voipio

operations?

it's a co-processor:

formatting link

there's always the pre-computed lookup table approach, depending on the accuracy needed and memory available.

Reply to
4MLA1FN

A floating point DSP, as noted.

Pentium-class x86 processors, although that's stretching the idea of "embedded" a bit.

Probably PowerPC architecture chips, at least the ones with FPUs (look carefully, however, I bet there are ones with simple FPUs and others with complex FPUs).

Some of the bigger fixed-point DSPs may be able to do this -- I know that TI's '28xx family will do floating point quite efficiently, but (a) I know they do it by leaving out some of the corner-case testing for exceptions and (b) I don't know how this translates to trig performance.

--
Tim Wescott
Wescott Design Services
 Click to see the full signature
Reply to
Tim Wescott

What's the canonical method of doing this? Taylor series approximations?

Reply to
larwe

"Mike Noone" skrev i meddelandet news: snipped-for-privacy@l77g2000hsb.googlegroups.com...

The AT572D740 has an ARM + a floating point DSP capable of 400 floating point MACs per us. It uses 40 bit floating point representation.

Should probably be enough. You can get a PMC module if you dont like the BGA package.

--
Best Regards,
Ulf Samuelsson
 Click to see the full signature
Reply to
Ulf Samuelsson

Of course, the arguments have to be reduced first to the range of the period (2 * pi for sin and cos, pi for tan). The reduced range is often split into some sub-ranges with different coefficients.

The least-maximum error polynomial for approximation is obtained by developing the function to a series of Chebysev polynomials. This method gives less error than a corresponding Taylor or MacLaurin series.

The trig functions and exponential are quite polynomial- friendly. The most difficult of the elementary functions is the logarithm, its Taylor series uses half of an infinity to converge.

(Been there, done that.)

--
Tauno Voipio
tauno voipio (at) iki fi
 Click to see the full signature
Reply to
Tauno Voipio

I'm not sure that there is one.

Bringing the argument into range and doing a Taylors series is almost good. Bringing it into range then using a near-Taylors polynomial that takes the truncation into account works better. This works especially well on a VLW instruction set architecture like the 21xx from ADI, because you can perform the x^n in one clock, then the y += ax^n in another -- with sines and cosines you'll out-precise 16-bit data by the time you get to x^6, so you can do the computation in a ridiculously few number of clocks.

If all you want is fast then you can do a humongous table look up.

If you have the room it works _really_ well to do a part lookup, part polynomial expansion algorithm. You have a lot of freedom here to trade off speed for table size.

I have had applications where I did a table look up followed by linear interpolation, and accepted that my trig functions were good to significantly less than 16 bits. If you don't _need_ full precision but you do need speed, this can be very good.

--
Tim Wescott
Wescott Design Services
 Click to see the full signature
Reply to
Tim Wescott

A fine book on the subject is Hastings "Approximations for Digital Computers". Someone stole mine about 20 years ago.

--
Chuck F (cbfalconer at maineline dot net)
   Available for consulting/temporary embedded and systems.
Reply to
CBFalconer

Or CORDIC.

Roberto Waltman

[ Please reply to the group, return address is invalid ]
Reply to
Roberto Waltman

I guess you no longer make the eval boards, the AT572D740-DK1 and DK2?

Is there a replacement?

Reply to
Eric

Yes, Cordic is a good alternative. It is especially competitive if floating point operations have a high latency (or are emulated). You can also control accuracy so that the answers are within

1 ULP - this is pretty much impossible when using floating point operations of the same precision as the result precision.

Wilco

Reply to
Wilco Dijkstra

For float (6 digits) the 3 .. 4 order is usually enough, for double, you may have to calculate to the 6th - 8th degree.

Taylor series are far too computationally intensive for any practical purpose, so in practice some kind of polynomial is used.

3-4(float) or 6-8 order polynomials are usually sufficient.

After all, the only real problem with logs is that you must be able to calculate it in the 1.0 .. 2.0 range, the rest is trivial.

Do you really need anything more than a 6th degree polynomial ?

Paul

Reply to
Paul Keinanen

A least for sin/cos you could use the expressions

sin(a+b)=sin(a)cos(b) + cos(a)sin(b) cos(a+b)=cos(a)cos(b) - sin(a)sin(b)

in which a is the "integer" part and b is the "fractional" part. sin(a) and cos(a) can easily be evaluated using table look-up, sin(b)=b when b is expressed in radians and is sufficiently small compared to a. Thus, the only problem is how to express cos(b), which is very close to 1.0 anyway.

Paul

Reply to
Paul Keinanen

It's a pain when that happens. I managed to get a copy a few years ago from Amazon. They do have links to old book stockists so you can sometimes find an old classic like that through them.

Also worth looking up are DDA algorithms which are often quite fast.

--
********************************************************************
Paul E. Bennett ....................
 Click to see the full signature
Reply to
Paul E. Bennett

Interesting chip - but the BGA package is not exactly encouraging... And I don't want to use a PMC module or any other sort of evaluation board - this is destined for a very size sensitive board.

-Mike

Reply to
Mike Noone

Why the 28x family? Wouldn't it make more sense to use a 67x as it is designed for floating point, while the 28x is designed for fixed point?

I must admit that I am new to the DSP world, so it's quite possible I'm missing something obvious here.

-Mike

Reply to
Mike Noone

operations?

If I'm interpreting the datasheet correctly, it takes that part about a tenth of a millisecond to compute sin(). That is decidedly too slow for my purposes, especially considering the additional overhead of talking to the bugger.

-Mike

Reply to
Mike Noone

Yes - I do.

The MacLaurin series for a log (calculated for log(1 + x)) needs 5000 terms for 4 digits. Pick your favourite formula collection and have a look.

I had to split the range to (1 .. sqrt(2)) and (sqrt(2) .. 2), and calculate 5th degree Chebysev series approximations to get enough precision for single-precision float.

--
Tauno Voipio
tauno voipio (at) iki fi
 Click to see the full signature
Reply to
Tauno Voipio

Powells.com is a good place to look for used books. They have two copies of that book right now, from 1955 and 1957.

Math solutions from those days would probably seem tiny and efficient on today's hardware, even embedded hardware.

--
Warren Block * Rapid City, South Dakota * USA
Reply to
Warren Block

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.