📄 fft16_emac.s.list
字号:
0x00000120: 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
0x00000122: d480 add.l d0,d2 ;xr = ar + br
0x00000124: 30c2 move.w d2,(a0)+
0x00000126: d681 add.l d1,d3 ;xi = ai + bi
0x00000128: 32c3 move.w d3,(a1)+
0x0000012a: 9084 sub.l d4,d0 ;yr = ar - br
0x0000012c: 30c0 move.w d0,(a0)+
0x0000012e: 9285 sub.l d5,d1 ;yi = ai - bi
0x00000130: 32c1 move.w d1,(a1)+
0x00000132: 5286 addq.l #1,d6
0x00000134: 0c8600000100 cmpi.l #256,d6
0x0000013a: 65ce bcs.b first_stage
0x0000013c: 2c7c00000000 movea.l #0,a6 ;second stage of FFT
0x00000142: 41e8fc00 lea (-1024,a0),a0 ;a0 points to the beginning of ReX buffer
0x00000146: 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
0x0000014a: 2010 move.l (a0),d0 ;d0 = ar0,ar1
0x0000014c: 2200 move.l d0,d1 ;d1 = ar0,ar1
0x0000014e: 4840 swap d0 ;d0 = ar1,ar0
0x00000150: 48c0 ext.l d0 ;d0 = ar0
0x00000152: 48c1 ext.l d1 ;d1 = ar1
0x00000154: 24280004 move.l (4,a0),d2 ;d2 = br0,br1
0x00000158: 2602 move.l d2,d3 ;d3 = br0,br1
0x0000015a: 4842 swap d2 ;d2 = br1,br0
0x0000015c: 48c2 ext.l d2 ;d2 = br0
0x0000015e: 48c3 ext.l d3 ;d3 = br1
0x00000160: 2811 move.l (a1),d4 ;d4 = ai0,ai1
0x00000162: 2a04 move.l d4,d5 ;d5 = ai0,ai1
0x00000164: 4844 swap d4 ;d4 = ai1,ai0
0x00000166: 48c4 ext.l d4 ;d4 = ai0
0x00000168: 48c5 ext.l d5 ;d5 = ai1
0x0000016a: 2c290004 move.l (4,a1),d6 ;d6 = bi0,bi1
0x0000016e: 2e06 move.l d6,d7 ;d7 = bi0,bi1
0x00000170: 4846 swap d6 ;d6 = bi1,bi0
0x00000172: 48c6 ext.l d6 ;d6 = bi0
0x00000174: 48c7 ext.l d7 ;d7 = bi1
0x00000176: 2440 movea.l d0,a2 ;a2 = ar0
0x00000178: 2641 movea.l d1,a3 ;a3 = ar1
0x0000017a: 2844 movea.l d4,a4 ;a4 = ai0
0x0000017c: 2a45 movea.l d5,a5 ;a5 = ai1
0x0000017e: d082 add.l d2,d0 ;xr0 = ar0 + br0
0x00000180: 30c0 move.w d0,(a0)+
0x00000182: d287 add.l d7,d1 ;xr1 = ar1 + bi1
0x00000184: 30c1 move.w d1,(a0)+
0x00000186: 95c2 suba.l d2,a2 ;yr0 = ar0 - br0
0x00000188: 30ca move.w a2,(a0)+
0x0000018a: 97c7 suba.l d7,a3 ;yr1 = ar1 - bi1
0x0000018c: 30cb move.w a3,(a0)+
0x0000018e: d886 add.l d6,d4 ;xi0 = ai0 + bi0
0x00000190: 32c4 move.w d4,(a1)+
0x00000192: 9a83 sub.l d3,d5 ;xi1 = ai1 - br1
0x00000194: 32c5 move.w d5,(a1)+
0x00000196: 99c6 suba.l d6,a4 ;yi0 = ai0 - bi0
0x00000198: 32cc move.w a4,(a1)+
0x0000019a: dbc3 adda.l d3,a5 ;yi1 = ai1 + br1
0x0000019c: 32cd move.w a5,(a1)+
0x0000019e: 528e addq.l #1,a6 ;
0x000001a0: bdfc00000080 cmpa.l #128,a6
0x000001a6: 65a2 bcs.b second_stage
0x000001a8: 203c00000040 move.l #64,d0 ;FFT for complex values
0x000001ae: 2f400040 move.l d0,(64,a7) ;starts from 3-rd stage
0x000001b2: 7002 moveq.l #2,d0
0x000001b4: 2f400044 move.l d0,(68,a7) ;stage loop counter (starts from 3rd stage)
0x000001b8: 2a7c00000008 movea.l #8,a5 ;a5 contains the number of butterflies
;per one sub DFT multiplied
;by 2 (the size of values)
0x000001be: 2c3c00000200 move.l #512,d6 ;step in the table of twiddle factors
;(multiplied by 2 because of the size
;of coefficients)
0x000001c4: 2c7c00000000 movea.l #0,a6 ;counter for butterfly loop
;from MSW to LSW to store it correctly
;into the memory)
0x000001ca: a93c00000070 move.l #0x00000070,MACSR
0x000001d0: 4282 clr.l d2
0x000001d2: 4287 clr.l d7
0x000001d4: a13c00000000 move.l #0,ACC0
0x000001da: a33c00000000 move.l #0,ACC1
next_stage ;start of stages loop
0x000001e0: 7000 moveq.l #0,d0
0x000001e2: 2f40003c move.l d0,(60,a7) ;sub DFT loop counter
0x000001e6: 4cef0300004c movem.l (76,a7),a0-a1 ;a0 points to ar0, a1 points to ai0
0x000001ec: 2448 movea.l a0,a2
0x000001ee: 2649 movea.l a1,a3
0x000001f0: d5cd adda.l a5,a2 ;a2 points to br0
0x000001f2: d7cd adda.l a5,a3 ;a3 points to bi0
next_subDFT ;start of sub DFTs loop
0x000001f4: 287c00000000 movea.l #TF_table,a4 ;a4 points to the beginning of the table
next_bf ;start of butterflies loop
0x000001fa: 2014 move.l (a4),d0 ;wr -> MSW of d0
;wi -> LSW of d0
0x000001fc: 2812 move.l (a2),d4
0x000001fe: 3410 move.w (a0),d2
0x00000200: 3e11 move.w (a1),d7
0x00000202: aa9343c0 msacl.w d0.u,d4.u,<<,(a3),d5,ACC0 ;ar-br*wr -> ACC, bi -> MSW of d5
0x00000206: aa000380 msac.w d0.l,d5.u,<<,ACC0 ;ar-br*wr-bi*wi = xr -> ACC, ai -> MSW of d7
0x0000020a: a8800280 mac.w d0.l,d4.u,<<,ACC1 ;ai+br*wi -> ACC, ar -> MSW of d2
0x0000020e: aa8003c0 msac.w d0.u,d5.u,<<,ACC1 ;ai+br*wi-bi*wr = xi -> ACC, br -> MSW of d4
0x00000212: a1c3 movclr.l ACC0,d3
0x00000214: a3c1 movclr.l ACC1,d1
0x00000216: d682 add.l d2,d3
0x00000218: 30c3 move.w d3,(a0)+ ;xr -> memory
0x0000021a: d482 add.l d2,d2 ;2*ar -> d2
0x0000021c: 9483 sub.l d3,d2 ;2*ar-xr = yr -> d2
0x0000021e: 34c2 move.w d2,(a2)+ ;yr -> memory
0x00000220: d287 add.l d7,d1
0x00000222: 32c1 move.w d1,(a1)+ ;xi -> memory
0x00000224: de87 add.l d7,d7 ;2*ai -> d7
0x00000226: 9e81 sub.l d1,d7 ;2*ai-xi = yi -> d7
0x00000228: 36c7 move.w d7,(a3)+ ;yi -> memory
0x0000022a: d9c6 adda.l d6,a4 ;modify pointer to the twiddle factor
;for the next butterfly
0x0000022c: 548e addq.l #2,a6
0x0000022e: bdcd cmpa.l a5,a6
0x00000230: 65c8 bcs.b next_bf ;end of butterflies loop
;of the current sub DFT
0x00000232: 2c7c00000000 move.l #0,a6
0x00000238: d1cd adda.l a5,a0 ;a0 - a3 point to the input values
0x0000023a: d3cd adda.l a5,a1 ;for the first butterfly
0x0000023c: d5cd adda.l a5,a2 ;of the next sub DFT
0x0000023e: d7cd adda.l a5,a3
0x00000240: 202f003c move.l (60,a7),d0
0x00000244: 5280 addq.l #1,d0
0x00000246: 2f40003c move.l d0,(60,a7) ;increment sub DFT loop counter
0x0000024a: b0af0040 cmp.l (64,a7),d0
;compare sub DFT loop counter with
;the number of sub DFTs on this stage
0x0000024e: 6500ffa4 bcs.w next_subDFT ;end of sub DFTs loop
0x00000252: 7000 moveq.l #0,d0
0x00000254: 2f40003c move.l d0,(60,a7) ;store 0 to the sub DFT loop counter
0x00000258: dbcd adda.l a5,a5 ;multiply contents of a5 (the number of
;butterflies per one sub DFT) by 2 for the
;next stage
0x0000025a: e28e lsr.l #1,d6 ;divide step in the table of twiddle
;factors by 2
0x0000025c: 202f0040 move.l (64,a7),d0 ;divide the number of sub DFTs for the
0x00000260: e288 lsr.l #1,d0 ;next stage by 2
0x00000262: 2f400040 move.l d0,(64,a7)
0x00000266: 202f0044 move.l (68,a7),d0 ;increment stage loop counter
0x0000026a: 5280 addq.l #1,d0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -