Reply by Mike Rosing May 4, 20052005-05-04
On Wed, 4 May 2005, Jaime Andres Aranguren Cardona wrote:

> Mike, let me disagree with you. I personally think
> that it would be easier to take the Instruction Set
> Manual and try to implement it, converting from what C
> code does to assembly code that does the same, then
> even optimize of necessary. It would be harder to try
> to understand what the compiler was thinking about how
> to implement it in asm.
>
> Just one opinion...

I suspect that would be easier too.
:-)

Patience, persistence, truth,
Dr. mike


Reply by Steve Holle May 4, 20052005-05-04
Have fun.

At 11:49 AM 5/3/2005, emailtoprs wrote:
>hi
>iam learning on dsp assembly. i need some samples. i have an fft
>implementation called don cross fft. any body intersted can convert
>to blackfin assembly for me.plese dont forget to add good comments.
>
>void fft(int inversetransform)
>{
> unsigned i, j, k, n;
> unsigned BlockSize, BlockEnd;
> double angle_numerator =- 2.0 * PI;
> double tr, ti; /* temp real, temp imaginary */
>
> if(inversetransform==1)
> angle_numerator=-angle_numerator;
> for ( i=0; i < N; i++ )
> {
> j = ReverseBits ( i);
> RealOut[j] = RealIn[i];
> ImagOut[j] = ImagIn[i];
> }
>
> BlockEnd = 1;
> for ( BlockSize = 2; BlockSize <= N; BlockSize <<= 1)
> {
> double delta_angle = angle_numerator / (double)BlockSize;
> double sm2 = sin ( -2 * delta_angle );
> double sm1 = sin ( -delta_angle );
> double cm2 = cos ( -2 * delta_angle );
> double cm1 = cos ( -delta_angle );
> double w = 2 * cm1;
> double ar[3], ai[3];
> double temp;
> for ( i=0; i < N; i += BlockSize )
> {
> ar[2] = cm2;
> ar[1] = cm1;
> ai[2] = sm2;
> ai[1] = sm1;
> for ( j=i, n=0; n < BlockEnd; j++, n++ )
> {
> ar[0] = w*ar[1] - ar[2];
> ar[2] = ar[1];
> ar[1] = ar[0];
> ai[0] = w*ai[1] - ai[2];
> ai[2] = ai[1];
> ai[1] = ai[0];
> k = j + BlockEnd;
> tr = ar[0]*RealOut[k] - ai[0]*ImagOut[k];
> ti = ar[0]*ImagOut[k] + ai[0]*RealOut[k];
> RealOut[k] = RealOut[j] - tr;
> ImagOut[k] = ImagOut[j] - ti;
> RealOut[j] += tr;
> ImagOut[j] += ti;
> }
> }
> BlockEnd = BlockSize;
> } >int ReverseBits ( unsigned index)
>{
> unsigned i;
> int rev=0;
> for(i=0;i<Pow;i++)
> {
> rev = (rev << 1) | (index & 1);
> index >>= 1;
> }
> return rev;
>}

Steve Holle
Link Communications, Inc.
1035 Cerise Rd.
Billings, MT 59101
sholle@shol...


Reply by Jaime Andres Aranguren Cardona May 4, 20052005-05-04
Hello,

--- Mike Rosing <eresrch@eres...> wrote:

> the
> easiest way
> to do this homework is to look at the output of the
> C compiler
> using the -S option, and clean up the result.

Mike, let me disagree with you. I personally think
that it would be easier to take the Instruction Set
Manual and try to implement it, converting from what C
code does to assembly code that does the same, then
even optimize of necessary. It would be harder to try
to understand what the compiler was thinking about how
to implement it in asm.

Just one opinion... Jaime Andr Aranguren Cardona
jaime.aranguren@jaim...
jaime.aranguren@jaim... __________________________________________________




Reply by Jaime Andres Aranguren Cardona May 4, 20052005-05-04
If you're learning, this is certainly a good excercise
for practicing.

I think none here will do your homework for free.

--- emailtoprs <emailtoprs@emai...> wrote:
> hi
> iam learning on dsp assembly. i need some samples. i
> have an fft
> implementation called don cross fft. any body
> intersted can convert
> to blackfin assembly for me.plese dont forget to add
> good comments.


Jaime Andr Aranguren Cardona
jaime.aranguren@jaim...
jaime.aranguren@jaim... __________________________________________________




Reply by Mike Rosing May 4, 20052005-05-04
On Tue, 3 May 2005, emailtoprs wrote:

> hi
> iam learning on dsp assembly. i need some samples. i have an fft
> implementation called don cross fft. any body intersted can convert
> to blackfin assembly for me.plese dont forget to add good comments.

Homework is for you to learn how to do things. the easiest way
to do this homework is to look at the output of the C compiler
using the -S option, and clean up the result.

Patience, persistence, truth,
Dr. mike


Reply by emailtoprs May 3, 20052005-05-03
hi
iam learning on dsp assembly. i need some samples. i have an fft
implementation called don cross fft. any body intersted can convert
to blackfin assembly for me.plese dont forget to add good comments.

void fft(int inversetransform)
{
unsigned i, j, k, n;
unsigned BlockSize, BlockEnd;
double angle_numerator =- 2.0 * PI;
double tr, ti; /* temp real, temp imaginary */

if(inversetransform==1)
angle_numerator=-angle_numerator;
for ( i=0; i < N; i++ )
{
j = ReverseBits ( i);
RealOut[j] = RealIn[i];
ImagOut[j] = ImagIn[i];
}

BlockEnd = 1;
for ( BlockSize = 2; BlockSize <= N; BlockSize <<= 1)
{
double delta_angle = angle_numerator / (double)BlockSize;
double sm2 = sin ( -2 * delta_angle );
double sm1 = sin ( -delta_angle );
double cm2 = cos ( -2 * delta_angle );
double cm1 = cos ( -delta_angle );
double w = 2 * cm1;
double ar[3], ai[3];
double temp;
for ( i=0; i < N; i += BlockSize )
{
ar[2] = cm2;
ar[1] = cm1;
ai[2] = sm2;
ai[1] = sm1;
for ( j=i, n=0; n < BlockEnd; j++, n++ )
{
ar[0] = w*ar[1] - ar[2];
ar[2] = ar[1];
ar[1] = ar[0];
ai[0] = w*ai[1] - ai[2];
ai[2] = ai[1];
ai[1] = ai[0];
k = j + BlockEnd;
tr = ar[0]*RealOut[k] - ai[0]*ImagOut[k];
ti = ar[0]*ImagOut[k] + ai[0]*RealOut[k];
RealOut[k] = RealOut[j] - tr;
ImagOut[k] = ImagOut[j] - ti;
RealOut[j] += tr;
ImagOut[j] += ti;
}
}
BlockEnd = BlockSize;
} int ReverseBits ( unsigned index)
{
unsigned i;
int rev=0;
for(i=0;i<Pow;i++)
{
rev = (rev << 1) | (index & 1);
index >>= 1;
}
return rev;
}