📄 dft_unopt.asm
字号:
/* Basic 32-bit floating point DFT routine (64 point) */
/* This routine does not take advantage of SIMD or super-scalar */
/*_______________________________________________________________________
This routine performs an N point real DFT according to the following equation:
N-1
real(k)+j*imag(k) = SUM input(n)[C - j*S]; k=0 to N-1
n=0
where: C=cos(2*pi*k*n/N), S=sin(2*pi*k*n/N), j=sqrt(-1)
_________________________________________________________________________*/
#ifdef __ADSPTS201__
#include <defts201.h>
#endif
#include "cache_macros.h"
#define N 64
.section data1; /* Declare Variables in Memory */
.VAR sine[N]= "sin64.dat";
.VAR input[N]= "test64.dat";
.VAR output_real[N];
.VAR output_imag[N];
.section program;
.global _main;
_main:
#ifdef __ADSPTS201__
/*in the case of TS201, at the beginning of the program the
cache must be enabled. The procedure is contained in the
cache_enable macro that uses the refresh rate as input parameter
-if CCLK=500MHz, refresh_rate=750
-if CCLK=400MHz, refresh_rate=600
-if CCLK=300MHz, refresh_rate=450
-if CCLK=250MHz, refresh_rate=375
*/
cache_enable(750);
#endif
jL0 = N;;
jB0 = sine;;
jB1 = sine;;
jL1 = N;;
kB0 = input;;
kL0 = N;;
j0 = sine;; /* Sine Table */
j1 = sine + N/4;; /* Derive Cosine Table from Sine by */
k0 = input;; /* shifting pointer over 2pi/4 */
k1 = output_real;;
k2 = output_imag;;
j2 = 0;; // freq value;
LC0 = N;;
outerloop:
// outer loop : (576 + 6) * 64 = 37,248 cycles
LC1 = N;;
xr5 = r5 xor r5;;
xr6 = r6 xor r6;;
innerloop:
// inner loop : 9 cycles * 64 = 576 cycles
xr2 = cb[k0+=1];;
xr0 = cb[j0+=j2];; /* R0 points to Sine Table */
xr1 = cb[j1+=j2];; /* R1 points to Cosine Table */
xfr3 = r2 * r0;; /* Input * Sine */
xfr4 = r2 * r1;; /* Input * Cosine */
xfr5 = r5 - r3;; /* Summation of Imaginary Portion */
xfr6 = r6 + r4;; /* Summation of Real Portion */
if NLC1E, jump innerloop (NP);;
[k1 += 1] = xr5;; /* Write Real Result */
[k2 += 1] = xr6;; /* Write Imaginary Result */
j2 = j2 + 1;;
if NLC0E, jump outerloop (NP);;
nop;;
_main.end:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -