DSPRelated.com
Forums

ADSP TS 201 - sine and cosine of long double type

Started by dspnewbie February 20, 2007
Hi Group,

I am relatively a newbie to dsp and trying to implement some programs.
Curretly I am using Tigersharc ADSP TS 201 EZ-Kit. One of my programs
calculates cosine and sine of long double type values. I am wondering
if there is a way to calculate sine and cosine of 0 to 1024 number of
values ahead of time and store them in a vector and access it when the
need arises.
Couple of questions I have is
1) Will there be any performance increase if this is implemented as I
said above and can this be implemented at all?
2) Is there some assembly code that I can make use instead of just
using cos() and sin() in math.h?

I am trying to improve the performance of this program that does 64
bit floating point calculations and hence thinking about the
alternatives that I have got on this dsp.

Thank you,
Dan
Hi Dan,

The table you are considering is small enough to fit into internal memory.
The speed of looking up the sin/cos in a table will be quicker than
calculating them (especially as double precision floats).

I'm not sure why it would matter about using assembly or C to calculate the
table, since it would be done once during some initialization of your code.
However, the source files for the sind() and cosd() functions are provided
(check under VisualDSP 4.5/TS/lib/src ...). These are in C. You can
compile them to assembly and try to hand optimize them, if you wish.

Best regards,

George

www.kaztek.com
-----Original Message-----
From: a... [mailto:a...] On Behalf Of
dspnewbie
Sent: Tuesday, February 20, 2007 2:28 PM
To: a...
Subject: [adsp] ADSP TS 201 - sine and cosine of long double type

Hi Group,

I am relatively a newbie to dsp and trying to implement some programs.
Curretly I am using Tigersharc ADSP TS 201 EZ-Kit. One of my programs
calculates cosine and sine of long double type values. I am wondering
if there is a way to calculate sine and cosine of 0 to 1024 number of
values ahead of time and store them in a vector and access it when the
need arises.
Couple of questions I have is
1) Will there be any performance increase if this is implemented as I
said above and can this be implemented at all?
2) Is there some assembly code that I can make use instead of just
using cos() and sin() in math.h?

I am trying to improve the performance of this program that does 64
bit floating point calculations and hence thinking about the
alternatives that I have got on this dsp.

Thank you,
Dan
On Tue, 20 Feb 2007, dspnewbie wrote:

> Hi Group,
>
> I am relatively a newbie to dsp and trying to implement some programs.
> Curretly I am using Tigersharc ADSP TS 201 EZ-Kit. One of my programs
> calculates cosine and sine of long double type values. I am wondering
> if there is a way to calculate sine and cosine of 0 to 1024 number of
> values ahead of time and store them in a vector and access it when the
> need arises.
> Couple of questions I have is
> 1) Will there be any performance increase if this is implemented as I
> said above and can this be implemented at all?
> 2) Is there some assembly code that I can make use instead of just
> using cos() and sin() in math.h?

Trading time for space is pretty much given in all microprocessors. The
key is comparing the number of clock cycles for each process. If you only
need to look up one value, then it's a conversion process between what you
have and the index. If your trig calculation takes 10 or 20 clocks, then
you go faster with a 2 to 5 clock lookup.

But if you have to do interpolation to keep your accuracy, there may not
be much gain.

Patience, persistence, truth,
Dr. mike