📄 iircas4.asm
字号:
;***********************************************************
; Version 2.20.02
;***********************************************************
; Function: iircas4
; Description: cascaded IIR direct form II using 4-coefs per biquad
;
; Copyright Texas instruments Inc, 1999
;-----------------------------------------------------------------------------
; Revision History:
; 1.00 T. Horner, 2/15/00. Original version. Started from code by Rosemarie
; Piedra, Greg Peake, and Karim Djafarian.
; 1.01 Li Yuan, 6/13/00. Fixed pop up order error.
; 2.00 C. Iovescu, 5/20/02 Modified implementation to use Dual Mac
; 2.10 Cesar I. optimized code for benchmark purpose. 08/03/01
;
;*****************************************************************************
;*****************************************************************************
;
;
; IIR Biquad Structure
;
; d(n)
; x(n) ---> + -----.----- + --> y(n)
; /| | |\
; | | [z-1] | |
; | | |
; | | v | |
; | |--x-d(n-1)-x-| |
; | -a1 | b1 |
; | | |
; | [z-1] |
; | | |
; | v |
; |---x--d(n-2)--x--|
; -a2 b2
;
; "FB" "FF"
;
;
; "FB" = Feedback Terms
; "FF" = Feedforward Terms
;
;
; Algorithm (for single biquad)
; -----------------------------
; d(n) = x(n) - a1*d(n-1) - a2*d(n-2)
; y(n) = d(n) + b1*d(n-1) + b2*d(n-2)
;
;
; Function Call
; -------------
;
; short oflag = iircas4(DATA *x, DATA *h, DATA *r, DATA *dbuffer, ushort nbiq,
; ushort nx)
;
; where:
; x[nx]: PASSED in XAR0.
; Pointer to input vector of nx real elements.
; x(0) is the first input,
; while x(nx-1) is the last input.
;
; h[4*nbiq]: PASSED in XAR1.
; Pointer to filter coefficient vector with the following format:
; H = a11 a21 b21 b11 ....a1i a2i b2i b1i
; where i is the biquad index.
; (i.e. a21: is the a2 coefficient of biquad 1).
; Pole (recursive) coefficients = a.
; Zero (non-recursive) coefficients = b
;
; This array must be located in internal memory if it is
; accessed by the C55xx coefficient bus.
;
; r[nx]: PASSED in XAR2.
; Pointer to output vector of nx real elements.
; In-place computation (r = x) is allowed. r(0) is the first
; output, while r(nx-1) is the last output.
;
; dbuffer[2*nbiq + 2]: PASSED in XAR3.
; Pointer to delay buffer of length 2*nbiq. See figure below for
; organization. In the case of multiple-buffering schemes, this
; array should be initialized to 0 for the first filter block only.
; Between consecutive blocks, the delay buffer preserves the
; previous elements needed.
;
; The first element in this array is special in that it
; contains the array index of the first buffer element in the
; delay buffer. This is needed for multiple-buffering schemes,
; and should be initialized to zero (like all the other array
; entries) for the first block only.
;
; nbiq: PASSED in T0.
; The number of biquads making up the filter.
;
; nx: PASSED in T1.
; Number of elements in the input and output vectors
;
; oflag: RETURNED in T0.
; Overflow error flag (returned value)
; = 1 if a 32-bit data overflow occurred in an intermediate
; or final result.
; = 0 if no such overflow occurred.
;
;
; Memory and Pointer Use Definition
; ---------------------------------
;
; "x[nx]" "r[nx]"
; AR0(x)--> x(0) AR2(r)-->r(0) newest
; x(1) r(1)
; x(2) r(2)
; : :
; : :
; x(nx-1) r(nx-1) oldest
;
;
; "dbuffer[2*nbiq+1]" "h[4*nbiq]"
; index AR1(h)->a11
; AR3(dn)-->d11 b11
; d21 a21
; : b21
; dn1
; dn2 a12
; b12
; a22
; b22
; :
; a1i
; b1i
; a2i
; b2i
;
; Def: dij / aij / bij where i = delay #
; j = biquad #
.arms_off
.cpl_off
.mmregs
; .align 0x100
.noremark 5579
;******************************************
;* Assigns
;******************************************
.def _iircas4
.def _c_int00
;******************************************
;* Constant Defines
;******************************************
SCALE .set 0
;******************************************
;* Variable Declarations
;******************************************
;----------------------------------------------------------------
; Assign auxiliary registers for temporaries and address
; calculations.
;----------------------------------------------------------------
.asg CDP, db_ptr ;circular pointer
.asg AR0, in_ptr ;linear pointer
.asg AR1, h_ptr ;circular pointer
.asg AR2, out_ptr ;linear pointer
.asg AR3, index ;
.asg AR4, tap_updt ;circular pointer
.bss r,500 ;输入有多少个就留多少个
.bss db, 6 ;中间变量 欲留
.data
x: .word -295 , 406 , -137 , 338 , 292 , 100 , 459 , 604 , 259 , 841
.word 745 , 641 , 1004 , 610 , 927 , 786 , 761 , 814 , 1034 , 710
.word 712 , 1129 , 668 , 791 , 905 , 865 , 613 , 1010 , 826 , 874
.word 1174 , 785 , 1297 , 960 , 953 , 1287 , 680 , 1350 , 626 , 740
.word 978 , 548 , 930 , 876 , 920 , 1007 , 686 , 1146 , 808 , 802
.word 1053, 960 , 793 , 979 , 749, 731 , 809, 595 , 946 , 656
.word 593 , 914 , 444 , 555 , 463 , 384 , 369 , 236 , 499 , 149
.word 315 , 176 , 83 , -116 , 73 , -173 , -346 , -137 , -174 , -325
.word -329, -186 , -408 , -321 , -460 , -414, -568, -579 , -570 , -535
.word -552 , -775 , -352 , -695 , -671 , -562 , -731, -692 , -768, -827
.word -933 , -942 , -962 , -984 , -949 , -1194 , -1092 , -1091 , -1513 , -1236
.word -1509 , -1427 , -1612 , -1357 , -1594 , -1858 , -1533 , -2142, -1852 , -2112
.word -2300 , -2300 , -2532 , -2420 , -2662 , -2714 , -2724 , -2706 , -3042 , -2904
.word -2945 , -3171 , -3233 , -3252 , -3428 , -3615 , -3668 , -3802 , -4028 , -4150
.word -4235 , -4592 , -4429 , -4629 , -4920 , -4842 , -5159 , -5235 , -5309 , -5508
.word -5497 , -5502 , -5702 , -5685 , -5610 , -6023, -5788, -5975 , -6109 , -6022
.word -6236 , -6124 , -6299 , -6198 , -6279 , -6338 , -6383 , -6386 , -6371 , -6473
.word -6394 , -6544 , -6585 , -6439 , -6617 , -6582, -6663 , -6556 , -6786, -6852
.word -6800 , -6988 , -6929 , -7066 , -7024 , -7109 , -7266 , -7160 , -7312, -7359
.word -7328 , -7556 , -7372 , -7499 , -7461 , -7480, -7523, -7496 , -7557 , -7503
.word -7465 , -7298 , -7344 , -7293 , -7187 , -7313 , -7288 , -7312 , -7382 , -7464
.word -7386 , -7492 , -7396 , -7276 , -7352 , -7354 , -7193 , -7283 , -7250 , -7178
.word -7164 , -7136 , -7149 , -7206 , -7117, -7168 , -7201, -7053 , -7073, -7004
.word -6989 , -6985 , -6920 , -6952 , -6904 , -6867 , -6767, -6841 , -6748 , -6613
.word -6721 , -6614 , -6638 , -6565 , -6579 , -6537 , -6503 , -6542 , -6526 , -6509
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -