DSPRelated.com
Forums

Saving Variables as .const

Started by B S July 28, 2011
Hi,

I am running an efficient FFT algorithm on DSK 6713 where twiddle, and some
variables are generating again and again in the main and taking so much time
which in result affecting the real time processing. How can I save them as
.const to avoid their calculation every time ?
Thanks for your help.

BAS
BAS,

A straghtforward way would be to allocate an array to hold the
coefficients. Unless the FFT size would change, there is no
need to recalculate them.

Regards,

Andrew

> Subject: Saving Variables as .const
> Posted by: "B S" m...@yahoo.com matlab_fft
> Date: Thu Jul 28, 2011 5:49 am ((PDT))
>
> Hi,
>
> I am running an efficient FFT algorithm on DSK 6713 where twiddle, and some
> variables are generating again and again in the main and taking so much time
> which in result affecting the real time processing. How can I save them as
> .const to avoid their calculation every time ?
> Thanks for your help.
>
> BAS
>

_____________________________________
B.S.

I would suggest making the twiddle, etc to be static variables, using the
'static' modifier
Then modify your code to calculate them once, perhaps during initialization,
then never calculate them again during that execution of the program.

Or calculate them, print them using one small program.
Then type them into a 'const' table in the program your going to use for the FFT
operations.

R. Williams
---------- Original Message -----------
From: B S
To: c...
Sent: Thu, 28 Jul 2011 03:48:17 -0700 (PDT)
Subject: [c6x] Saving Variables as .const

> Hi,
>
> I am running an efficient FFT algorithm on DSK 6713 where twiddle, and
> some variables are generating again and again in the main and taking
> so much time which in result affecting the real time processing. How
> can I save them as .const to avoid their calculation every time ?
>
> Thanks for your help.
>
> BAS
------- End of Original Message -------

_____________________________________
I have a problem with network for DM648. I use NDK to implement the TCP/IP own our own design board. The board is connected the network router (DHCP enabled). The application program runs on a PC. The PC is also connected to the router. The problem is that sometimes the application can't connect to the board through TCP/IP when start the application, it failed 1-2 times every 10 times try.
1. Can anybody give me advises about this problem?
2. How to sniffer the network traffic data on this node?

Thanks.

________________________________
This email may contain proprietary information and/or copyright material. This email is intended for the use of the addressee only. Any unauthorized use may be unlawful. If you receive this email by mistake, please advise the sender immediately by using the reply facility in your email software.

Information contained in and/or attached to this document may be subject to export control regulations of the European Community, USA, or other countries. Each recipient of this document is responsible to ensure that usage and/or transfer of any information contained in this document complies with all relevant export control regulations. If you are in any doubt about the export control restrictions that apply to this information, please contact the sender immediately.

Be aware that Meggitt may monitor incoming and outgoing emails to ensure compliance with the Meggitt IT User policy.
Li,

I cannot help you much about the connection problem.
However, most any 'sniffer' program run on your PC should be able to 'sniff' all
the ethernet data.

and some sniffer programs are free and work very well, like WireShark.
WireShark can be downloaded from:

R. Williams
---------- Original Message -----------
From: "Li, Zhilie (US - MGTTS)"
To: "c..."
Sent: Mon, 1 Aug 2011 18:40:30 +0000
Subject: RE: [c6x] Saving Variables as .const

> I have a problem with network for DM648. I use NDK to implement the
> TCP/IP own our own design board. The board is connected the network
> router (DHCP enabled). The application program runs on a PC. The PC is
> also connected to the router. The problem is that sometimes the
> application can't connect to the board through TCP/IP when start the
> application, it failed 1-2 times every 10 times try.
>
> 1. Can anybody give me advises about this problem?
> 2. How to sniffer the network traffic data on this node?
>
> Thanks.
>
> ________________________________
> This email may contain proprietary information and/or copyright
> material. This email is intended for the use of the addressee only.
> Any unauthorized use may be unlawful. If you receive this email by
> mistake, please advise the sender immediately by using the reply
> facility in your email software.
>
> Information contained in and/or attached to this document may be
> subject to export control regulations of the European Community, USA,
> or other countries. Each recipient of this document is responsible to
> ensure that usage and/or transfer of any information contained in this
> document complies with all relevant export control regulations. If you
> are in any doubt about the export control restrictions that apply to
> this information, please contact the sender immediately.
>
> Be aware that Meggitt may monitor incoming and outgoing emails to
> ensure compliance with the Meggitt IT User policy.
------- End of Original Message -------

_____________________________________
R. Williams,

In main.c, I am enabling HWI and Timer and rest of the FFT calculation is being
done in ISR. I tried to put twiddle and some constants inside a loop to
calculate them only once but it doesn't give accurate FFT result. I am using
example C code given at the following page.

http://processors.wiki.ti.com/index.php/Efficient_FFT_Computation_of_Real_Input#Computing_a_Length_N.2F2_Complex_FFT_from_a_Length_N_Real_Input_Sequence
Copy of example code.
tw_gen (w, N / 2);
split_gen (A, B, N / 2);

// Once w(twiddles), A, B Tables are generated they can be saved as .const
// and need not be generated every time..
twiddle = (float *) w;

// Forward FFT Calculation using N/2 complex FFT..
DSPF_sp_fftSPxSP (N / 2, pRFFT_In, twiddle, pTemp, brev, rad, 0, N / 2);

// FFT Split call to get complex FFT out of length N..
FFT_Split (N / 2, pTemp, A, B, pRFFT_Out);
Modified code by me;

if (flag == 0)
{
tw_gen (w, N / 2);
split_gen (A, B, N / 2);
twiddle = (float *) w;
flag++;
}

DSPF_sp_fftSPxSP (N / 2, pRFFT_In, twiddle, pTemp, brev, rad, 0, N / 2);
FFT_Split (N / 2, pTemp, A, B, pRFFT_Out);

Thanks for your help.

BAS

________________________________
From: Richard Williams
To: B S ; c...
Sent: Fri, July 29, 2011 3:24:03 AM
Subject: Re: [c6x] Saving Variables as .const

B.S.

I would suggest making the twiddle, etc to be static variables, using the
'static' modifier
Then modify your code to calculate them once, perhaps during initialization,
then never calculate them again during that execution of the program.

Or calculate them, print them using one small program.
Then type them into a 'const' table in the program your going to use for the FFT
operations.

R. Williams

---------- Original Message -----------
From: B S
To: c...
Sent: Thu, 28 Jul 2011 03:48:17 -0700 (PDT)
Subject: [c6x] Saving Variables as .const

> Hi,
>
> I am running an efficient FFT algorithm on DSK 6713 where twiddle, and
> some variables are generating again and again in the main and taking
> so much time which in result affecting the real time processing. How
> can I save them as .const to avoid their calculation every time ?
>
> Thanks for your help.
>
> BAS
------- End of Original Message -------
B.S.

A couple of questions that are not answered by your code example///

1) Where is 'w' located? defined?
2) Where is 'A' and 'B' located? defined?

In general, flag, 'w', 'A", and 'B' need to be file static variables
for your plan to work.
Also, 'N' cannot be changing between successive passes.
Are any of the 'w', 'A', 'B' being modified by the calls to DSPF_sp_fftSPxSP()
or FFT_Split()?
a little experimentation and using printf() to debug the problem will clarify
why re-using the same arrays is not working well.

R. Williams
---------- Original Message -----------
From: B S
To: Richard Williams , c...
Sent: Tue, 2 Aug 2011 05:28:58 -0700 (PDT)
Subject: Re: [c6x] Saving Variables as .const

> R. Williams,
>
> In main.c, I am enabling HWI and Timer and rest of the FFT calculation
> is being done in ISR. I tried to put twiddle and some constants inside
> a loop to calculate them only once but it doesn't give accurate FFT
> result. I am using example C code given at the following page.
http://processors.wiki.ti.com/index.php/Efficient_FFT_Computation_of_Real_Input#Computing_a_Length_N.2F2_Complex_FFT_from_a_Length_N_Real_Input_Sequence
>
> Copy of example code.
> tw_gen (w, N / 2);
> split_gen (A, B, N / 2);
>
> // Once w(twiddles), A, B Tables are generated they can be saved
> as .const // and need not be generated every time.. twiddle > (float *) w;
>
> // Forward FFT Calculation using N/2 complex FFT..
> DSPF_sp_fftSPxSP (N / 2, pRFFT_In, twiddle, pTemp, brev, rad, 0, N
> / 2);
>
> // FFT Split call to get complex FFT out of length N..
> FFT_Split (N / 2, pTemp, A, B, pRFFT_Out);
>
> Modified code by me;
>
> if (flag == 0)
> {
> tw_gen (w, N / 2);
> split_gen (A, B, N / 2);
> twiddle = (float *) w;
> flag++;
> }
>
> DSPF_sp_fftSPxSP (N / 2, pRFFT_In, twiddle, pTemp, brev, rad, 0, N / 2)
> ; FFT_Split (N / 2, pTemp, A, B, pRFFT_Out);
>
> Thanks for your help.
>
> BAS
>
> ________________________________
> From: Richard Williams
> To: B S ; c...
> Sent: Fri, July 29, 2011 3:24:03 AM
> Subject: Re: [c6x] Saving Variables as .const
>
> B.S.
>
> I would suggest making the twiddle, etc to be static variables, using the
> 'static' modifier
> Then modify your code to calculate them once, perhaps during
> initialization, then never calculate them again during that execution
> of the program.
>
> Or calculate them, print them using one small program.
> Then type them into a 'const' table in the program your going to use
> for the FFT operations.
>
> R. Williams
>
> ---------- Original Message -----------
> From: B S
> To: c...
> Sent: Thu, 28 Jul 2011 03:48:17 -0700 (PDT)
> Subject: [c6x] Saving Variables as .const
>
> > Hi,
> >
> > I am running an efficient FFT algorithm on DSK 6713 where twiddle, and
> > some variables are generating again and again in the main and taking
> > so much time which in result affecting the real time processing. How
> > can I save them as .const to avoid their calculation every time ?
> >
> > Thanks for your help.
> >
> > BAS
> ------- End of Original Message -------
------- End of Original Message -------

_____________________________________
B.S.

It should be obvious that a second run using a modified W array (twiddle array)
will result in a different out put.

R. Williams
---------- Original Message -----------
From: B S
To: Richard Williams , c...
Sent: Thu, 4 Aug 2011 04:48:54 -0700 (PDT)
Subject: Re: [c6x] Saving Variables as .const

> R. Williams,
>
> W, A and B are defined as global variables. Yes, W is changing by
> calling FFT_Split().
>
> BAS
>
> ________________________________
> From: Richard Williams
> To: B S ; c...
> Sent: Tue, August 2, 2011 3:58:07 PM
> Subject: Re: [c6x] Saving Variables as .const
>
> B.S.
>
> A couple of questions that are not answered by your code example///
>
> 1) Where is 'w' located? defined?
> 2) Where is 'A' and 'B' located? defined?
>
> In general, flag, 'w', 'A", and 'B' need to be file static variables
> for your plan to work.
> Also, 'N' cannot be changing between successive passes.
> Are any of the 'w', 'A', 'B' being modified by the calls to
> DSPF_sp_fftSPxSP() or FFT_Split()? a little experimentation and using
> printf() to debug the problem will clarify why re-using the same
> arrays is not working well.
>
> R. Williams
>
> ---------- Original Message -----------
> From: B S
> To: Richard Williams , c...
> Sent: Tue, 2 Aug 2011 05:28:58 -0700 (PDT)
> Subject: Re: [c6x] Saving Variables as .const
>
> > R. Williams,
> >
> > In main.c, I am enabling HWI and Timer and rest of the FFT calculation
> > is being done in ISR. I tried to put twiddle and some constants inside
> > a loop to calculate them only once but it doesn't give accurate FFT
> > result. I am using example C code given at the following page.
> >
> http://processors.wiki.ti.com/index.php/Efficient_FFT_Computation_of_Real_Input#Computing_a_Length_N.2F2_Complex_FFT_from_a_Length_N_Real_Input_Sequence
>
> >
> > Copy of example code.
> > tw_gen (w, N / 2);
> > split_gen (A, B, N / 2);
> >
> > // Once w(twiddles), A, B Tables are generated they can be saved
> > as .const // and need not be generated every time.. twiddle > > (float *) w;
> >
> > // Forward FFT Calculation using N/2 complex FFT..
> > DSPF_sp_fftSPxSP (N / 2, pRFFT_In, twiddle, pTemp, brev, rad, 0, N
> > / 2);
> >
> > // FFT Split call to get complex FFT out of length N..
> > FFT_Split (N / 2, pTemp, A, B, pRFFT_Out);
> >
> > Modified code by me;
> >
> > if (flag == 0)
> > {
> > tw_gen (w, N / 2);
> > split_gen (A, B, N / 2);
> > twiddle = (float *) w;
> > flag++;
> > }
> >
> > DSPF_sp_fftSPxSP (N / 2, pRFFT_In, twiddle, pTemp, brev, rad, 0, N / 2)
> > ; FFT_Split (N / 2, pTemp, A, B, pRFFT_Out);
> >
> > Thanks for your help.
> >
> > BAS
> >
> > ________________________________
> > From: Richard Williams
> > To: B S ; c...
> > Sent: Fri, July 29, 2011 3:24:03 AM
> > Subject: Re: [c6x] Saving Variables as .const
> >
> > B.S.
> >
> > I would suggest making the twiddle, etc to be static variables, using the
> > 'static' modifier
> > Then modify your code to calculate them once, perhaps during
> > initialization, then never calculate them again during that execution
> > of the program.
> >
> > Or calculate them, print them using one small program.
> > Then type them into a 'const' table in the program your going to use
> > for the FFT operations.
> >
> > R. Williams
> >
> > ---------- Original Message -----------
> > From: B S
> > To: c...
> > Sent: Thu, 28 Jul 2011 03:48:17 -0700 (PDT)
> > Subject: [c6x] Saving Variables as .const
> >
> > > Hi,
> > >
> > > I am running an efficient FFT algorithm on DSK 6713 where twiddle, and
> > > some variables are generating again and again in the main and taking
> > > so much time which in result affecting the real time processing. How
> > > can I save them as .const to avoid their calculation every time ?
> > >
> > > Thanks for your help.
> > >
> > > BAS
> > ------- End of Original Message -------
> ------- End of Original Message -------
------- End of Original Message -------

_____________________________________
R. Williams,

W, A and B are defined as global variables. Yes, W is changing by calling
FFT_Split().

BAS

________________________________
From: Richard Williams
To: B S ; c...
Sent: Tue, August 2, 2011 3:58:07 PM
Subject: Re: [c6x] Saving Variables as .const
B.S.

A couple of questions that are not answered by your code example///

1) Where is 'w' located? defined?
2) Where is 'A' and 'B' located? defined?

In general, flag, 'w', 'A", and 'B' need to be file static variables
for your plan to work.
Also, 'N' cannot be changing between successive passes.
Are any of the 'w', 'A', 'B' being modified by the calls to DSPF_sp_fftSPxSP()
or FFT_Split()?
a little experimentation and using printf() to debug the problem will clarify
why re-using the same arrays is not working well.

R. Williams
---------- Original Message -----------
From: B S
To: Richard Williams , c...
Sent: Tue, 2 Aug 2011 05:28:58 -0700 (PDT)
Subject: Re: [c6x] Saving Variables as .const

> R. Williams,
>
> In main.c, I am enabling HWI and Timer and rest of the FFT calculation
> is being done in ISR. I tried to put twiddle and some constants inside
> a loop to calculate them only once but it doesn't give accurate FFT
> result. I am using example C code given at the following page.
http://processors.wiki.ti.com/index.php/Efficient_FFT_Computation_of_Real_Input#Computing_a_Length_N.2F2_Complex_FFT_from_a_Length_N_Real_Input_Sequence

>
> Copy of example code.
> tw_gen (w, N / 2);
> split_gen (A, B, N / 2);
>
> // Once w(twiddles), A, B Tables are generated they can be saved
> as .const // and need not be generated every time.. twiddle > (float *) w;
>
> // Forward FFT Calculation using N/2 complex FFT..
> DSPF_sp_fftSPxSP (N / 2, pRFFT_In, twiddle, pTemp, brev, rad, 0, N
> / 2);
>
> // FFT Split call to get complex FFT out of length N..
> FFT_Split (N / 2, pTemp, A, B, pRFFT_Out);
>
> Modified code by me;
>
> if (flag == 0)
> {
> tw_gen (w, N / 2);
> split_gen (A, B, N / 2);
> twiddle = (float *) w;
> flag++;
> }
>
> DSPF_sp_fftSPxSP (N / 2, pRFFT_In, twiddle, pTemp, brev, rad, 0, N / 2)
> ; FFT_Split (N / 2, pTemp, A, B, pRFFT_Out);
>
> Thanks for your help.
>
> BAS
>
> ________________________________
> From: Richard Williams
> To: B S ; c...
> Sent: Fri, July 29, 2011 3:24:03 AM
> Subject: Re: [c6x] Saving Variables as .const
>
> B.S.
>
> I would suggest making the twiddle, etc to be static variables, using the
> 'static' modifier
> Then modify your code to calculate them once, perhaps during
> initialization, then never calculate them again during that execution
> of the program.
>
> Or calculate them, print them using one small program.
> Then type them into a 'const' table in the program your going to use
> for the FFT operations.
>
> R. Williams
>
> ---------- Original Message -----------
> From: B S
> To: c...
> Sent: Thu, 28 Jul 2011 03:48:17 -0700 (PDT)
> Subject: [c6x] Saving Variables as .const
>
> > Hi,
> >
> > I am running an efficient FFT algorithm on DSK 6713 where twiddle, and
> > some variables are generating again and again in the main and taking
> > so much time which in result affecting the real time processing. How
> > can I save them as .const to avoid their calculation every time ?
> >
> > Thanks for your help.
> >
> > BAS
> ------- End of Original Message -------
------- End of Original Message -------
R. Williams,

Yes that's obvious but I am wondering why it says in the example code to save those constants to avoid their calculation every time. If these constants has to be calculated every time then I can't get the profiling given on the same wiki page..

I will try to see what can be done but I am sorry to bother you.
BAS
________________________________
From: Richard Williams
To: B S ; c...
Sent: Friday, August 5, 2011 3:55 AM
Subject: Re: [c6x] Saving Variables as .const
 

B.S.

It should be obvious that a second run using a modified W array (twiddle array)
will result in a different out put.

R. Williams

---------- Original Message -----------
From: B S
To: Richard Williams , c...
Sent: Thu, 4 Aug 2011 04:48:54 -0700 (PDT)
Subject: Re: [c6x] Saving Variables as .const

> R. Williams,
>
> W, A and B are defined as global variables. Yes, W is changing by
> calling FFT_Split().
>
> BAS
>
> ________________________________
> From: Richard Williams
> To: B S ; c...
> Sent: Tue, August 2, 2011 3:58:07 PM
> Subject: Re: [c6x] Saving Variables as .const
>
> B.S.
>
> A couple of questions that are not answered by your code example///
>
> 1) Where is 'w' located? defined?
> 2) Where is 'A' and 'B' located? defined?
>
> In general, flag, 'w', 'A", and 'B' need to be file static variables
> for your plan to work.
> Also, 'N' cannot be changing between successive passes.
> Are any of the 'w', 'A', 'B' being modified by the calls to
> DSPF_sp_fftSPxSP() or FFT_Split()? a little experimentation and using
> printf() to debug the problem will clarify why re-using the same
> arrays is not working well.
>
> R. Williams
>
> ---------- Original Message -----------
> From: B S
> To: Richard Williams , c...
> Sent: Tue, 2 Aug 2011 05:28:58 -0700 (PDT)
> Subject: Re: [c6x] Saving Variables as .const
>
> > R. Williams,
> >
> > In main.c, I am enabling HWI and Timer and rest of the FFT calculation
> > is being done in ISR. I tried to put twiddle and some constants inside
> > a loop to calculate them only once but it doesn't give accurate FFT
> > result. I am using example C code given at the following page.
> >
> http://processors.wiki.ti.com/index.php/Efficient_FFT_Computation_of_Real_Input#Computing_a_Length_N.2F2_Complex_FFT_from_a_Length_N_Real_Input_Sequence
>
> >
> > Copy of example code.
> > tw_gen (w, N / 2);
> > split_gen (A, B, N / 2);
> >
> > // Once w(twiddles), A, B Tables are generated they can be saved
> > as .const // and need not be generated every time.. twiddle > > (float *) w;
> >
> > // Forward FFT Calculation using N/2 complex FFT..
> > DSPF_sp_fftSPxSP (N / 2, pRFFT_In, twiddle, pTemp, brev, rad, 0, N
> > / 2);
> >
> > // FFT Split call to get complex FFT out of length N..
> > FFT_Split (N / 2, pTemp, A, B, pRFFT_Out);
> >
> > Modified code by me;
> >
> > if (flag == 0)
> > {
> > tw_gen (w, N / 2);
> > split_gen (A, B, N / 2);
> > twiddle = (float *) w;
> > flag++;
> > }
> >
> > DSPF_sp_fftSPxSP (N / 2, pRFFT_In, twiddle, pTemp, brev, rad, 0, N / 2)
> > ; FFT_Split (N / 2, pTemp, A, B, pRFFT_Out);
> >
> > Thanks for your help.
> >
> > BAS
> >
> > ________________________________
> > From: Richard Williams
> > To: B S ; c...
> > Sent: Fri, July 29, 2011 3:24:03 AM
> > Subject: Re: [c6x] Saving Variables as .const
> >
> > B.S.
> >
> > I would suggest making the twiddle, etc to be static variables, using the
> > 'static' modifier
> > Then modify your code to calculate them once, perhaps during
> > initialization, then never calculate them again during that execution
> > of the program.
> >
> > Or calculate them, print them using one small program.
> > Then type them into a 'const' table in the program your going to use
> > for the FFT operations.
> >
> > R. Williams
> >
> > ---------- Original Message -----------
> > From: B S
> > To: c...
> > Sent: Thu, 28 Jul 2011 03:48:17 -0700 (PDT)
> > Subject: [c6x] Saving Variables as .const
> >
> > > Hi,
> > >
> > > I am running an efficient FFT algorithm on DSK 6713 where twiddle, and
> > > some variables are generating again and again in the main and taking
> > > so much time which in result affecting the real time processing. How
> > > can I save them as .const to avoid their calculation every time ?
> > >
> > > Thanks for your help.
> > >
> > > BAS
> > ------- End of Original Message -------
> ------- End of Original Message -------
------- End of Original Message -------