📄 c2cxrad2.mac
字号:
APAC ; ACC = (PI+W*QI)/2 W*QR/2 - PI QI 5
ADD *,16,AR2 ; ACC = (PI+W*QI+W*QR)/2 - - PI QI 2
SACH *0+,0,AR1 ; QI' = (PI+W*QI+W*QR)/2 - - PI QR5 1
SUB *,16 ; ACCU= (-PI+W*QI+W*QR)/2 - - PI QR5 1
NEG ; ACCU= (PI-W*QI-W*QR)/2 - - PI QR5 1
SACH *0+,0,AR:p: ; PI' = (PI-W*QI-W*QR)/2 - - PR5 QR5 2
$ENDM
;
******************************************************************************
* *
* MACRO 'stage3' number of words/number of cycles: 54 *
* *
* version 1.00 from: Manfred Christ update: 02. July 90 *
* *
******************************************************************************
stage3 $macro num
svalue .set :num:
LT cos45
$LOOP svalue
ZEROI
PBY4J
PBY2I
P3BY4J 2
$ENDLOOP
$ENDM
;
; looped version of macro stage3 - not checked jet
;
stage3l $macro num
lar ar7,#:num:/divid-1
LT cos45
loop3l: .set $
$loop divid-1
ZEROI
PBY4J
PBY2I
P3BY4J 2
$endloop
ZEROI
PBY4J
PBY2I
P3BY4J 7
banz loop3l,*-,ar2
$ENDM
******************************************************************************
* *
* MACRO: 'BUTTFLYI' generell butterfly radix 2 for 320C5x *
* *
* version 1.00 from Manfred Christ update: 02. July 90 *
* *
* THE MACRO 'BUTTFLYI' REQUIRES 18 WORDS AND 18 INSTRUCTIONS *
* *
* Definition: ARP -> AR2 (input) ARP -> AR2 (output) *
* *
* Definition: AR1 -> QR (input) AR1 -> QR+1 (output) *
* Definition: AR2 -> PR (input) AR2 -> PR+1 (output) *
* Definition: AR3 -> Cxxx (input) AR3 -> Cxxx+1 (output) --> WR=cosine *
* Definition: AR4 -> Sxxx (input) AR4 -> Sxxx+1 (output) --> WI=sine *
* Definition: AR5 -> temporary variable (unchanged) *
* *
* uses index register *
* *
* PR' = (PR+(QR*WR+QI*WI))/2 WR=COS(W) WI=SIN(W) *
* PI' = (PI+(QI*WR-QR*WI))/2 *
* QR' = (PR-(QR*WR+QI*WI))/2 *
* QI' = (PI-(QI*WR-QR*WI))/2 *
* *
******************************************************************************
;
BUTTFLYI $MACRO
; (contents of register after exec.)
; TREG AR1 AR2 AR3 AR4 ARP
; ---- --- --- --- --- ---
LT *+,AR3 ;TREG:= QR QR PR QI C S 3
MPY *,AR2 ;PREG:= QR*WR/2 QR PR QI C S 2
LTP *-,AR4 ;ACC := QR*WR/2 QI PR QR C S 4
MPY *,AR3 ;PREG:= QI*WI/2 QI PR QR C S 3
MPYA *+,AR2 ;ACC := (QR*WR+QI*WI)/2 QR PR QR C+1 S 2
; PREG:= QI*WR
LT *,AR5 ;TREG = QR QR PR QR C+1 S 5
SACH *,1,AR1 ;TEMP:= (QR*WR+QI*WI) QR PR QR C+1 S 1
;
ADD *,15 ;ACC := (PR+(QR*WR+QI*WI))/2 QR PR QR C+1 S 1
SACH *+,0,AR5 ;PR := (PR+(QR*WR+QI*WI))/2 QR PI QR C+1 S 5
SUB *,16,AR2 ;ACC := (PR-(QR*WR+QI*WI))/2 QR PI QR C+1 S 2
SACH *+,0,AR1 ;QR := (PR-(QR*WR+QI*WI))/2 QR PI QI C+1 S 1
;
LAC *,15,AR4 ;ACC := PI /PREG=QI*WR QI PI QI C+1 S 4
MPYS *+,AR2 ;PREG:= QR*WI/2 QI PI QI C+1 S+1 2
; ;ACC := (PI-QI*WR)/2
APAC ;ACC := (PI-(QI*WR-QR*WI))/2 QI PI QI C+1 S+1 2
SACH *+,0,AR1 ;QI := (PI-(QI*WR-QR*WI))/2 QI PI QR+1 C+1 S+1 1
NEG ;ACC :=(-PI+(QI*WR-QR*WI))/2 QI PI QR+1 C+1 S+1 1
ADD *,16 ;ACC := (PI+(QI*WR-QR*WI))/2 QI PI QR+1 C+1 S+1 1
SACH *+,0,AR2 ;PI := (PI+(QI*WR-QR*WI))/2 QI PR+1 QR+1 C+1 S+1 2
$ENDM
;
; TREG AR1 AR2 AR3 AR4 ARP
butt_c2x $macro P ;---- --- --- --- --- ---
; LT *+,AR3 ;TREG:= QR QR PR QI C S 3
MPY *,AR2 ;PREG:= QR*WR/2 QR PR QI C S 2
LTP *-,AR4 ;ACC := QR*WR/2 QI PR QR C S 4
MPY *,AR3 ;PREG:= QI*WI/2 QI PR QR C S 3
MPYA *+,AR2 ;ACC := (QR*WR+QI*WI)/2 QR PR QR C+1 S 2
; PREG:= QI*WR
LT *,AR5 ;TREG = QR QR PR QR C+1 S 5
SACH *,1,AR1 ;TEMP:= (QR*WR+QI*WI) QR PR QR C+1 S 1
;
ADD *,15 ;ACC := (PR+(QR*WR+QI*WI))/2 QR PR QR C+1 S 1
SACH *+,0,AR5 ;PR := (PR+(QR*WR+QI*WI))/2 QR PI QR C+1 S 5
SUB *,16,AR2 ;ACC := (PR-(QR*WR+QI*WI))/2 QR PI QR C+1 S 2
SACH *0+,0,AR1 ;QR := (PR-(QR*WR+QI*WI))/2 QR PI QR+1 C+1 S 1
;
LAC *,15,AR4 ;ACC := PI /PREG=QI*WR QI PI QR+1 C+1 S 4
MPYS *+,AR2 ;PREG:= QR*WI/2 QI PI QR+1 C+1 S+1 2
; ;ACC := (PI-QI*WR)/2
LTA *- ;ACC := (PI-(QI*WR-QR*WI))/2 QR1 PI QI C+1 S+1 2
SACH *0+,0,AR1 ;QI := (PI-(QI*WR-QR*WI))/2 QR1 PI QI+1 C+1 S+1 1
NEG ;ACC :=(-PI+(QI*WR-QR*WI))/2 QR1 PI QI+1 C+1 S+1 1
ADD *,16 ;ACC := (PI+(QI*WR-QR*WI))/2 QR1 PI QI+1 C+1 S+1 1
SACH *+,0,AR:P: ;PI := (PI+(QI*WR-QR*WI))/2 QR1 PR+1 QI+1 C+1 S+1 3
$endm
;
; setup standard butterfly execution
;
do_btfly $macro num
x? .set :num:
$if divid!=8
lar ar7,#:num:/divid-2 ; execute ZEROI + num-1 times BUTTFLYI
call macros
$else
$if x?=8
call macro8
$else
lar ar7,#:num:/divid-2 ; execute ZEROI + num-1 times BUTTFLYI
call macros
$endif
$endif
$endm
do_brnch $macro num
lar ar7,#:num:/divid-2 ; execute ZEROI + num-1 times BUTTFLYI
b macros
$endm
do_loops $macro num
lar ar7,#:num:/divid-2 ; execute ZEROI + num-1 times BUTTFLYI
$endm
;
;
; execute butterfly
;
.def macros,loop
ex_btfly $macro
macros: lar ar0,#2
ZEROI ; execute macro ZEROI
LT *+,AR3 ;TREG:= QR
$if divid=4
butt_c2x 3 ; execute macro BUTFLYI without 'LT...'
butt_c2x 3 ; execute macro BUTFLYI without 'LT...'
$endif
$if divid=8
butt_c2x 3 ; execute macro BUTFLYI without 'LT...'
butt_c2x 3 ; execute macro BUTFLYI without 'LT...'
butt_c2x 3 ; execute macro BUTFLYI without 'LT...'
butt_c2x 3 ; execute macro BUTFLYI without 'LT...'
butt_c2x 3 ; execute macro BUTFLYI without 'LT...'
butt_c2x 3 ; execute macro BUTFLYI without 'LT...'
$endif
loop: .set $
$if divid=4
butt_c2x 3 ; execute macro BUTFLYI without 'LT...'
butt_c2x 3 ; execute macro BUTFLYI without 'LT...'
$endif
;
; DIVID = 8 DOES NOT WORK!!!! 10.7.90
;
$if divid=8
butt_c2x 3 ; execute macro BUTFLYI without 'LT...'
butt_c2x 3 ; execute macro BUTFLYI without 'LT...'
butt_c2x 3 ; execute macro BUTFLYI without 'LT...'
butt_c2x 3 ; execute macro BUTFLYI without 'LT...'
butt_c2x 3 ; execute macro BUTFLYI without 'LT...'
butt_c2x 3 ; execute macro BUTFLYI without 'LT...'
$endif
butt_c2x 3 ; execute macro BUTFLYI without 'LT...'
butt_c2x 7 ; execute macro BUTFLYI without 'LT...'
; and arp=ar7 at the end
banz loop,*-,ar3 ;
butt_c2x 2 ; execute macro BUTFLYI without 'LT...'
;
; OPTIMISATION OF THE FOLLOWING 4 LINES SHOULD BE POSSIBLE
; 10.7.90
;
mar *-
lar ar0,TEMP+1 ; ar0=index for actual stage
mar *0+,ar1 ; AR2 += INDX
mar *0+,ar6 ; AR1 += INDX
ret
macro8: lar ar0,#2
ZEROI ; execute macro ZEROI
LT *+,AR3 ;TREG:= QR
butt_c2x 3 ; execute macro BUTFLYI without 'LT...'
butt_c2x 3 ; execute macro BUTFLYI without 'LT...'
butt_c2x 3 ; execute macro BUTFLYI without 'LT...'
butt_c2x 3 ; execute macro BUTFLYI without 'LT...'
butt_c2x 3 ; execute macro BUTFLYI without 'LT...'
butt_c2x 3 ; execute macro BUTFLYI without 'LT...'
butt_c2x 2 ; execute macro BUTFLYI without 'LT...'
mar *-
lar ar0,TEMP+1 ; ar0=index for actual stage
mar *0+,ar1 ; AR2 += INDX
mar *0+,ar6 ; AR1 += INDX
ret
$endm
; end of file
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -