?? fir16.lst
字號:
TMS320C2000 COFF Assembler PC Version 3.06 Tue Apr 06 19:12:15 2004
Tools Copyright (c) 1996-2002 Texas Instruments Incorporated
fir16.asm PAGE 1
1 ;========================================================================
2 ;
3 ; File Name : fir16.asm
4 ;
5 ; Originator : Advanced Embeeded Control (AEC)
6 ; Texas Instruments Inc.
7 ;
8 ; Description : This file contain source code for 16-bit FIR Filter
9 ;
10 ; Date : 12/05/2002 (DD/MM/YYYY)
11 ;======================================================================
12 ;
13 ; Routine Name : Generic Function
14 ; Routine Type : C Callable
15 ;
16 ; Description :
17 ; void FIR16_calc(FIR16_handle)
18 ;
19 ; This routine implements the non-recursive difference equation of an
20 ; all-zero filter(FIR), of order N. All the coefficients of all-zero
21 ; filter are assumed to be less than 1 in magnitude.
22 ;======================================================================
23 ;
24 ; Difference Equation :
25 ;
26 ; y(n)=H(0)*x(n)+H(1)*x(n-1)+H(2)*x(n-2)+....+H(N)*x(n-N)
27 ;
28 ; where
29 ; y(n)=output sample of the filter at index n
30 ; x(n)=input sample of the filter at index n
31 ;
32 ; Transfer Function :
33 ;
34 ; Y(z) -1 -2 -N+1 -N
35 ; ----- = h(0) + h(1) z + h(2) z + ... +h(N-1) z + h(N) z
36 ; X(z)
37 ;
38 ; Network Diagram :
39
40 ; dbuffer[0] dbuffer[1] dbuffer[2] dbuffer[N}
41 ; Input -1 x(n-1) -1 x(n-2) x(n-N)
42 ; x(n) >------o----z---->-o----z---->-o--- - ->- - o
43 ; | | | |
44 ; | | | |
45 ; | | | |
46 ; v H(0) v H(1) v H(2) v H(N)
47 ; | | | |
48 ; | | | | output
49 ; |---->-----(+)---->----(+)-- - -> - (+)-----> y(n)
50 ;
51 ; Symbols Used :
52 ; H(0),H(1),H(2),...,H(N) : filter coefficients
53 ; x(n-1),x(n-2),...,x(n-N) : filter states
54 ; x(n) : filter input
55 ; y(n) : filter output
TMS320C2000 COFF Assembler PC Version 3.06 Tue Apr 06 19:12:15 2004
Tools Copyright (c) 1996-2002 Texas Instruments Incorporated
fir16.asm PAGE 2
56 ;==============================================================================
57 ; Function Input: This function accepts the handle of the below structure
58 ;
59 ; typedef struct {
60 ; int *coeff_ptr; /* Pointer to Filter co-efficient array */
61 ; int *dbuffer_ptr; /* Delay buffer pointer */
62 ; int cbindex; /* Circular Buffer Index */
63 ; int order; /* Order of the filter */
64 ; int input; /* Input data */
65 ; int output; /* Output data */
66 ; void (*init)(void *) /* Pointer to init fun */
67 ; void (*calc)(void *); /* Pointer to the calculation function */
68 ; }FIR16_handle;
69 ;
70 ; Module definition for external referance
71 .def _FIR16_init
72 .def _FIR16_calc
73
74 00000000 _FIR16_init:
75 00000000 2BF4 MOV *+XAR4[6],#0 ; XAR4->ouput, input=0
76 00000001 2BFC MOV *+XAR4[7],#0 ; output=0
77
78 00000002 C4D4 MOVL XAR6,*+XAR4[2] ; XAR6=dbuffer_ptr
79 00000003 92EC MOV AL,*+XAR4[5] ; AL=order
80 00000004 93A9 MOV AH,AL ; AH=order
81 00000005 40A9 TBIT AL,#0
82 00000006 9C01 ADDB AL,#1 ; AL=order+1
83 00000007 562B MOV AL,AH,TC ; AL=order, if odd
00000008 0DA9
84
85 00000009 93A9 MOV AH,AL
86 0000000a 9DFF SUBB AH,#1
87 0000000b 97E4 MOV *+XAR4[4],AH ; cbindex=order, even
88 ; =order-1, odd
89
90 0000000c F7A9 RPT AL
91 0000000d 2B86 || MOV *XAR6++,#0
92
93 0000000e 0006 LRETR
94
95
96
97
98 0000000f ConstTable:
99 00000010 FFFF PosSatVal: .long 0x00FFFFFF ; Corresponds to >> 6
00000011 00FF
100 00000012 0000 NegSatVal: .long 0xFF000000 ; Corresponds to >> 6
00000013 FF00
101
102
103 00000014 _FIR16_calc:
104 00000014 B2BD PUSH XAR1 ; Context Save
105
106 00000015 3B03 SETC SXM,OVM ; AR4=FIR16_handle->coeff_ptr
107 00000016 FF6F SPM -6 ; Create guard band of >> 6
TMS320C2000 COFF Assembler PC Version 3.06 Tue Apr 06 19:12:15 2004
Tools Copyright (c) 1996-2002 Texas Instruments Incorporated
fir16.asm PAGE 3
108
109 00000017 C5C4 MOVL XAR7,*XAR4 ; XAR4->coeff_ptr, XAR7=coeff_ptr
110 00000018 59E4 MOVZ AR1,*+XAR4[4] ; XAR4->coeff_ptr, AR1=cbindex
111 00000019 C4D4 MOVL XAR6,*+XAR4[2] ; XAR4->coeff_ptr, XAR6=dbuffer_ptr
112 0000001a 06C6 MOVL ACC,*XAR6 ; ACC = -:X
113 0000001b 93A9 MOV AH,@AL ; ACC = X:X
114 0000001c 92F4 MOV AL,*+XAR4[6] ; ACC = X:Input
115
116 0000001d 1EBF MOVL *XAR6%++,ACC ; Store in data array and inc circ address
117 0000001e C2D4 MOVL *+XAR4[2],XAR6 ; XAR4->coeff_ptr, update the dbuffer pointer
118
119 0000001f 5603 MOV ACC,*+XAR4[5]<<15 ; AR0=cbindex
00000020 0FEC
120 00000021 58A8 MOVZ AR0,AH ; AR0=order/2
121
122 00000022 5633 ZAPA ; Zero the ACC, P registers and OVC counter
123
124 00000023 F7A0 RPT AR0
125 00000024 564B || DMAC ACC:P,*XAR6%++,*XAR7++
00000025 87BF
126
127 00000026 07AB ADDL ACC,P ; Add the two sums with shift
128
129 00000027 761F' MOVW DP,#PosSatVal
00000028 0000
130 00000029 5650' MINL ACC,@PosSatVal ; Saturate result
0000002a 0010
131
132 0000002b 761F' MOVW DP,#NegSatVal
0000002c 0000
133 0000002d 5661' MAXL ACC,@NegSatVal
0000002e 0012
134
135 0000002f 562F MOVH *+XAR4[7],ACC<<7; Store saturated result (Q15)
00000030 06FC
136
137 00000031 FF69 SPM 0
138
139 00000032 8BBE POP XAR1
140 00000033 2902 CLRC OVM
141 00000034 0006 LRETR
142
143
144
No Assembly Errors, No Assembly Warnings
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -