📄 iircas4.asm
字号:
.word -6553 , -6570 , -6598 , -6640 , -6686, -6673 , -6790 , -6769 , -6748 , -6785
.word -6883 , -6846 , -6828 , -6886 , -6886 , -6894 , -6958, -7020 , -7118 , -7183
.word -7280 , -7290 , -7318 , -7351 , -7333, -7389, -7416 , -7456 , -7535 , -7584
.word -7585 , -7659 , -7713 , -7822 , -7892 , -7953 , -8010 , -8100 , -8195 , -8221
.word -8378 , -8441 , -8577 , -8730 , -8748 , -8892 , -8959 , -9067 , -9157 , -9214
.word -9274 , -9270 , -9296 , -9317 , -9396 , -9386 , -9432 , -9420 , -9443 , -9471
.word -9411 , -9400 , -9389 , -9407 , -9352 , -9358 , -9339 , -9311 , -9290 , -9272
.word -9248 , -9164 , -9152 , -9106 , -9071 , -8990 , -8914 , -8932 , -8866 , -8842
.word -8821 , -8845 , -8813 , -8811 , -8776 , -8747, -8661 , -8586 , -8583 , -8521
.word -8494 , -8502 , -8530 , -8522 , -8513 , -8514 , -8487 , -8485 , -8452 , -8495
.word -8473 , -8457 , -8434 , -8433 , -8396 , -8378 , -8392 , -8391 , -8463 , -8416
.word -8457 , -8439 , -8447 , -8480 , -8487, -8547 , -8560 , -8579, -8587 , -8645
.word -8593, -8571 , -8538 , -8502 , -8485 , -8471, -8494 , -8463 , -8514 , -8435
.word -8384 , -8298 , -8207 , -8178 , -8131 , -8035 , -7997 , -7917 , -7768 , -7634
.word -7482 , -7320 , -7137 , -6988 , -6782 , -6609, -6370 , -6160 , -5925, -5674
.word -5413 , -5127 , -4856 , -4560, -4283 , -3973, -3665 , -3335 , -3030, -2692
.word -2374 , -2009 , -1655 , -1324 , -943 , -594 , -238 , 113 , 442 , 781
.word 1113 , 1464 , 1819 , 2135, 2455 , 2743 , 3055 , 3313 , 3583 , 3825
.word 4056 , 4293 , 4448 , 4613, 4747 , 4870 , 4988 , 5064 , 5116 , 5147
.word 5161 , 5113 , 5033 , 4936, 4810 , 4651 , 4490 , 4248 , 4014 , 3789
.word 3488 , 3206 , 2873 , 2533 , 2120 , 1731 , 1320 , 875 , 449 , 42
.word -342 , -756 , -1197 , -1661 , -2161 , -2636 , -3146 , -3689 , -4233 , -4777
.word -5233 , -5521 , -5697 , -5773 , -5770 , -5650 , -5461 , -5234 , -5015 , -4708
.word -4322 , -3971 , -3532 , -3111 , -2626, -2000 , -1372 , -662 , 47 , 725
.word 1379 , 2029 , 2609 , 3141 , 3650 , 4141 , 4701, 5175 , 5668 , 6161
temp1: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
h: .word 113 ;h的系数
.word 62 ;h的系数
.word 124
.word 56
.word 62
.word 50
.word 91
.word 38
.text
_c_int00: ;行标号顶头写,冒号可有可无
MOV #h, h_ptr
MOV #x, in_ptr
mov #2400h, db_ptr
mov #r, out_ptr
sub #1, mmap(db_ptr)
mov db_ptr, index
add #1, mmap(db_ptr)
mov #500, T1
mov #2, T0
;**********************************************************************
; Program section
;**********************************************************************
.text
_iircas4
;Context save
PSH mmap(@ST1_L)
PSH mmap(@ST2_L)
PSH mmap(@ST3_L)
;
; Configure the status registers as needed.
;----------------------------------------------------------------
BCLR #CPL, ST1_55 ;DP relative addressing
PSH mmap(@DP_L)
MOV #0, DP ;set DP=0 for mmreg accesses
.dp 0
PSH T2
PSH T3
PSHBOTH XAR5
;Initialization
BSET #CDPLC, ST2_55 ;init CDP = circular (dbuffer)
BSET #AR1LC, ST2_55 ;init AR3 = circular (dbuffer)
BSET #AR4LC, ST2_55 ;init AR4 = circular (coeff)
BSET #SXMD, ST1_55 ;sign extention enable
BCLR #SATD, ST1_55 ;D-unit saturate disable
BSET #FRCT, ST1_55 ;fractional mode enable
BCLR #SATA, ST3_55 ;A-unit saturate disable
BCLR #C54CM, ST1_55
BCLR #ARMS, ST2_55
;Save pointer to index at dbuffer[0]
MOV XAR3, XAR5
;Restore index of the current dbuffer location
MOV *ar5, index
; Setup circular addressing for db_ptr (CDP) and tap_updt (AR4)
MOV T0, T3 ;compute 2*nbiq
SFTL T3, #1
ADD #1, T3
MOV @T3_L, BKC ;init CDP circular buf size (2*nbiq+1)
MOV @T3_L,BK47 ;init AR4 circular buf size (2*nbiq+1)
ADD #1, AR5
MOV @AR5_L,BSAC ;init CDP circular start addr: dbuffer
MOV @AR5_L,BSA45
MOV index, db_ptr
AMAR *db_ptr+
MOV index, tap_updt
; Setup circular addressing for h_ptr (AR1)
MOV T0,T3 ;compute 4*nbiq
SFTL T3, #1
SFTL T3, #1
MOV @T3_L,BK03 ;init AR0-3 circular buf size (4*nbiq)
MOV @AR1_L, BSA01 ;init AR0-1 circular start addr: coeff
MOV #0,AR1
; Store loop counters
SUB #1, T1,T3 ;compute nx-1
MOV T3,BRC0 ;init outer loop counter (nx-1)
MOV T0, T3 ;init inner loop counter (#bi-quads/2-1)
SFTL T3, #-1
SUB #1,T3
MOV T3,BRC1
; Define Address indexes
MOV #1,T0
MOV #2,T1
; Define scale factor
MOV #SCALE, T2 ;scale factor
||SUB AC2, AC2
; Kernel
; XAR0: x[] input
; XAR1: h[] coefficients
; XAR2: r[] result
; XAR3: dbuffer[]
; XAR7: reinit XAR1
RPTBLOCAL outer_loop ; Outer Loop: Process a new input
MOV *in_ptr+ << #16, AC0 ; HI(AC2) = x(n)
|| RPTBLOCAL inner_loop ; Inner Loop: Process a bi-quad
MOV #0, AC3
||
MAS *(h_ptr+T1), *db_ptr+, AC0 ; AC0 = x(n) - a1*d(n-1)
:: MAC *h_ptr(T0), *db_ptr+, AC2 ; AC2 = b1*d(n-1)
MAS *(h_ptr+T1), *db_ptr+, AC0 ; AC0=d(n)=x(n)-a1*d(n-1)-a2*d(n-2)
:: MAC *h_ptr(T0), *db_ptr+, AC2 ; AC2=b1*d(n-1)+b2*d(n-2)
MOV HI(AC0<<T2),*(tap_updt+T1) ; T1 = #2 , X2
|| ADD AC2,AC0 ; AC0 = d(n) + b1*d(n-1) + b2*d(n-2)
; Beginning of second Biquad
MOV #0, AC2
||
MAS *(h_ptr+T1), *db_ptr+, AC0 ; AC0 = x(n) - a1*d(n-1)
:: MAC *h_ptr(T0), *db_ptr+, AC3 ; AC3 = b1*d(n-1)
MAS *(h_ptr+T1), *db_ptr+, AC0 ; AC0=d(n)=x(n)-a1*d(n-1)-a2*d(n-2)
:: MAC *h_ptr(T0), *db_ptr+, AC3 ; AC2=b1*d(n-1)+b2*d(n-2)
inner_loop: MOV HI(AC0<<T2),*(tap_updt+T1) ; T1 = #2 , T2 = #SCALE
||ADD AC3,AC0
outer_loop:
MOV rnd(HI(AC0)), *out_ptr+ ; store result to output buf
;Signal overflow
MOV #0, T0
XCC label1, overflow(AC0)
label1:
MOV #1,T0
;Save last index value
MOV AR3, *AR5 ; save index to dbuffer[0]
;Context restore
POPBOTH XAR5
POP T3
POP T2
POP mmap(@DP_L)
POP mmap(@ST3_L)
POP mmap(@ST2_L)
POP mmap(@ST1_L)
RET
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -