📄 cfft256c.asm
字号:
LAR AR4,#6 ; ARP=AR4, AR4=6
MAR *0+,AR3 ; ARP=AR3, AR3->ipcb[4], AR4=&ipcb[0]+6->ipcb[6]
MAR *,AR3 ; ARP=AR3, AR3->ipcb[4]
LAR AR0,#7h ; ARP=AR3, AR3->ipcb[4], AR0=7h
; Increment for data pointer
LAR AR7,#(N/4-1) ; Loop 32 times
STAGE1_2_LP:
COMBO
BANZ STAGE1_2_LP,*-,AR3
;------------------------------------------------------------------
; Stage 3 - Using ZEROI, PBY4I,PBY2I,P3BY4I Macros
;------------------------------------------------------------------
MAR *,AR5 ; ARP=AR5, AR5->T1
SPLK #COS45K,* ; ARP=AR5, AR5->T1, T1=COS45K
LT * ; ARP=AR5, AR5->T1, TREG=COS45K
SBRK #6 ; ARP=AR5, AR5->ipcbptr
LAR AR6,* ; ARP=AR5, AR5->ipcbptr, AR6=ipcbptr->ipcb[0], ---->P
LAR AR2,* ; ARP=AR5, AR5->ipcbptr, AR2=ipcbptr
ADRK #6 ; ARP=AR5, AR5->T1
MAR *,AR2 ; ARP=AR2, AR2=ipcbptr
ADRK #8 ; ARP=AR2, AR2=ipcbptr+8->ipcb[8], ---->Q
LAR AR0,#9h ; Increment for data pointer
LAR AR7,#(N/8-1) ; Loop 16 times
STAGE3_LP: ZEROI
PBY4I
PBY2I
P3BY4I 7,0 ; AR7 at end, Use *0+ modify
BANZ STAGE3_LP,*-,AR2
;--------------------------------------------------------------------
; Stage 4 - Using ZEROI, PBY4I,PBY2I,P3BY4I,BFLY Macros
;--------------------------------------------------------------------
MAR *,AR5 ; ARP=AR5, AR5->T1
SBRK #6 ; ARP=AR5, AR5->ipcbptr
LAR AR6,* ; ARP=AR5, AR5->ipcbptr, AR6=ipcbptr->ipcb[0], ---->P
LAR AR2,* ; ARP=AR5, AR5->ipcbptr, AR2=ipcbptr
ADRK #6 ; ARP=ARP, AR5->T1
MAR *,AR2 ; ARP=AR2, AR2=ipcbptr
ADRK #16 ; ARP=AR2, AR2=ipcbptr+16->ipcb[16], ---->Q
LAR AR0,#(N/8) ; Twiddle Factor increment
LAR AR7,#(N/16-1) ; Loop 8 Times, Group loop counter
STAGE4_LP: ZEROI
LAR AR3,#(TWID+N/16+N/4)
LAR AR4,#(TWID+N/16)
BFLY 2 ; ARP=AR2
MAR *,AR5 ; ARP=AR5, AR5->T1
SPLK #COS45K,* ; ARP=AR5, AR5->T1, T1=COS45K
LT *,AR2 ; ARP=AR2, TREG=COS45K
PBY4I
BFLY 2
PBY2I
BFLY 2
MAR *,AR5 ; ARP=AR5, AR5->T1
SPLK #COS45K,* ; ARP=AR5, AR5->T1, T1=COS45K
LT *,AR2 ; ARP=AR2, TREG=COS45K
P3BY4I 2,
BFLY 6
ADRK #16 ; Data offset
MAR *,AR2
ADRK #16 ; Data offset
MAR *,AR7
BANZ STAGE4_LP,*-,AR2
;--------------------------------------------------------
; Stage 5 to LOG2(N) - Using BFLY Macro
;--------------------------------------------------------
; Initialisation
; 1. Initialise the Butterfly loop(BLC), Group loop(GLC) & Stage loop counter(SLC)
; 2. Initialise the Data offset(DOST) and twiddle factor offset (TOST)
MAR *,AR5 ; ARP=AR5, AR5->T1
ADRK #2 ; ARP=AR5, AR5->GLCB
SPLK #(N/32),* ; ARP=AR5, AR5->GLCB, GLCB=N/8
SBRK #3 ; ARP=AR5, AR5->BLC
SPLK #16,*- ; ARP=AR5, AR5->GLC, BLC=16
SPLK #(N/32),*- ; ARP=AR5, AR5->SLC, GLC=(N/32)
SPLK #(NSTG-4),*- ; ARP=AR5, AR5->TOST, SLC=NSTG-4
SPLK #(N/32),*- ; ARP=AR5, AR5->DOST, TOST=4
SPLK #32,*- ; ARP=AR5, AR5->ipcbptr, DOST=32
SLP: ; Stage loop
LAR AR6,* ; ARP=AR5, AR5->ipcbptr, AR6=ipcbptr ------>P
LAR AR2,*+ ; ARP=AR5, AR5->DOST, AR2=ipcbptr
LAR AR0,*+,AR2 ; ARP=AR2, AR2=ipcbptr, AR5->TOST, AR0=DOST
MAR *0+,AR5 ; ARP=AR5, AR5->TOST, AR2=ipcbptr+DOST -----> Q
LAR AR0,* ; ARP=AR5, AR5->TOST, AR0=TOST
ADRK #3 ; ARP=AR5, AR5->BLC
GLP: ; Group loop
LAR AR3,#(TWID+N/4) ; COS(Angle)
LAR AR4,#(TWID) ; SIN(Angle)
LAR AR7,*+,AR7 ; ARP=AR7, AR7=BLC,AR5->T1
MAR *-,AR2 ; ARP=AR2, AR7=BLC-1
BLP: ; Butterfly loop
BFLY 7
BANZ BLP,*-,AR2
; Operations performed between the group
; 1. Manuplating the P & Q pointer to point to the next group
; 2. Reinitialising the WI and WR twiddle factor pointer
; 3. Decrementing the Group Count by 1, till all the group in the stage is computed
; 4. Reinitialising the Butterfly loop index for next group
MAR *,AR5 ; ARP=AR5, AR5->T1
SBRK #5 ; ARP=AR5, AR5->DOST
LAR AR0,*+,AR6 ; ARP=AR6, AR0=DOST, AR5->TOST
MAR *0+,AR2 ; ARP=AR2
MAR *0+,AR5 ; ARP=AR5, AR5->TOST
LAR AR0,* ; ARP=AR5, AR5->TOST, AR0=TOST
ADRK #2 ; ARP=AR5, AR5->GLC
LACL * ; ARP=AR5, AR5->GLC, ACCL=GLC
SUB #1 ; ACCL=GLC-1
SACL *+ ; ARP=AR5, AR5->BLC, GLC=GLC-1
BCND GLP,NEQ
; Operation Performed, between the stage
; 1. Mutiply the data offset by 2
; 2. Divide the Group count by 2
; 3. Divide the Twiddle offset by 2
; 4. Multiply the butterfly count by 2
; 5. Decrementing the stage count by 1, till all the stage gets over
; 6. Reinitialising the P & Q data pointer to the first group of next stage
SBRK #4 ; ARP=AR5, AR5->DOST
LACL * ; ARP=AR5, AR5->DOST, ACCL=DOST
SACL *+,1 ; ARP=AR5, AR5->TOST, DOST=DOST*2
LACL * ; ARP=AR5, AR5->TOST, ACCL=TOST
SFR ; ARP=AR5, AR5->TOST, ACCL=TOST/2
SACL *+ ; ARP=AR5, AR5->SLC, TOST=TOST/2
LACL * ; ARP=AR5, AR5->SLC, ACCL=SLC
SUB #1 ; ACCL=SLC-1
SACL *+ ; ARP=AR5, AR5->GLC, SLC=SLC-1
ADRK #4 ; ARP=AR5, AR5->GLCB
LACL * ; ARP=AR5, AR->GLCB, ACCL=GLCB
SFR ; ARP=AR5, AR5->GLCB, ACCL=GLCB/2
SACL * ; ARP=AR5, AR5->GLCB, GLCB=GLCB/2
SBRK #4 ; ARP=AR5, AR5->GLC
SACL *+ ; ARP=AR5, AR5->BLC, GLC=GLCB/2
LACL * ; ARP=AR5, AR5->BLC, ACCL=BLC
SACL *,1 ; ARP=AR5, AR5->BLC, BLC=BLC*2
SBRK #2 ; ARP=AR5, AR5->SLC
LACL * ; ARP=AR5, AR5->SLC, ACCL=SCL
SBRK #3 ; ARP=AR5, AR5->ipcbptr
BCND SLP,NEQ
MAR *,AR1
SBRK #(__FFT256C_calc_frs+1) ; Clear the local frame
LAR AR0,*- ; Retrive Caller's frame pointer
LAR AR7,*-
LAR AR6,*-
PSHD * ; Push the return address to TOS
RET ; Return to the caller
;================================================================================
; TWIDDLE FACTOR INITIALISATION
;===============================================================================
; Twiddle factor Initialisation
_FFT256C_init:
POPD *+
LAR AR2,#TWID ; Copy the twiddle factor from ROM to RAM
LACC #TF_LOAD_STRT_ADR
MAR *,AR2
LAR AR3, #(TF_LOAD_END_ADR-TF_LOAD_STRT_ADR-1)
loop1: TBLR *+,AR3
ADD #1
BANZ loop1,*-,AR2
MAR *,AR1
SBRK #1
PSHD * ; Push the return address to TOS
RET
;--------------------------------------------------------------------------
; TWIDDLE FOR N=256 FFT (192 ENTRIES)
;--------------------------------------------------------------------------
.sect "FFTtf"
.label TF_LOAD_STRT_ADR
TWID: .word 0,804,1608,2411,3212,4011,4808,5602,6393,7180
.word 7962,8740,9512,10279,11039,11793,12540,13279,14010,14733
.word 15447,16151,16846,17531,18205,18868,19520,20160,20788,21403
.word 22006,22595,23170,23732,24279,24812,25330,25833,26320,26791
.word 27246,27684,28106,28511,28899,29269,29622,29957,30274,30572
.word 30853,31114,31357,31581,31786,31972,32138,32286,32413,32522
.word 32610,32679,32729,32758,32767,32758,32729,32679,32610,32522
.word 32413,32286,32138,31972,31786,31581,31357,31114,30853,30572
.word 30274,29957,29622,29269,28899,28511,28106,27684,27246,26791
.word 26320,25833,25330,24812,24279,23732,23170,22595,22006,21403
.word 20788,20160,19520,18868,18205,17531,16846,16151,15447,14733
.word 14010,13279,12540,11793,11039,10279,9512,8740,7962,7180
.word 6393,5602,4808,4011,3212,2411,1608,804,0,-804
.word -1608,-2411,-3212,-4011,-4808,-5602,-6393,-7180,-7962,-8740
.word -9512,-10279,-11039,-11793,-12540,-13279,-14010,-14733,-15447,-16151
.word -16846,-17531,-18205,-18868,-19520,-20160,-20788,-21403,-22006,-22595
.word -23170,-23732,-24279,-24812,-25330,-25833,-26320,-26791,-27246,-27684
.word -28106,-28511,-28899,-29269,-29622,-29957,-30274,-30572,-30853,-31114
.word -31357,-31581,-31786,-31972,-32138,-32286,-32413,-32522,-32610,-32679
.word -32729,-32758
.label TF_LOAD_END_ADR
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -