⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fir16_mac.s.list

📁 freescale MAC DSP的算法库(FFT
💻 LIST
📖 第 1 页 / 共 2 页
字号:
                             ;*********************************************
                             ;* Freescale Semiconductor Inc.
                             ;* (c) Copyright 2001 Freescale Semiconductor Inc.
                             ;* ALL RIGHTS RESERVED.
                             ;*********************************************
                             ;* FILE NAME: fir16.s
                             ;*********************************************
                             ;!! These functions are "hand coded" in assembler and
                             ;!! the C source is used as comments for short and clear description.
                             ;!! C code used only for more clear andestending what assembler code do, where it is possible.

                                                .section     .text            ;-=Locate the code in the ".text" section.=-
                                                .align       4                
                                                .xdef        _FIR16_MAC       
                             ;******************************************************
                             ;* NAME: void FIR16(struct tFir16Struct* pFIR, Frac16* pX, Frac16* pY, unsigned int n)
                             ;*
                             ;* DESCRIPTION: Computes a Finite Impulse Response for a array of 16-bit fractional data values.
                             ;******************************************************
                             ;* Used registers:
                             ;*	64(a7) a2	pFIR		  - Pointer to a data structure containing private data for the FIR filter.
                             ;*	68(a7) a5	pX	  	  - Pointer to the input array of n data elements.
                             ;*	72(a7) 	pY		  - Pointer to the output array of n data elements.
                             ;*	76(a7) d6	n		  - Length of the input and output arrays.
                             ;*	d0		N		  - Length of coefficients vector(N<=n).
                             ;*	d1		i             - Counter for outer loop.
                             ;*	d2		k             - Counter for inner loop.
                             ;*	a0		pCurY		  - Pointer to the current Y.
                             ;*	a1		pCurX		  - Pointer to the current X.
                             ;*	a3		pCurCoef	  - Pointer to the current coefficient.
                             ;*	a4		pCurHistory	  - Pointer to the current element of history buffer.
                             ;*	a6		pFIR->pFirHistory - History buffer.
                             ;*	acc		output		- Accumulator.
                             ;******************************************************
                             _FIR16_MAC                                       
                             ;---=Saving values of used registers.=---
0x00000000: 4fefffc4                            lea          -60(a7),a7       
0x00000004: 48d77fff                            movem.l      d0-d7/a0-a6,(a7) 
                             ;---=Moving of most useful parameters from stack to registers.=---
0x00000008: 2c2f004c                            move.l       76(a7),d6        ;n        - Length of the input and output arrays.
0x0000000c: 206f0048                            move.l       72(a7),a0        ;pCurY    - Pointer to the current Y.
0x00000010: 2a6f0044                            move.l       68(a7),a5        ;pX       - Pointer to the input array of n data elements.
0x00000014: 246f0040                            move.l       64(a7),a2        ;pFIR     - Pointer to a data structure containing private data for the FIR filter.
0x00000018: 202a0004                            move.l       4(a2),d0         ;N        - Length of coefficients vector.
0x0000001c: 2c6a0008                            move.l       8(a2),a6         ;pFIR->pFirHistory  - History buffer.
                             ;---====== Begin of cycle of getting Y[1]..Y[N-1] ======---
0x00000020: 7201                                moveq        #1,d1            ; 	for(i=1;i<N;i++)   -=Begin of outer loop (number 1)=-
                             .FORi1                                           
0x00000022: b280                                cmp.l        d0,d1            ;                        -=Comparing "i" with "N"
0x00000024: 64000080                            bcc          .NEXTi1          ; 	{                  -=If (i=>N) then jump to .NEXTi1=-
0x00000028: a13c00000000                        move.l       #0,acc           ; 	output=0;          -=Accumulator initialization=-
0x0000002e: 43f51a00                            lea          (0,a5,d1.l*2),a1 ; 	pCurX=pX+i;        -=Current sample pointer initialization=-
0x00000032: 2652                                move.l       (a2),a3          ; 	pCurCoef=pFIR->pFirCoef; -=Current coefficient pointer initialization=-
                             ;---== Begin of cycle Getting Y[i] ==---
0x00000034: 7400                                moveq        #0,d2            ;       k=0              -=Begin of inner loop=-
0x00000036: 08010000                            btst         #0,d1            ;                        -=Testing that "i" is even or not=-
0x0000003a: 6700000c                            beq          .EVENk1          ;     	             -=If "i" is even then jump to .EVENk1=-
                                                                              ;-=we do this omly in case of "i" is odd number=-
0x0000003e: 381b                                move.w       (a3)+,d4         ;                        -=Getting current coefficient=-
0x00000040: 3621                                move.w       -(a1),d3         ;                        -=Getting current sample=-
0x00000042: a8030200                            mac.w        d3.l,d4.l,<<     ;                        -=Getting first iteration of inner loop=-
0x00000046: 5282                                addq.l       #1,d2            ;                        -=Incrementing  "k"=-
                             .EVENk1                                          
0x00000048: 281b                                move.l       (a3)+,d4         ;                        -=Getting next current coefficient=-
                             .FORk1                                           ;       for(k=0;k<i;k++) -=Begin of main part of inner loop=-
0x0000004a: b481                                cmp.l        d1,d2            ;       {                -=Comparing "k" with "i"=-
0x0000004c: 64000010                            bcc          .ENDFORk1        ;                        -=If (k=>i) then jump to .ENDFORk1=-
                                                                              ;-=In one program loop we do two MAC operation = 2 FIR inner loop itteration;
                                                                              ;  use move long, parallel filling register,
                                                                              ;  predecriment and post increment and use left shifting to get fractional multiplication=-
                                                                              ;-=output+=*pCurX--*(*pCurCoef++)=-
0x00000050: 2621                                move.l       -(a1),d3         ; 	                   -=Getting next current sample=-
0x00000052: a8030240                            mac.w        d3.u,d4.l,<<     ;                        -=First MAC=-
0x00000056: a89b4283                            mac.w        d3.l,d4.u,<<,(a3)+,d4 ;                    -=Second MAC and getting next current coefficient=-
0x0000005a: 5482                                addq.l       #2,d2            ;                        -=Incrementing "k" by 2=-
0x0000005c: 60ec                                bra          .FORk1           ; 	}                  -=Jumping to .FORk1=-
                             .ENDFORk1                                        
0x0000005e: 598b                                subq.l       #4,a3            ;                        -=Restoring pointer to the current coefficient=
                             ;---==Testing that History Buffer is filled => this is not first calling of this function==--
0x00000060: 4aaa000c                            tst.l        12(a2)           ; 	if(pFIR->iFirHistoryCount>0)       -=Testing that pFIR->iFirHistoryCount>0=-
0x00000064: 67000034                            beq          .NEXTif          ; 	{                                  -=If (pFIR->iFirHistoryCount=0) then jump to .NEXTif=-
0x00000068: 49f60afe                            lea          (-2,a6,d0.l*2),a4 ; 	pCurHistory=pFIR->pFirHistory+N-2;
0x0000006c: 2401                                move.l       d1,d2            ; 				 -= k=i.Begin of inner loop=-
0x0000006e: 2e00                                move.l       d0,d7            
0x00000070: 9e81                                sub.l        d1,d7            
0x00000072: 08070000                            btst         #0,d7            ;                                          -=Testing that "N-i" is even or not=-
0x00000076: 6700000c                            beq          .EVENk2          ;                                          -=If "N-i" is even then jump to .EVENk2=-
                                                                              ;-=we do this omly in case of "N-i" is odd number=-
0x0000007a: 381b                                move.w       (a3)+,d4         ;                                          -=Getting current coefficient=-

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -