📄 fir10.lst
字号:
dspa -l -s -iD:/FCHEV_pid/inlcude -v2xx -id:/ti/c2400/cgtools/include -g fir10.asm fir10.obj
TMS320C24xx COFF Assembler Version 7.01 Wed Apr 28 18:29:18 2004
Copyright (c) 1987-2002 Texas Instruments Incorporated
fir10.asm PAGE 1
1 ;========================================================================
2 ;
3 ; File Name :fir10.asm
4 ;
5 ; Originator :Digital Control Systems Group
6 ; Texas Instruments
7 ;
8 ; Description :This file contain source code for 10th order (Fixed Order) Filter
9 ;
10 ; Date : 13/1/2001
11 ;======================================================================
12 ;
13 ;
14 ; Routine Name : Generic Function
15 ; Routine Type : C Callable
16 ;
17 ; Description :
18 ; void FIRFILT_ORD10_calc(FIRFILT_ORD10_handle)
19 ; void FIRFILT_ORD10_calc(FIRFILT_ORD10S_handle)
20 ;
21 ; This routine implements the non-recursive difference equation of an
22 ; all-zero filter(FIR), of order 10. All the coefficients of all-zero
23 ; filter are assumed to be less than 1 in magnitude.
24
25 ;======================================================================
26 ;
27 ; Difference Equation :
28 ;
29 ; y(n)=H(0)*x(n)+H(1)*x(n-1)+H(2)*x(n-2)+....+H(10)*x(n-10)
30 ;
31 ; where
32 ; y(n)=output sample of the filter at index n
33 ; x(n)=input sample of the filter at index n
34 ;
35 ; Transfer Function :
36 ;
37 ; Y(z) -1 -2 -9 -10
38 ; ----- = h(0) + h(1) z + h(2) z + ... +h(9) z + h(10) z
39 ; X(z)
40 ;
41 ; Network Diagram :
42
43 ; dbuffer[0] dbuffer[1] dbuffer[2] dbuffer[10}
44 ; Input -1 x(n-1) -1 x(n-2) x(n-10)
45 ; x(n) >------o----z---->-o----z---->-o--- - ->- - o
46 ; | | | |
47 ; | | | |
48 ; | | | |
49 ; v H(0) v H(1) v H(2) v H(10)
50 ; | | | |
51 ; | | | | output
52 ; |---->-----(+)---->----(+)-- - -> - (+)-----> y(n)
53 ;
54 ; Symbols Used :
TMS320C24xx COFF Assembler Version 7.01 Wed Apr 28 18:29:18 2004
Copyright (c) 1987-2002 Texas Instruments Incorporated
fir10.asm PAGE 2
55 ; H(0),H(1),H(2),...,H(10) : filter coefficients
56 ; x(n-1),x(n-2),...,x(n-10) : filter states
57 ; x(n) : filter input
58 ; y(n) : filter output
59 ;==============================================================================
60 ; Function Input: This function accepts the handle of the below structure
61 ;
62 ; typedef struct
63 ; {int *coeff_ptr; /* Pointer to Filter co-efficient array */
64 ; int *dbuffer_ptr; /* Delay buffer pointer */
65 ; int order; /* Order of the filter */
66 ; int input; /* Input data */
67 ; int output; /* Output data */
68 ; int dbuffer[11]; /* Delay buffer */
69 ; int coeff[11]; /* Coefficient Buffer */
70 ; void (*init)(void *) /* Pointer to init fun */
71 ; void (*calc)(void *); /* Pointer to the calculation function */
72 ; }FIRFILT_ORD10;
73 ;
74 ; Filter input (x) :
75 ; x(n) = | s.fff ffff | ffff ffff |
76 ;
77 ; Filter coefficients(h[]):
78 ; h(k) for k=0,1,2,...,10
79 ; = | s.fff ffff | ffff ffff | are stored as shown below.
80 ; LOWER MEMORY ADDRESS
81 ; |
82 ; |----------| |
83 ; | H(0) | |
84 ; |----------| |----------| |
85 ; | H(1) | | x(n-1) | dbuffer[0] |
86 ; |----------| |----------| |
87 ; | H(2) | | x(n-2) | dbuffer[1] |
88 ; |----------| |----------| |
89 ; | . | | . | |
90 ; | . | | . | |
91 ; |----------| |----------| V
92 ; | H(8) | | x(n-8) | |
93 ; |----------| |----------| |
94 ; | H(9) | | x(n-9) | dbuffer[8] V
95 ; |----------| |----------|
96 ; AR3----->| H(10) | | x(n-10) | dbuffer[9] <--- AR4
97 ; |----------| |----------|
98 ; filter coefficients filter states
99 ; HIGHER MEMORY ADDRESS
100 ; Implicit inputs(dbuffer[]):
101 ; To compute the present output y(n), inputs x(n-i) for i=1,2,...10
102 ; are needed. These are stored in the filter states buffer, as shown
103 ; above.
104 ;
105 ; Filter order(n):
106 ; This member of the structure holds the order of the filter
107 ;
108 ; Filter output(y):
TMS320C24xx COFF Assembler Version 7.01 Wed Apr 28 18:29:18 2004
Copyright (c) 1987-2002 Texas Instruments Incorporated
fir10.asm PAGE 3
109 ; y(n)= | s.fff ffff | ffff ffff | Q15 Format
110 ;====================================================================
111 ; Function Local Frame
112 ;====================================================================
113 ; |_______|
114 ; |_______|<- Stack Pointer (FP+1) <---AR1
115 ; |_______|<- Register to Register Tfr & Computation (FP)
116 ; |_______|<- Old FP (FP-1)
117 ; |_______|<- Return Address of the Caller (FP-2)
118 ; |_______|<- Formal parameter FIRFILT_GEN_handle (FP-3)
119 ;======================================================================
120
121 ; Symbolic Constant
122
123 000a ORDER .set 10
124
125 ; Module definition for external referance
126 .def _FIRFILT_ORD10_calc
127
128
129 0001 __fir_calc_frs .set 00001h ; Local frame size for this routine
130
131
132 0000 _FIRFILT_ORD10_calc:
133 0000 8aa0 POPD *+ ; Store the Return Address in stack
134 0001 80a0 SAR AR0,*+ ; Store the Caller's Frame Pointer
135 0002 8180 SAR AR1,*
136 0003 02aa LAR AR2,*+,AR2 ; ARP=AR2, AR2=FP, AR1=FP+1
137
138 0004 be47 SETC SXM
139 0005 be43 SETC OVM
140 0006 7c03 SBRK #3 ; ARP=AR2, AR2=FP-3 points to the input argument
141 0007 0280 LAR AR2,* ; ARP=AR2, AR2=FIRFILT_GEN_handle->coeff_ptr
142
143 0008 03a0 LAR AR3,*+ ; ARP=AR2, AR2->dbuffer_ptr, AR3=coeff_ptr->coeff[N]
144 0009 04a0 LAR AR4,*+ ; ARP=AR2, AR2->order, AR4=dbuffer_ptr->dbuffer[N-1]
145 000a 8bac MAR *+,AR4 ; ARP=AR4, AR4=dbuffer_ptr->dbuffer[N-1], AR2->input
146
147 000b b900 LACL #0 ; Clear ACC
148 000c 739b LT *-,AR3 ; ARP=AR3, TREG=dbuffer[N-1], AR4->dbuffer[N-2]
149
150 .loop (ORDER-1)
151 MPY *-,AR4 ; Filter Tap execution from oldest sample
152 LTD *-,AR3 ;
153 .endloop
1 000d 549c MPY *-,AR4 ; Filter Tap execution from oldest sample
1 000e 729b LTD *-,AR3 ;
1 000f 549c MPY *-,AR4 ; Filter Tap execution from oldest sample
1 0010 729b LTD *-,AR3 ;
1 0011 549c MPY *-,AR4 ; Filter Tap execution from oldest sample
1 0012 729b LTD *-,AR3 ;
1 0013 549c MPY *-,AR4 ; Filter Tap execution from oldest sample
1 0014 729b LTD *-,AR3 ;
1 0015 549c MPY *-,AR4 ; Filter Tap execution from oldest sample
TMS320C24xx COFF Assembler Version 7.01 Wed Apr 28 18:29:18 2004
Copyright (c) 1987-2002 Texas Instruments Incorporated
fir10.asm PAGE 4
1 0016 729b LTD *-,AR3 ;
1 0017 549c MPY *-,AR4 ; Filter Tap execution from oldest sample
1 0018 729b LTD *-,AR3 ;
1 0019 549c MPY *-,AR4 ; Filter Tap execution from oldest sample
1 001a 729b LTD *-,AR3 ;
1 001b 549c MPY *-,AR4 ; Filter Tap execution from oldest sample
1 001c 729b LTD *-,AR3 ;
1 001d 549c MPY *-,AR4 ; Filter Tap execution from oldest sample
1 001e 729b LTD *-,AR3 ;
154
155 001f 549a MPY *-,AR2 ; ARP=AR2, AR2->input
156 0020 70ab LTA *+,AR3 ; ARP=AR3, AR2->output
157 0021 548a MPY *,AR2 ;
158 0022 be04 APAC ;
159
160 0023 9880 SACH * ; 32 bit of ACC is added with itself to get Q31 result
161 0024 6180 ADDH *
162 0025 9080 SACL *
163 0026 6280 ADDS * ; ARP=AR2, AR2->output
164 0027 bf9f ADD #1,15 ; Round the result
0028 0001
165 0029 9890 SACH *- ; ARP=AR2, AR2->input, Store ACCH in Q15 format
166 002a 698c LACL *,AR4
167 002b 8ba0 MAR *+
168 002c 9089 SACL *,0,AR1 ; Store the latest sample in the delay buffer
169
170 002d be42 CLRC OVM
171 002e 7c02 SBRK #(__fir_calc_frs+1) ; Clear the local frame
172 002f 0090 LAR AR0,*- ; Retrive Caller's frame pointer
173 0030 7680 PSHD * ; Push the return address to TOS
174 0031 ef00 RET ; Return to the caller
175
176
177
No Errors, No Warnings
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -