home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / dsp / dspgroup / m56000_1.arc / FFT.LST < prev    next >
Encoding:
File List  |  1987-05-14  |  13.2 KB  |  397 lines

  1.  
  2.  
  3.  
  4. Motorola DSP56000 Macro Cross Assembler  Version 1.00  05-14-87  11:35:33  fft.asm  Page 1
  5.  
  6.  
  7.  
  8. 1                                  page    132,66,3,3
  9. 2                                  opt     nomd,mex,cre,cex,mu,rc
  10. 3      
  11. 4                                  include 'sintab'
  12. 5                        ;
  13. 6                        ;       sintab -      macro to generate twiddle factor lookup tables for
  14. 7                        ;                     Decimation in Time FFT
  15. 8                        ;
  16. 9                        ;       cosine value in X memory
  17. 10                       ;       -sine value in Y memory
  18. 11                       ;
  19. 12                       ;       points -      number of points (4 - 32768, power of 2)
  20. 13                       ;       twiddle        -      start of sine/cosine table
  21. 14                       ;
  22. 15     
  23. 37                                 include 'ditfft'
  24. 127                      ;
  25. 128                      ; Main program to call the FFT macro
  26. 129                      ;
  27. 130                      ;       N point complex DIT FFT
  28. 131                      ;       M FFT passes
  29. 132                      ;       Data starts at address 0
  30. 133                      ;       Twiddle factor table starts at address N
  31. 134                      ;
  32. 135                      ; Command line example for a 16 point FFT:
  33. 136                      ;
  34. 137                      ;       asm56000 -b -l -dPOINTS '16' -dPASSES '4' fft
  35. 138                      ;
  36. 139    
  37. 140       00000010       points    equ     16
  38. 141       00000004       passes    equ     4
  39. 142       00000010       twiddle   equ     16
  40. 143       00000000       reset     equ     0
  41. 144       00000000       data      equ     0
  42. 145       00000100       start     equ     $100
  43. 146    
  44. 147                                sintab  points,twiddle
  45. 148   +
  46. 149   +   3.141593       PI        equ     3.141592654
  47. 150   +   00000008       ENT       equ     points/2
  48. 151   +   0.392699       FREQ      equ     PI/@cvf(ENT)
  49. 152   +
  50. 153   +   X:0010                   org     x:twiddle
  51. 154   +   00000000       count     set     0
  52. **** 159 [fft.asm 26]: WARNING --- Floating point value outside fractional domain
  53. 159  d+   X:0010 7FFFFF            dc      @cos(@cvf(count)*FREQ)
  54. 160   +   00000001       count     set     count+1
  55. 161  d+   X:0011 7641AF            dc      @cos(@cvf(count)*FREQ)
  56. 162   +   00000002       count     set     count+1
  57. 163  d+   X:0012 5A8279            dc      @cos(@cvf(count)*FREQ)
  58. 164   +   00000003       count     set     count+1
  59. 165  d+   X:0013 30FBC5            dc      @cos(@cvf(count)*FREQ)
  60. 166   +   00000004       count     set     count+1
  61. 167  d+   X:0014 000000            dc      @cos(@cvf(count)*FREQ)
  62. 168   +   00000005       count     set     count+1
  63. 169  d+   X:0015 CF043B            dc      @cos(@cvf(count)*FREQ)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. Motorola DSP56000 Macro Cross Assembler  Version 1.00  05-14-87  11:35:33  fft.asm  Page 2
  71.  
  72.  
  73.  
  74. 170   +   00000006       count     set     count+1
  75. 171  d+   X:0016 A57D87            dc      @cos(@cvf(count)*FREQ)
  76. 172   +   00000007       count     set     count+1
  77. 173  d+   X:0017 89BE51            dc      @cos(@cvf(count)*FREQ)
  78. 174   +   00000008       count     set     count+1
  79. 175   +
  80. 176   +   Y:0010                   org     y:twiddle
  81. 177   +   00000000       count     set     0
  82. 182  d+   Y:0010 000000            dc      -@sin(@cvf(count)*FREQ)
  83. 183   +   00000001       count     set     count+1
  84. 184  d+   Y:0011 CF043B            dc      -@sin(@cvf(count)*FREQ)
  85. 185   +   00000002       count     set     count+1
  86. 186  d+   Y:0012 A57D87            dc      -@sin(@cvf(count)*FREQ)
  87. 187   +   00000003       count     set     count+1
  88. 188  d+   Y:0013 89BE51            dc      -@sin(@cvf(count)*FREQ)
  89. 189   +   00000004       count     set     count+1
  90. 190  d+   Y:0014 800000            dc      -@sin(@cvf(count)*FREQ)
  91. 191   +   00000005       count     set     count+1
  92. 192  d+   Y:0015 89BE51            dc      -@sin(@cvf(count)*FREQ)
  93. 193   +   00000006       count     set     count+1
  94. 194  d+   Y:0016 A57D87            dc      -@sin(@cvf(count)*FREQ)
  95. 195   +   00000007       count     set     count+1
  96. 196  d+   Y:0017 CF043B            dc      -@sin(@cvf(count)*FREQ)
  97. 197   +   00000008       count     set     count+1
  98. 198   +
  99. 199    
  100. 200       P:0000                   org     p:reset
  101. 201       P:0000 0C0100            jmp     start
  102. 202    
  103. 203       P:0100                   org     p:start
  104. 204                                ditfft  points,passes,data,twiddle
  105. 205   +                  ;
  106. 206   +                  ; Radix 2 Decimation in Time In-Place Fast Fourier Transform Routine
  107. 207   +                  ;
  108. 208   +                  ;    Complex input and output data
  109. 209   +                  ;        Real data in X memory
  110. 210   +                  ;        Imaginary data in Y memory
  111. 211   +                  ;    Normally ordered input data
  112. 212   +                  ;    Bit reversed output data
  113. 213   +                  ;    Twiddle factors lookup table
  114. 214   +                  ;        Cosine value in X memory
  115. 215   +                  ;        -Sine value in Y memory
  116. 216   +                  ;
  117. 217   +                  ; Macro Call - ditfft points,passes,data,twiddle
  118. 218   +                  ;
  119. 219   +                  ;       points     number of points (4-32768, power of 2)
  120. 220   +                  ;       passes     number of fft passes (log2 points)
  121. 221   +                  ;       data       start of data buffer
  122. 222   +                  ;       twiddle    start of sine/cosine table
  123. 223   +                  ;
  124. 224   +                  ; Alters Data ALU Registers
  125. 225   +                  ;       x1     x0     y1     y0
  126. 226   +                  ;       a2     a1     a0     a
  127. 227   +                  ;       b2     b1     b0     b
  128. 228   +                  ;
  129. 229   +                  ; Alters Address Registers
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. Motorola DSP56000 Macro Cross Assembler  Version 1.00  05-14-87  11:35:33  fft.asm  Page 3
  137.  
  138.  
  139.  
  140. 230   +                  ;       r0     n0     m0
  141. 231   +                  ;       r1     n1     m1
  142. 232   +                  ;              n2
  143. 233   +                  ;
  144. 234   +                  ;       r4     n4     m4
  145. 235   +                  ;       r5     n5     m5
  146. 236   +                  ;       r6     n6     m6
  147. 237   +                  ;
  148. 238   +                  ; Alters Program Control Registers
  149. 239   +                  ;       pc     sr
  150. 240   +                  ;
  151. 241   +                  ; Uses 6 locations on System Stack
  152. 242   +                  ;
  153. 243   +                  ; Authors - Kevin Kloker and Garth Hillman
  154. 244   +                  ; Latest Revision - Jan. 20, 1986
  155. 245   +                  ;
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. Motorola DSP56000 Macro Cross Assembler  Version 1.00  05-14-87  11:35:33  fft.asm  Page 4
  203.  
  204.  
  205.  
  206. 247   +   P:0100 381000            move              #points,n0  ;initialize butterflies per group
  207. 248   +   P:0101 3A0100            move              #1,n2       ;initialize groups per pass
  208. 249   +   P:0102 3E0400            move              #points/4,n6 ;initialize twiddle offset
  209. 250   +   P:0103 05F420            move              #-1,m0      ;initialize address modifiers
  210.                  FFFFFF
  211. 251   +   P:0105 0461A0            move              m0,m1       ;for linear addressing
  212. 252   +   P:0106 0464A0            move              m0,m4
  213. 253   +   P:0107 0465A0            move              m0,m5
  214. 254   +   P:0108 0500A6            move              #0,m6       ;initialize twiddle factor address modifier
  215. 255   +                  ;for reverse carry (bit reversed) addressing
  216. 256   +                  ;
  217. 257   +                  ; Perform all FFT passes with triple nested DO loop
  218. 258   +                  ;
  219. 259   +   P:0109 060480            do      #passes,_end_pass
  220.                  000126
  221. 260   +   P:010B 230C00            move              n0,a1       ;divide butterflies per group by two
  222. 261   +   P:010C 300023            lsr     a         #data,r0    ;and initialize A input pointer
  223. 262   +   P:010D 219800            move              a1,n0       ;update butterflies per group
  224. 263   +   P:010E 221400            move              r0,r4       ;initialize A output pointer
  225. 264   +   P:010F 044811            lua     (r0)+n0,r1 ;initialize B input pointer
  226. 265   +   P:0110 045115            lua     (r1)-,r5  ;initialize B output pointer
  227. 266   +   P:0111 361000            move              #twiddle,r6 ;initialize twiddle factor pointer
  228. 267   +   P:0112 231900            move              n0,n1       ;initialize pointer offsets
  229. 268   +   P:0113 231C00            move              n0,n4
  230. 269   +   P:0114 231D00            move              n0,n5
  231. 270   +
  232. 271   +   P:0115 06DA00            do      n2,_end_grp
  233.                  000123
  234. 272   +   P:0117 C4C100            move              x:(r1),x1   y:(r6),y0   ;lookup -sine value
  235. 273   +   P:0118 CB8500            move              x:(r5),a    y:(r0),b    ;dummy load of a
  236. 274   +   P:0119 44CE00            move              x:(r6)+n6,x0 ;lookup cosine value
  237. 275   +
  238. 276   +
  239. 277   +   P:011A 06D800            do      n0,_end_bfy
  240.                  000121
  241. 278   +   P:011C 4FD9EA            mac     x1,y0,b               y:(r1)+,y1  ;Radix 2 DIT butterfly kernel
  242. 279   +   P:011D CA1DCB            macr    x0,y1,b   a,x:(r5)+   y:(r0),a    ;with constant twiddle factor
  243. 280   +   P:011E 8F8016            subl    b,a       x:(r0),b    b,y:(r4)
  244. 281   +   P:011F 8AB8AA            mac     x1,x0,b   x:(r0)+,a   a,y:(r5)
  245. 282   +   P:0120 45E1BF            macr    -y1,y0,b  x:(r1),x1
  246. 283   +   P:0121 CF1C16            subl    b,a       b,x:(r4)+   y:(r0),b
  247. 284   +                  _end_bfy
  248. 285   +   P:0122 D92D00            move              a,x:(r5)+n5 y:(r1)+n1,y1 ;dummy load of x1 and y1
  249. 286   +   P:0123 D58800            move              x:(r0)+n0,x1 y:(r4)+n4,y1
  250. 287   +                  _end_grp
  251. 288   +   P:0124 234C00            move              n2,a1
  252. 289   +   P:0125 200033            lsl     a         ;multiply groups per pass by two
  253. 290   +   P:0126 219A00            move              a1,n2       ;update groups per pass
  254. 291   +                  _end_pass
  255. 292                                end
  256. 0    Errors
  257. 1    Warnings
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. Motorola DSP56000 Macro Cross Assembler  Version 1.00  05-14-87  11:35:33  fft.asm  Page 5
  269.  
  270.  
  271.  
  272. Define symbols:
  273.  
  274. Symbol        Definition
  275.  
  276. PASSES........'4'
  277. POINTS........'16'
  278.  
  279.  
  280. Macros:
  281.  
  282. Name      Definition      Section
  283.              Line
  284.  
  285. ditfft........38  
  286. sintab........16  
  287.  
  288.  
  289. Symbols:
  290.  
  291. Name          Type    Value         Section      Attributes
  292.  
  293. ENT...........int     00000008                   GLOBAL
  294. FREQ..........fpt     0.392699                   GLOBAL
  295. PI............fpt     3.141593                   GLOBAL
  296. count.........int     00000008                   SET GLOBAL
  297. data..........int     00000000                   GLOBAL
  298. passes........int     00000004                   GLOBAL
  299. points........int     00000010                   GLOBAL
  300. reset.........int     00000000                   GLOBAL
  301. start.........int     00000100                   GLOBAL
  302. twiddle.......int     00000010                   GLOBAL
  303.  
  304.  
  305. Symbol cross-reference listing:
  306.  
  307. Name          Line number (* is definition)
  308. ENT...........  150*    151     155     178   
  309. FREQ..........  151*    159     161     163     165     167     169     171     173     182     184     186     188     190   
  310.                 192     194     196   
  311. PI............  149*    151   
  312. count.........  154*    159     160     160*    161     162     162*    163     164     164*    165     166     166*    167   
  313.                 168     168*    169     170     170*    171     172     172*    173     174     174*    177*    182     183   
  314.                 183*    184     185     185*    186     187     187*    188     189     189*    190     191     191*    192   
  315.                 193     193*    194     195     195*    196     197     197*  
  316. data..........  144*    261   
  317. passes........  141*    259   
  318. points........  140*    150     247     249   
  319. reset.........  143*    200   
  320. start.........  145*    201     203   
  321. twiddle.......  142*    153     176     266   
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. Motorola DSP56000 Macro Cross Assembler  Version 1.00  05-14-87  11:35:33  fft.asm  Page 6
  335.  
  336.  
  337.  
  338.                          Memory Utilization Report
  339.  
  340.  
  341. X Memory
  342.  
  343. Start    End     Length    Type      Label       Section     Overlay Address
  344. 0000     000F       16     UNUSED
  345. 0010     0017        8     CONST 
  346. 0018     FFFF    65512     UNUSED
  347.  
  348.  
  349. Y Memory
  350.  
  351. Start    End     Length    Type      Label       Section     Overlay Address
  352. 0000     000F       16     UNUSED
  353. 0010     0017        8     CONST 
  354. 0018     FFFF    65512     UNUSED
  355.  
  356.  
  357. L Memory
  358.  
  359. Start    End     Length    Type      Label       Section     Overlay Address
  360. 0000     FFFF    65536     UNUSED
  361.  
  362.  
  363. P Memory
  364.  
  365. Start    End     Length    Type      Label       Section     Overlay Address
  366. 0000     0000        1     CODE  
  367. 0001     00FF      255     UNUSED
  368. 0100     0126       39     CODE  
  369. 0127     FFFF    65241     UNUSED
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.