📄 ff.s
字号:
movw R4,R18
movw R16,R14
xcall int2fp
push R2
push R3
push R4
push R5
xcall _cos
pop R5
pop R4
pop R3
pop R2
movw R6,R16
movw R8,R18
ldi R16,4
ldi R17,0
movw R18,R12
xcall empy16s
movw R24,R16
ldd R0,y+38
ldd R1,y+39
add R24,R0
adc R25,R1
movw R30,R24
ldd R20,z+0
ldd R21,z+1
ldd R22,z+2
ldd R23,z+3
st -y,R23
st -y,R22
st -y,R21
st -y,R20
movw R18,R12
; stack offset 4
ldd R0,y+26
ldd R1,y+27
add R18,R0
adc R19,R1
ldi R16,4
ldi R17,0
xcall empy16s
movw R30,R16
; stack offset 4
ldd R0,y+40
ldd R1,y+41
add R30,R0
adc R31,R1
ldd R20,z+0
ldd R21,z+1
ldd R22,z+2
ldd R23,z+3
st -y,R23
st -y,R22
st -y,R21
st -y,R20
st -y,R5
st -y,R4
st -y,R3
st -y,R2
xcall empy32fs
xcall sub32fs
movw R18,R12
; stack offset 4
ldd R0,y+26
ldd R1,y+27
add R18,R0
adc R19,R1
ldi R16,4
ldi R17,0
xcall empy16s
movw R30,R16
; stack offset 4
ldd R0,y+42
ldd R1,y+43
add R30,R0
adc R31,R1
ldd R2,z+0
ldd R3,z+1
ldd R4,z+2
ldd R5,z+3
st -y,R5
st -y,R4
st -y,R3
st -y,R2
st -y,R9
st -y,R8
st -y,R7
st -y,R6
xcall empy32fs
xcall add32f
movw R30,R24
std z+0,R16
std z+1,R17
std z+2,R18
std z+3,R19
.dbline 61
movw R16,R14
xcall int2fp
xcall _cos
movw R2,R16
movw R4,R18
movw R16,R14
xcall int2fp
push R2
push R3
push R4
push R5
xcall _sin
pop R5
pop R4
pop R3
pop R2
movw R6,R16
movw R8,R18
movw R18,R12
ldd R0,y+22
ldd R1,y+23
add R18,R0
adc R19,R1
ldi R16,4
ldi R17,0
xcall empy16s
movw R24,R16
ldd R0,y+36
ldd R1,y+37
add R24,R0
adc R25,R1
movw R30,R28
ldd R20,z+0
ldd R21,z+1
ldd R22,z+2
ldd R23,z+3
st -y,R23
st -y,R22
st -y,R21
st -y,R20
movw R30,R24
ldd R20,z+0
ldd R21,z+1
ldd R22,z+2
ldd R23,z+3
st -y,R23
st -y,R22
st -y,R21
st -y,R20
st -y,R5
st -y,R4
st -y,R3
st -y,R2
xcall empy32fs
xcall sub32fs
movw R18,R12
; stack offset 4
ldd R0,y+26
ldd R1,y+27
add R18,R0
adc R19,R1
ldi R16,4
ldi R17,0
xcall empy16s
movw R30,R16
; stack offset 4
ldd R0,y+42
ldd R1,y+43
add R30,R0
adc R31,R1
ldd R2,z+0
ldd R3,z+1
ldd R4,z+2
ldd R5,z+3
st -y,R5
st -y,R4
st -y,R3
st -y,R2
st -y,R9
st -y,R8
st -y,R7
st -y,R6
xcall empy32fs
xcall sub32f
movw R30,R24
std z+0,R16
std z+1,R17
std z+2,R18
std z+3,R19
.dbline 62
movw R16,R14
xcall int2fp
xcall _sin
movw R2,R16
movw R4,R18
movw R16,R14
xcall int2fp
push R2
push R3
push R4
push R5
xcall _cos
pop R5
pop R4
pop R3
pop R2
movw R6,R16
movw R8,R18
movw R30,R28
ldd R20,z+4
ldd R21,z+5
ldd R22,z+6
ldd R23,z+7
st -y,R23
st -y,R22
st -y,R21
st -y,R20
movw R30,R28
; stack offset 4
ldd R20,z+12
ldd R21,z+13
ldd R22,z+14
ldd R23,z+15
st -y,R23
st -y,R22
st -y,R21
st -y,R20
st -y,R5
st -y,R4
st -y,R3
st -y,R2
xcall empy32fs
xcall add32fs
movw R18,R12
; stack offset 4
ldd R0,y+26
ldd R1,y+27
add R18,R0
adc R19,R1
ldi R16,4
ldi R17,0
xcall empy16s
movw R30,R16
; stack offset 4
ldd R0,y+42
ldd R1,y+43
add R30,R0
adc R31,R1
ldd R2,z+0
ldd R3,z+1
ldd R4,z+2
ldd R5,z+3
st -y,R5
st -y,R4
st -y,R3
st -y,R2
st -y,R9
st -y,R8
st -y,R7
st -y,R6
xcall empy32fs
xcall sub32f
movw R18,R12
ldd R0,y+22
ldd R1,y+23
add R18,R0
adc R19,R1
ldi R16,4
ldi R17,0
xcall empy16s
movw R30,R16
ldd R0,y+38
ldd R1,y+39
add R30,R0
adc R31,R1
std z+0,R16
std z+1,R17
std z+2,R18
std z+3,R19
.dbline 69
L26:
.dbline 54
ldi R16,2
ldi R17,0
ldd R18,y+22
ldd R19,y+23
xcall empy16s
add R12,R16
adc R13,R17
L28:
.dbline 54
movw R24,R12
cpi R24,8
ldi R30,0
cpc R25,R30
brge X2
xjmp L25
X2:
.dbline 71
L19:
.dbline 42
movw R24,R10
adiw R24,1
movw R10,R24
L21:
.dbline 42
ldd R24,y+22
ldd R25,y+23
sbiw R24,1
cp R24,R10
cpc R25,R11
brlt X3
xjmp L18
X3:
.dbline 73
L12:
.dbline 32
ldd R24,y+24
ldd R25,y+25
adiw R24,1
std y+25,R25
std y+24,R24
.dbline 32
ldi R24,3
ldi R25,0
ldd R0,y+24
ldd R1,y+25
cp R24,R0
cpc R25,R1
brlt X4
xjmp L11
X4:
.dbline 75
; { p=2*PI*p/8;
; TR = dataR [ k ] ;
; TI = dataI [ k ] ;
; temp = dataR [ k + b ] ;
; dataR[k]=dataR[k]+dataR[k+b]*cos(p)+dataI[k+b]*sin(p);
; dataI[k]=dataI[k]-dataR[k+b]*sin(p)+dataI[k+b]*cos(p);
; dataR[k+b]=TR-dataR[k+b]*cos(p)-dataI[k+b]*sin(p);
; dataI[k+b]=TI+temp*sin(p)-dataI[k+b]*cos(p);
;
;
; /*dataR [ k ] = dataR [ k ] + dataR [ k + b ] * cos_tab [ p ] + dataI [ k + b ] * sin_tab [ p ] ;
; dataI [ k ] = dataI [ k ] - dataR [ k + b ] * sin_tab [ p ] + dataI [ k + b ] * cos_tab [ p ] ;
; dataR [ k + b ] = TR - dataR [ k + b ] * cos_tab [ p ] - dataI [ k + b ] * sin_tab [ p ] ;
; dataI [ k + b ] = TI + temp * sin_tab [ p ] - dataI [ k + b ] * cos_tab [ p ] ;*/
; } /* END for (3) */
;
; } /* END for (2) */
;
; } /* END for (1) */
;
; for ( i = 0 ; i < 32 ; i ++ )
clr R2
sts _i,R2
xjmp L34
L31:
.dbline 76
; { /* 只需要32次以下的谐波进行分析 */
.dbline 77
; w [ i ] = sqrt ( dataR [ i ] * dataR [ i ] + dataI [ i ] * dataI [ i ] ) ;
lds R2,_i
ldi R24,4
mul R24,R2
movw R2,R0
movw R30,R2
ldd R0,y+36
ldd R1,y+37
add R30,R0
adc R31,R1
ldd R4,z+0
ldd R5,z+1
ldd R6,z+2
ldd R7,z+3
movw R30,R28
std z+14,R4
std z+15,R5
std z+16,R6
std z+17,R7
movw R30,R2
ldd R0,y+38
ldd R1,y+39
add R30,R0
adc R31,R1
ldd R2,z+0
ldd R3,z+1
ldd R4,z+2
ldd R5,z+3
movw R30,R28
std z+18,R2
std z+19,R3
std z+20,R4
std z+21,R5
movw R30,R28
ldd R2,z+14
ldd R3,z+15
ldd R4,z+16
ldd R5,z+17
st -y,R5
st -y,R4
st -y,R3
st -y,R2
movw R30,R28
; stack offset 4
ldd R2,z+18
ldd R3,z+19
ldd R4,z+20
ldd R5,z+21
st -y,R5
st -y,R4
st -y,R3
st -y,R2
xcall empy32fs
movw R30,R28
; stack offset 4
ldd R2,z+22
ldd R3,z+23
ldd R4,z+24
ldd R5,z+25
st -y,R5
st -y,R4
st -y,R3
st -y,R2
movw R30,R28
; stack offset 8
ldd R2,z+26
ldd R3,z+27
ldd R4,z+28
ldd R5,z+29
st -y,R5
st -y,R4
st -y,R3
st -y,R2
xcall empy32fs
xcall add32f
xcall _sqrt
movw R2,R16
movw R4,R18
st -y,R19
st -y,R18
st -y,R17
st -y,R16
ldi R16,<L37
ldi R17,>L37
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
xcall cmp32f
brlt L35
st -y,R5
st -y,R4
st -y,R3
st -y,R2
ldi R16,<L37
ldi R17,>L37
xcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
xcall sub32f
xcall fp2int
movw R24,R16
subi R24,0 ; offset = 32768
sbci R25,128
movw R14,R24
xjmp L36
L35:
movw R16,R2
movw R18,R4
xcall fp2int
movw R14,R16
L36:
ldi R24,<_w
ldi R25,>_w
lds R30,_i
clr R31
add R30,R24
adc R31,R25
std z+0,R14
.dbline 78
; if ( i )
lds R6,_i
tst R6
breq L38
.dbline 79
; {
.dbline 80
; w [ i ] = w [ i ] / 64 ;
clr R7
add R6,R24
adc R7,R25
ldi R17,64
movw R30,R6
ldd R16,z+0
xcall div8u
movw R30,R6
std z+0,R16
.dbline 81
; }
L38:
.dbline 82
L32:
.dbline 75
lds R24,_i
subi R24,255 ; addi 1
sts _i,R24
L34:
.dbline 75
lds R24,_i
cpi R24,32
brsh X5
xjmp L31
X5:
.dbline 83
; }
; w [ 0 ] = w [ 0 ] / 2 ;
lds R6,_w
lsr R6
sts _w,R6
.dbline -2
L1:
adiw R28,26
xcall pop_gset5
adiw R28,4
.dbline 0 ; func end
ret
.dbsym l xx 12 I
.dbsym r x2 14 I
.dbsym r x1 10 I
.dbsym r x0 12 I
.dbsym l L 24 I
.dbsym r j 10 I
.dbsym l temp 8 D
.dbsym l TI 4 D
.dbsym l TR 0 D
.dbsym l b 22 I
.dbsym r p 14 I
.dbsym r k 12 I
.dbsym l dataI 38 pD
.dbsym l dataR 36 pD
.dbend
.dbfunc e main _main fV
.even
_main::
.dbline -1
.dbline 88
;
; }
;
; void main()
; {
.dbline 89
; FFT(dataR,dataI);
ldi R18,<_dataI
ldi R19,>_dataI
ldi R16,<_dataR
ldi R17,>_dataR
xcall _FFT
L41:
.dbline 90
L42:
.dbline 90
xjmp L41
X6:
.dbline -2
L40:
.dbline 0 ; func end
ret
.dbend
.area bss(ram, con, rel)
.dbfile D:\HJN\Design\AVR\fft\ff.c
_w::
.blkb 32
.dbsym e w _w A[32:32]c
_i::
.blkb 1
.dbsym e i _i c
.area lit(rom, con, rel)
L37:
.word 0x0,0x4700
L30:
.word 0x0,0x4100
L29:
.word 0xfda,0x40c9
L10:
.word 0x0,0x0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -