⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fft16_mac.s.list

📁 freescale MAC DSP的算法库(FFT
💻 LIST
📖 第 1 页 / 共 5 页
字号:
                             ;	float tr,ti;
                             ;
                             ;	j=nd2;
                             ;	for (i=1;i<=n-2;i++){
                             ;		if (i<j){
                             ;			tr=ReX[j];
                             ;			ti=ImX[j];
                             ;			ReX[j]=ReX[i];
                             ;			ImX[j]=ImX[i];
                             ;			ReX[i]=tr;
                             ;			ImX[i]=ti;
                             ;	  	}
                             ;		k=nd2;
                             ; 		while (k<=j){
                             ;			j=j-k;
                             ;			k=k>>1;
                             ; 		}
                             ;  		j=j+k;
                             ;	}
                             ;
                             ;	}
                             _rev_addr_sort                                   
0x00000000: 4cef03000004                        movem.l      (4,a7),a0/a1     ;load start addresses of ReX and ImX buffers
                                                                              ;to a0 and a1 registers
0x00000006: 243c00000200                        move.l       #512,d2          ;store nd2*2 into d2 register (d2 is j)
                                                                              ;'2' is the size of one sample (2 bytes)
0x0000000c: 7202                                moveq.l      #2,d1            ;d1 is i
                             for                                              ;for (i=1;i<=n-2;i++){
0x0000000e: b282                                cmp.l        d2,d1            ;if (i<j){
0x00000010: 641c                                bcc.b        jk               
0x00000012: 45f01800                            lea          (a0,d1.l),a2     ;add index j to the beginning address of buffer ReX
                                                                              ;and store it into a2
0x00000016: 47f11800                            lea          (a1,d1.l),a3     ;add index j to the beginning address of buffer ImX
                                                                              ;and store it into a3
0x0000001a: 36302800                            move.w       (a0,d2.l),d3     ;tr=ReX[j];
0x0000001e: 38312800                            move.w       (a1,d2.l),d4     ;ti=ImX[j];
0x00000022: 31922800                            move.w       (a2),(a0,d2.l)   ;ReX[j]=ReX[i];
0x00000026: 33932800                            move.w       (a3),(a1,d2.l)   ;ImX[j]=ImX[i];
0x0000002a: 3483                                move.w       d3,(a2)          ;ReX[i]=tr;
0x0000002c: 3684                                move.w       d4,(a3)          ;ImX[i]=ti;
                             jk                                               
0x0000002e: 203c00000200                        move.l       #512,d0          ;d0 is k, k=nd2*2
                                                                              ;'2' is the size of one sample (2 bytes);

0x00000034: b480                                cmp.l        d0,d2            ;while (k<=j){
0x00000036: 6508                                bcs.b        j                
0x00000038: 9480             while              sub.l        d0,d2            ;j=j-k;
0x0000003a: e288                                lsr.l        #1,d0            ;k=k>>1;
0x0000003c: b480                                cmp.l        d0,d2            
0x0000003e: 64f8                                bcc.b        while            
                             j                                                
0x00000040: d480                                add.l        d0,d2            ;j=j+k;
0x00000042: 5481                                addq.l       #2,d1            
0x00000044: 0c81000003fe                        cmp.l        #1022,d1         
0x0000004a: 65c2                                bcs.b        for              
0x0000004c: 4e75                                rts                           
                             ;**********************************************************************************
                             ;Real FFT
                             ;**********************************************************************************
                             ;Upon entry, REX[ ] contains the real input signal, while values in IMX[ ] are
                             ;ignored.
                             ;Upon return, REX[ ] and IMX[ ] contain the DFT output.
                             ;All signals run from 0 to 1023.
                             ;**********************************************************************************
                             _fft16_mac                                       
0x0000004e: 4fefffb8                            lea          -72(a7),a7       
0x00000052: 48d77fff                            movem.l      d0-d7/a0-a6,(a7) ;store contents of all registers into stack
                                                                              ;Corresponding C code:		;separate even and odd points
                                                                              ;for (i=0;i<512;i++){
                                                                              ;    ReX[i]=ReX[2*i];
                                                                              ;    ImX[i]=ReX[2*i+1];
                                                                              ;}
0x00000056: 4cef0300004c                        movem.l      (76,a7),a0/a1    ;separate even and odd points
                                                                              ;point a0 and a1 to ReX and ImX buffers
0x0000005c: 7000                                moveq.l      #0,d0            
0x0000005e: 2448                                movea.l      a0,a2            
                             reorder                                          
0x00000060: 22300800                            move.l       (0,a0,d0.l),d1   ;ReX[i],ImX[i] - > d1
0x00000064: 32c1                                move.w       d1,(a1)+         ;ImX[i]=ImX[2*i+1];
0x00000066: 4841                                swap         d1               
0x00000068: 34c1                                move.w       d1,(a2)+         ;ReX[i]=ReX[2*i];
0x0000006a: 5880                                addq.l       #4,d0            ;modification of loop counter
0x0000006c: 0c8000000800                        cmpi.l       #2048,d0         
0x00000072: 65ec                                bcs.b        reorder          
0x00000074: 43e9fc00                            lea          -1024(a1),a1     ;bit reversal sorting
0x00000078: 2f09                                move.l       a1,-(a7)         ;push address of ImX[] buffer into the stack
0x0000007a: 2f08                                move.l       a0,-(a7)         ;push address of ReX[] buffer into the stack
0x0000007c: 4eb900000000                        jsr          _rev_addr_sort   ;jump to subroutine
0x00000082: 4fef0008                            lea          (8,a7),a7        ;
0x00000086: 7c00                                moveq.l      #0,d6            ;first stage of FFT
                             first_stage                                      
0x00000088: 2010                                move.l       (a0),d0          ;d0 = ar,br
0x0000008a: 2400                                move.l       d0,d2            ;d2 = ar,br
0x0000008c: 4840                                swap         d0               ;d0 = br,ar
0x0000008e: 48c0                                ext.l        d0               ;d0 = ar
0x00000090: 48c2                                ext.l        d2               ;d2 = br
0x00000092: 2211                                move.l       (a1),d1          ;d1 = ai,bi
0x00000094: 2601                                move.l       d1,d3            ;d3 = ai,bi
0x00000096: 4841                                swap         d1               ;d1 = bi,ai
0x00000098: 48c1                                ext.l        d1               ;d1 = ai
0x0000009a: 48c3                                ext.l        d3               ;d3 = bi
0x0000009c: 2802                                move.l       d2,d4            ;d4 = br
0x0000009e: 2a03                                move.l       d3,d5            ;d5 = bi
                                                                              ;on the first stage the butterfly operation
                                                                              ;looks like:
                                                                              ;xr = ar + br
                                                                              ;xi = ai + bi
                                                                              ;yr = ar - br
                                                                              ;yi = ai - bi
0x000000a0: d480                                add.l        d0,d2            ;xr = ar + br
0x000000a2: 30c2                                move.w       d2,(a0)+         
0x000000a4: d681                                add.l        d1,d3            ;xi = ai + bi
0x000000a6: 32c3                                move.w       d3,(a1)+         
0x000000a8: 9084                                sub.l        d4,d0            ;yr = ar - br
0x000000aa: 30c0                                move.w       d0,(a0)+         
0x000000ac: 9285                                sub.l        d5,d1            ;yi = ai - bi
0x000000ae: 32c1                                move.w       d1,(a1)+         
0x000000b0: 5286                                addq.l       #1,d6            
0x000000b2: 0c8600000100                        cmpi.l       #256,d6          
0x000000b8: 65ce                                bcs.b        first_stage      
0x000000ba: 2c7c00000000                        movea.l      #0,a6            ;second stage of FFT
0x000000c0: 41e8fc00                            lea          (-1024,a0),a0    ;a0 points to the beginning of ReX buffer
0x000000c4: 43e9fc00                            lea          (-1024,a1),a1    ;a1 points to the beginning of ImX buffer
                                                                              ;on the second stage we will calculate
                                                                              ;two butterflies, first of which looks like
                                                                              ;butterfly on the first stage
                                                                              ;xr0 = ar0 + br0
                                                                              ;xi0 = ai0 + bi0
                                                                              ;yr0 = ar0 - br0
                                                                              ;yi0 = ai0 - bi0,
                                                                              ;and second looks like
                                                                              ;xr1 = ar1 + bi1
                                                                              ;xi1 = ai1 - br1
                                                                              ;yr1 = ar1 - bi1
                                                                              ;yi1 = ai1 + br1
                             second_stage                                     
0x000000c8: 2010                                move.l       (a0),d0          ;d0 = ar0,ar1
0x000000ca: 2200                                move.l       d0,d1            ;d1 = ar0,ar1
0x000000cc: 4840                                swap         d0               ;d0 = ar1,ar0
0x000000ce: 48c0                                ext.l        d0               ;d0 = ar0
0x000000d0: 48c1                                ext.l        d1               ;d1 = ar1
0x000000d2: 24280004                            move.l       (4,a0),d2        ;d2 = br0,br1
0x000000d6: 2602                                move.l       d2,d3            ;d3 = br0,br1
0x000000d8: 4842                                swap         d2               ;d2 = br1,br0
0x000000da: 48c2                                ext.l        d2               ;d2 = br0
0x000000dc: 48c3                                ext.l        d3               ;d3 = br1
0x000000de: 2811                                move.l       (a1),d4          ;d4 = ai0,ai1
0x000000e0: 2a04                                move.l       d4,d5            ;d5 = ai0,ai1
0x000000e2: 4844                                swap         d4               ;d4 = ai1,ai0
0x000000e4: 48c4                                ext.l        d4               ;d4 = ai0
0x000000e6: 48c5                                ext.l        d5               ;d5 = ai1
0x000000e8: 2c290004                            move.l       (4,a1),d6        ;d6 = bi0,bi1
0x000000ec: 2e06                                move.l       d6,d7            ;d7 = bi0,bi1
0x000000ee: 4846                                swap         d6               ;d6 = bi1,bi0

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -