📄 fft16_emac.s.list
字号:
; while (k<=j){
; j=j-k;
; k=k>>1;
; }
; j=j+k;
; }
;
; }
_rev_addr_sort16
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
;******************************************************************************
;Scale
;******************************************************************************
;Divide values in Rex[] and ImX[] by 2.
;******************************************************************************
scale
0x0000004e: 2f06 move.l d6,-(a7)
0x00000050: 2f07 move.l d7,-(a7)
0x00000052: 2648 move.l a0,a3
0x00000054: d7fc00000400 add.l #1024,a3
scnext
0x0000005a: 4cd0000f movem.l (a0),d0-d3
0x0000005e: 2800 move.l d0,d4
0x00000060: 2a01 move.l d1,d5
0x00000062: 2c02 move.l d2,d6
0x00000064: 2e03 move.l d3,d7
0x00000066: e280 asr.l #1,d0
0x00000068: e281 asr.l #1,d1
0x0000006a: e282 asr.l #1,d2
0x0000006c: e283 asr.l #1,d3
0x0000006e: 48c4 ext.l d4
0x00000070: 48c5 ext.l d5
0x00000072: 48c6 ext.l d6
0x00000074: 48c7 ext.l d7
0x00000076: e284 asr.l #1,d4
0x00000078: e285 asr.l #1,d5
0x0000007a: e286 asr.l #1,d6
0x0000007c: e287 asr.l #1,d7
0x0000007e: 3004 move.w d4,d0
0x00000080: 3205 move.w d5,d1
0x00000082: 3406 move.w d6,d2
0x00000084: 3607 move.w d7,d3
0x00000086: 48d0000f movem.l d0-d3,(a0)
0x0000008a: d1fc00000010 adda.l #16,a0
0x00000090: 4cd1000f movem.l (a1),d0-d3
0x00000094: 2800 move.l d0,d4
0x00000096: 2a01 move.l d1,d5
0x00000098: 2c02 move.l d2,d6
0x0000009a: 2e03 move.l d3,d7
0x0000009c: e280 asr.l #1,d0
0x0000009e: e281 asr.l #1,d1
0x000000a0: e282 asr.l #1,d2
0x000000a2: e283 asr.l #1,d3
0x000000a4: 48c4 ext.l d4
0x000000a6: 48c5 ext.l d5
0x000000a8: 48c6 ext.l d6
0x000000aa: 48c7 ext.l d7
0x000000ac: e284 asr.l #1,d4
0x000000ae: e285 asr.l #1,d5
0x000000b0: e286 asr.l #1,d6
0x000000b2: e287 asr.l #1,d7
0x000000b4: 3004 move.w d4,d0
0x000000b6: 3205 move.w d5,d1
0x000000b8: 3406 move.w d6,d2
0x000000ba: 3607 move.w d7,d3
0x000000bc: 48d1000f movem.l d0-d3,(a1)
0x000000c0: d3fc00000010 adda.l #16,a1
0x000000c6: b1cb cmp.l a3,a0
0x000000c8: 6590 bcs.b scnext
0x000000ca: 2e1f move.l (a7)+,d7
0x000000cc: 2c1f move.l (a7)+,d6
0x000000ce: 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_emac
0x000000d0: 4fefffb8 lea -72(a7),a7
0x000000d4: 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];
;}
0x000000d8: 4cef0300004c movem.l (76,a7),a0/a1 ;separate even and odd points
;point a0 and a1 to ReX and ImX buffers
0x000000de: 7000 moveq.l #0,d0
0x000000e0: 2448 movea.l a0,a2
reorder
0x000000e2: 22300800 move.l (a0,d0.l),d1 ;ReX[i],ImX[i] - > d1
0x000000e6: 32c1 move.w d1,(a1)+ ;ImX[i]=ImX[2*i+1];
0x000000e8: 4841 swap d1
0x000000ea: 34c1 move.w d1,(a2)+ ;ReX[i]=ReX[2*i];
0x000000ec: 5880 addq.l #4,d0 ;modification of loop counter
0x000000ee: 0c8000000800 cmpi.l #2048,d0
0x000000f4: 65ec bcs.b reorder
0x000000f6: 43e9fc00 lea -1024(a1),a1 ;bit reversal sorting
0x000000fa: 2f09 move.l a1,-(a7) ;push address of ImX[] buffer into the stack
0x000000fc: 2f08 move.l a0,-(a7) ;push address of ReX[] buffer into the stack
0x000000fe: 4eb900000000 jsr _rev_addr_sort16 ;jump to subroutine
0x00000104: 4fef0008 lea (8,a7),a7 ;
0x00000108: 7c00 moveq.l #0,d6 ;first stage of FFT
first_stage
0x0000010a: 2010 move.l (a0),d0 ;d0 = ar,br
0x0000010c: 2400 move.l d0,d2 ;d2 = ar,br
0x0000010e: 4840 swap d0 ;d0 = br,ar
0x00000110: 48c0 ext.l d0 ;d0 = ar
0x00000112: 48c2 ext.l d2 ;d2 = br
0x00000114: 2211 move.l (a1),d1 ;d1 = ai,bi
0x00000116: 2601 move.l d1,d3 ;d3 = ai,bi
0x00000118: 4841 swap d1 ;d1 = bi,ai
0x0000011a: 48c1 ext.l d1 ;d1 = ai
0x0000011c: 48c3 ext.l d3 ;d3 = bi
0x0000011e: 2802 move.l d2,d4 ;d4 = br
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -