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

📄 fft2.s

📁 在ICCAVR 环境实现的fft,
💻 S
📖 第 1 页 / 共 2 页
字号:
	ldd R16,y+2
	ldd R17,y+3
	movw R18,R10
	xcall empy16s
	movw R18,R16
	ldi R16,4
	ldi R17,0
	xcall empy16s
	movw R2,R16
	movw R30,R2
	ldd R0,y+56
	ldd R1,y+57
	add R30,R0
	adc R31,R1
	ldd R4,z+0
	ldd R5,z+1
	ldd R6,z+2
	ldd R7,z+3
	st -y,R7
	st -y,R6
	st -y,R5
	st -y,R4
	movw R30,R2
 ; stack offset 4
	ldd R0,y+62
	ldd R1,y+63
	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
	xcall add32f
	movw R30,R28
	std z+4,R16
	std z+5,R17
	std z+6,R18
	std z+7,R19
	.dbline 62
	ldi R18,2
	ldi R19,0
	ldd R16,y+0
	ldd R17,y+1
	xcall div16s
	movw R18,R20
	add R18,R10
	adc R19,R11
	add R18,R16
	adc R19,R17
	ldi R16,4
	ldi R17,0
	xcall empy16s
	movw R30,R28
	ldd R2,z+4
	ldd R3,z+5
	ldd R4,z+6
	ldd R5,z+7
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	movw R30,R16
	add R30,R14
	adc R31,R15
	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
	movw R30,R16
	add R30,R12
	adc R31,R13
	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
	xcall add32fs
	xcall empy32f
	movw R30,R28
	std z+4,R16
	std z+5,R17
	std z+6,R18
	std z+7,R19
	.dbline 63
	movw R30,R28
	ldd R2,z+8
	ldd R3,z+9
	ldd R4,z+10
	ldd R5,z+11
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	movw R30,R28
 ; stack offset 4
	ldd R2,z+16
	ldd R3,z+17
	ldd R4,z+18
	ldd R5,z+19
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	xcall sub32f
	movw R30,R28
	std z+16,R16
	std z+17,R17
	std z+18,R18
	std z+19,R19
	.dbline 64
	movw R30,R28
	ldd R2,z+4
	ldd R3,z+5
	ldd R4,z+6
	ldd R5,z+7
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	movw R30,R28
 ; stack offset 4
	ldd R2,z+12
	ldd R3,z+13
	ldd R4,z+14
	ldd R5,z+15
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	xcall sub32fs
	movw R30,R28
 ; stack offset 4
	ldd R2,z+16
	ldd R3,z+17
	ldd R4,z+18
	ldd R5,z+19
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	xcall sub32f
	movw R30,R28
	std z+20,R16
	std z+21,R17
	std z+22,R18
	std z+23,R19
	.dbline 65
	movw R2,R20
	add R2,R10
	adc R3,R11
	ldi R18,2
	ldi R19,0
	ldd R16,y+0
	ldd R17,y+1
	xcall div16s
	movw R18,R2
	add R18,R16
	adc R19,R17
	ldi R16,4
	ldi R17,0
	xcall empy16s
	movw R30,R16
	add R30,R14
	adc R31,R15
	ldi R16,4
	ldi R17,0
	movw R18,R2
	xcall empy16s
	movw R26,R16
	add R26,R14
	adc R27,R15
	ld R2,x+
	ld R3,x+
	ld R4,x+
	ld R5,x
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	movw R26,R28
 ; stack offset 4
	adiw R26,20
	ld R2,x+
	ld R3,x+
	ld R4,x+
	ld R5,x
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	xcall sub32f
	std z+0,R16
	std z+1,R17
	std z+2,R18
	std z+3,R19
	.dbline 66
	movw R2,R20
	add R2,R10
	adc R3,R11
	ldi R18,2
	ldi R19,0
	ldd R16,y+0
	ldd R17,y+1
	xcall div16s
	movw R18,R2
	add R18,R16
	adc R19,R17
	ldi R16,4
	ldi R17,0
	xcall empy16s
	movw R30,R16
	add R30,R12
	adc R31,R13
	ldi R16,4
	ldi R17,0
	movw R18,R2
	xcall empy16s
	movw R26,R16
	add R26,R12
	adc R27,R13
	ld R2,x+
	ld R3,x+
	ld R4,x+
	ld R5,x
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	movw R26,R28
 ; stack offset 4
	adiw R26,24
	ld R2,x+
	ld R3,x+
	ld R4,x+
	ld R5,x
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	xcall sub32f
	std z+0,R16
	std z+1,R17
	std z+2,R18
	std z+3,R19
	.dbline 67
	movw R18,R20
	add R18,R10
	adc R19,R11
	ldi R16,4
	ldi R17,0
	xcall empy16s
	movw R2,R16
	add R2,R14
	adc R3,R15
	movw R30,R2
	ldd R4,z+0
	ldd R5,z+1
	ldd R6,z+2
	ldd R7,z+3
	st -y,R7
	st -y,R6
	st -y,R5
	st -y,R4
	movw R30,R28
 ; stack offset 4
	ldd R4,z+20
	ldd R5,z+21
	ldd R6,z+22
	ldd R7,z+23
	st -y,R7
	st -y,R6
	st -y,R5
	st -y,R4
	xcall add32f
	movw R30,R2
	std z+0,R16
	std z+1,R17
	std z+2,R18
	std z+3,R19
	.dbline 68
	movw R18,R20
	add R18,R10
	adc R19,R11
	ldi R16,4
	ldi R17,0
	xcall empy16s
	movw R2,R16
	add R2,R12
	adc R3,R13
	movw R30,R2
	ldd R4,z+0
	ldd R5,z+1
	ldd R6,z+2
	ldd R7,z+3
	st -y,R7
	st -y,R6
	st -y,R5
	st -y,R4
	movw R30,R28
 ; stack offset 4
	ldd R4,z+24
	ldd R5,z+25
	ldd R6,z+26
	ldd R7,z+27
	st -y,R7
	st -y,R6
	st -y,R5
	st -y,R4
	xcall add32f
	movw R30,R2
	std z+0,R16
	std z+1,R17
	std z+2,R18
	std z+3,R19
	.dbline 69
L32:
	.dbline 57
	movw R24,R10
	adiw R24,1
	movw R10,R24
L34:
	.dbline 57
	ldi R18,2
	ldi R19,0
	ldd R16,y+0
	ldd R17,y+1
	xcall div16s
	movw R24,R16
	sbiw R24,1
	cp R24,R10
	cpc R25,R11
	brlt X6
	xjmp L31
X6:
L28:
	.dbline 56
	ldd R2,y+0
	ldd R3,y+1
	add R20,R2
	adc R21,R3
L30:
	.dbline 56
	ldd R18,y+0
	ldd R19,y+1
	ldd R16,y+2
	ldd R17,y+3
	subi R16,1
	sbci R17,0
	xcall empy16s
	cp R16,R20
	cpc R17,R21
	brlt X7
	xjmp L27
X7:
	.dbline 70
L24:
	.dbline 52
	ldd R24,y+36
	ldd R25,y+37
	sbiw R24,1
	std y+37,R25
	std y+36,R24
L26:
	.dbline 52
	ldd R24,y+36
	ldd R25,y+37
	cpi R24,0
	ldi R30,0
	cpc R25,R30
	brlt X8
	xjmp L23
X8:
	.dbline 71
; {
; p = pr[m * j] * fr[it + j + nv / 2];
; q = pi[m * j] * fi[it + j + nv / 2];
; s = pr[m * j] + pi[m * j];
; s = s * (fr[it + j + nv / 2] + fi[it + j + nv / 2]);
; poddr = p - q;
; poddi = s - p - q;
; fr[it + j + nv / 2] = fr[it + j] - poddr;
; fi[it + j + nv / 2] = fi[it + j] - poddi;
; fr[it + j] = fr[it + j] + poddr;
; fi[it + j] = fi[it + j] + poddi;
; }
; }
; if(l != 0)
	movw R30,R28
	subi R30,188  ; addi 68
	sbci R31,255
	ldd R0,z+0
	ldd R1,z+1
	tst R0
	brne X1
	tst R1
	brne X9
	xjmp L35
X9:
X1:
	.dbline 72
; for(i = 0;i <= n - 1;i ++)
	clr R2
	clr R3
	std y+25,R3
	std y+24,R2
	xjmp L40
L37:
	.dbline 73
	.dbline 74
	ldd R18,y+24
	ldd R19,y+25
	ldi R16,4
	ldi R17,0
	xcall empy16s
	movw R2,R16
	add R2,R14
	adc R3,R15
	movw R30,R2
	ldd R4,z+0
	ldd R5,z+1
	ldd R6,z+2
	ldd R7,z+3
	st -y,R7
	st -y,R6
	st -y,R5
	st -y,R4
	ldi R16,<L10
	ldi R17,>L10
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
 ; stack offset 8
	movw R30,R28
	subi R30,188  ; addi 68
	sbci R31,255
	ldd R16,z+0
	ldd R17,z+1
	xcall int2fp
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	xcall empy32fs
	xcall div32f
	movw R30,R2
	std z+0,R16
	std z+1,R17
	std z+2,R18
	std z+3,R19
	.dbline 75
	ldd R18,y+24
	ldd R19,y+25
	ldi R16,4
	ldi R17,0
	xcall empy16s
	movw R2,R16
	add R2,R12
	adc R3,R13
	movw R30,R2
	ldd R4,z+0
	ldd R5,z+1
	ldd R6,z+2
	ldd R7,z+3
	st -y,R7
	st -y,R6
	st -y,R5
	st -y,R4
	ldi R16,<L10
	ldi R17,>L10
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
 ; stack offset 8
	movw R30,R28
	subi R30,188  ; addi 68
	sbci R31,255
	ldd R16,z+0
	ldd R17,z+1
	xcall int2fp
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	xcall empy32fs
	xcall div32f
	movw R30,R2
	std z+0,R16
	std z+1,R17
	std z+2,R18
	std z+3,R19
	.dbline 76
L38:
	.dbline 72
	ldd R24,y+24
	ldd R25,y+25
	adiw R24,1
	std y+25,R25
	std y+24,R24
L40:
	.dbline 72
	ldd R24,y+60
	ldd R25,y+61
	sbiw R24,1
	ldd R2,y+24
	ldd R3,y+25
	cp R24,R2
	cpc R25,R3
	brlt X10
	xjmp L37
X10:
L35:
	.dbline 77
; {
; fr[i] = fr[i] / (1.0 * n);
; fi[i] = fi[i] / (1.0 * n);
; }
; if(il != 0)
	movw R30,R28
	subi R30,186  ; addi 70
	sbci R31,255
	ldd R0,z+0
	ldd R1,z+1
	tst R0
	brne X2
	tst R1
	brne X11
	xjmp L41
X11:
X2:
	.dbline 78
; for(i = 0;i <= n - 1;i ++)
	clr R2
	clr R3
	std y+25,R3
	std y+24,R2
	xjmp L46
L43:
	.dbline 79
; {
	.dbline 80
; pr[i] = sqrt(fr[i] * fr[i] + fi[i] * fi[i]);
	ldd R18,y+24
	ldd R19,y+25
	ldi R16,4
	ldi R17,0
	xcall empy16s
	movw R2,R16
	movw R30,R2
	add R30,R14
	adc R31,R15
	ldd R4,z+0
	ldd R5,z+1
	ldd R6,z+2
	ldd R7,z+3
	movw R30,R28
	std z+38,R4
	std z+39,R5
	std z+40,R6
	std z+41,R7
	movw R30,R2
	add R30,R12
	adc R31,R13
	ldd R4,z+0
	ldd R5,z+1
	ldd R6,z+2
	ldd R7,z+3
	movw R30,R28
	std z+42,R4
	std z+43,R5
	std z+44,R6
	std z+45,R7
	movw R30,R28
	ldd R4,z+38
	ldd R5,z+39
	ldd R6,z+40
	ldd R7,z+41
	st -y,R7
	st -y,R6
	st -y,R5
	st -y,R4
	movw R30,R28
 ; stack offset 4
	ldd R4,z+42
	ldd R5,z+43
	ldd R6,z+44
	ldd R7,z+45
	st -y,R7
	st -y,R6
	st -y,R5
	st -y,R4
	xcall empy32fs
	movw R30,R28
 ; stack offset 4
	ldd R4,z+46
	ldd R5,z+47
	ldd R6,z+48
	ldd R7,z+49
	st -y,R7
	st -y,R6
	st -y,R5
	st -y,R4
	movw R30,R28
 ; stack offset 8
	ldd R4,z+50
	ldd R5,z+51
	ldd R6,z+52
	ldd R7,z+53
	st -y,R7
	st -y,R6
	st -y,R5
	st -y,R4
	xcall empy32fs
	xcall add32f
	push R2
	push R3
	xcall _sqrt
	pop R3
	pop R2
	movw R4,R16
	movw R6,R18
	movw R30,R2
	ldd R0,y+56
	ldd R1,y+57
	add R30,R0
	adc R31,R1
	std z+0,R4
	std z+1,R5
	std z+2,R6
	std z+3,R7
	.dbline 81
; if(fabs(fr[i]) < 0.000001 * fabs(fi[i]))
	ldd R18,y+24
	ldd R19,y+25
	ldi R16,4
	ldi R17,0
	xcall empy16s
	movw R30,R16
	add R30,R14
	adc R31,R15
	ldd R16,z+0
	ldd R17,z+1
	ldd R18,z+2
	ldd R19,z+3
	xcall _fabs
	movw R2,R16
	movw R4,R18
	ldd R18,y+24
	ldd R19,y+25
	ldi R16,4
	ldi R17,0
	xcall empy16s
	movw R30,R16
	add R30,R12
	adc R31,R13
	ldd R16,z+0
	ldd R17,z+1
	ldd R18,z+2
	ldd R19,z+3
	push R2
	push R3
	push R4
	push R5
	xcall _fabs
	pop R5
	pop R4
	pop R3
	pop R2
	movw R6,R16
	movw R8,R18
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	ldi R16,<L49
	ldi R17,>L49
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	st -y,R9
	st -y,R8
	st -y,R7
	st -y,R6
	xcall empy32fs
	xcall cmp32f
	brlt X12
	xjmp L47
X12:
	.dbline 82
; {
	.dbline 83
; if((fi[i] * fr[i]) > 0)
	ldd R18,y+24
	ldd R19,y+25
	ldi R16,4
	ldi R17,0
	xcall empy16s
	movw R2,R16
	ldi R16,<L11
	ldi R17,>L11
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	movw R30,R2
	add R30,R12
	adc R31,R13
	ldd R4,z+0
	ldd R5,z+1
	ldd R6,z+2
	ldd R7,z+3
	st -y,R7
	st -y,R6
	st -y,R5
	st -y,R4
	movw R30,R2
	add R30,R14
	adc R31,R15
	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
	xcall empy32fs
	xcall cmp32f
	brge L50
	.dbline 84
; pi[i] = 90.0;
	ldd R18,y+24
	ldd R19,y+25
	ldi R16,4
	ldi R17,0
	xcall empy16s
	movw R30,R16
	ldd R0,y+58
	ldd R1,y+59
	add R30,R0
	adc R31,R1
	ldi R16,<L52
	ldi R17,>L52
	xcall lpm32
	std z+0,R16
	std z+1,R17
	std z+2,R18
	std z+3,R19
	xjmp L48
L50:
	.dbline 86
; else
; pi[i] = -90.0;
	ldd R18,y+24
	ldd R19,y+25
	ldi R16,4
	ldi R17,0
	xcall empy16s
	movw R30,R16
	ldd R0,y+58
	ldd R1,y+59
	add R30,R0
	adc R31,R1
	ldi R16,<L53
	ldi R17,>L53
	xcall lpm32
	std z+0,R16
	std z+1,R17
	std z+2,R18
	std z+3,R19
	.dbline 87
; }
	xjmp L48
L47:
	.dbline 89
; else
; pi[i] = atan(fi[i] / fr[i]) * 360.0 / 6.283185306;
	ldd R18,y+24
	ldd R19,y+25
	ldi R16,4
	ldi R17,0
	xcall empy16s
	movw R2,R16
	movw R30,R2
	add R30,R12
	adc R31,R13
	ldd R4,z+0
	ldd R5,z+1
	ldd R6,z+2
	ldd R7,z+3
	st -y,R7
	st -y,R6
	st -y,R5
	st -y,R4
	movw R30,R2
	add R30,R14
	adc R31,R15
	ldd R4,z+0
	ldd R5,z+1
	ldd R6,z+2
	ldd R7,z+3
	st -y,R7
	st -y,R6
	st -y,R5
	st -y,R4
	xcall div32f
	push R2
	push R3
	xcall _atan
	pop R3
	pop R2
	movw R4,R16
	movw R6,R18
	ldi R16,<L54
	ldi R17,>L54
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	st -y,R7
	st -y,R6
	st -y,R5
	st -y,R4
	xcall empy32fs
	ldi R16,<L12
	ldi R17,>L12
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	xcall div32f
	movw R30,R2
	ldd R0,y+58
	ldd R1,y+59
	add R30,R0
	adc R31,R1
	std z+0,R16
	std z+1,R17
	std z+2,R18
	std z+3,R19
L48:
	.dbline 90
L44:
	.dbline 78
	ldd R24,y+24
	ldd R25,y+25
	adiw R24,1
	std y+25,R25
	std y+24,R24
L46:
	.dbline 78
	ldd R24,y+60
	ldd R25,y+61
	sbiw R24,1
	ldd R2,y+24
	ldd R3,y+25
	cp R24,R2
	cpc R25,R3
	brlt X13
	xjmp L43
X13:
L41:
	.dbline -2
L1:
	adiw R28,46
	xcall pop_gset5
	adiw R28,4
	.dbline 0 ; func end
	ret
	.dbsym l l0 36 I
	.dbsym l vi 32 D
	.dbsym l vr 28 D
	.dbsym l is 26 I
	.dbsym l i 24 I
	.dbsym l poddi 20 D
	.dbsym l poddr 16 D
	.dbsym l q 12 D
	.dbsym l p 8 D
	.dbsym l s 4 D
	.dbsym l m 2 I
	.dbsym l nv 0 I
	.dbsym r it 20 I
	.dbsym r j 10 I
	.dbsym l il 70 I
	.dbsym l l 68 I
	.dbsym r fi 12 pD
	.dbsym r fr 14 pD
	.dbsym l k 62 I
	.dbsym l n 60 I
	.dbsym l pi 58 pD
	.dbsym l pr 56 pD
	.dbend
	.dbfunc e main _main fI
	.even
_main::
	.dbline -1
	.dbline 94
; }
; } 
; 
; main()
; {
L56:
	.dbline 95
L57:
	.dbline 95
	xjmp L56
X14:
	.dbline -2
L55:
	.dbline 0 ; func end
	ret
	.dbend
	.area lit(rom, con, rel)
L54:
	.word 0x0,0x43b4
L53:
	.word 0x0,0xc2b4
L52:
	.word 0x0,0x42b4
L49:
	.word 0x37bd,0x3586
L12:
	.word 0xfdb,0x40c9
L11:
	.word 0x0,0x0
L10:
	.word 0x0,0x3f80

⌨️ 快捷键说明

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