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

📄 fir32_mac.s.list

📁 freescale MAC DSP的算法库(FFT
💻 LIST
字号:
                             ;*********************************************
                             ;* Freescale Semiconductor Inc.
                             ;* (c) Copyright 2001 Freescale Semiconductor Inc.
                             ;* ALL RIGHTS RESERVED.
                             ;*********************************************
                             ;* FILE NAME: fir32.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        _FIR32_MAC       
                             ;******************************************************
                             ;* NAME: void FIR32(struct tFir32Struct* pFIR, Frac32* pX, Frac32* pY, unsigned int n)
                             ;*
                             ;* DESCRIPTION: Computes a Finite Impulse Response for a array of 32-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 vector of n data elements
                             ;*	72(a7) 	pY		- Pointer to the output vector of n data elements
                             ;*	76(a7) d6	n		- Length of the input and output vectors
                             ;*	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.
                             ;******************************************************/
                             _FIR32_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: 64000040                            bcc          .NEXTi1          ; 	{                     -=If (i=>N) then jump to .NEXTi1=-
0x00000028: a13c00000000                        move.l       #0,acc           ; 	output=0;             -=Accumulator initialization=-
0x0000002e: 43f51c00                            lea          (0,a5,d1.l*4),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            ; 	for(k=0;k<i;k++)      -=Begin of inner loop=-
0x00000036: 281b                                move.l       (a3)+,d4         ; 	{                     -=Getting current coefficient=-
                             .FORk1                                           
0x00000038: 2621                                move.l       -(a1),d3         ;                           -=Getting next current sample=-
                                                                              ; We take only upper word
0x0000003a: a89b4ac3                            mac.l        d3,d4,<<,(a3)+,d4 ;                       -=Next MAC and getting next current coefficient=-
0x0000003e: 5282                                addq.l       #1,d2            ;                           -=Incrementing "k"=-
0x00000040: b481                                cmp.l        d1,d2            ;                           -=Comparing "k" with "i"=-
0x00000042: 65f4                                bcs          .FORk1           ;                           -=If (k<i) then jump to .FORk1=-
                             ;---==Testing that History Buffer is filled => this is not first calling of this function==--
0x00000044: 4aaa000c                            tst.l        12(a2)           ; 	if(pFIR->iFirHistoryCount>0)        -=Testing that pFIR->iFirHistoryCount>0=-
0x00000048: 67000014                            beq          .NEXTif          ; 	{                                   -=If (pFIR->iFirHistoryCount=0) then jump to .NEXTif=-
0x0000004c: 49f60cfc                            lea          (-4,a6,d0.l*4),a4 ; 	pCurHistory=pFIR->pFirHistory+N-2;
                                                                              ;--------------------------------------------
0x00000050: 2401                                move.l       d1,d2            ; 	for(k=i;k<N;k++)                    -= k=i.Begin of inner loop=-
                             .FORk2                                           ; 	{
0x00000052: 2a24                                move.l       -(a4),d5         ;                                         -=Getting next current element of history buffer=-
                                                                              ; We take only upper word
0x00000054: a89b4ac5                            mac.l        d5,d4,<<,(a3)+,d4 ; 	output+=*pCurHistory--*(*pCurCoef++) -=MAC and getting next current coefficient=-
0x00000058: 5282                                addq.l       #1,d2            ;                                         -=Incrementing "k"=-
0x0000005a: b480                                cmp.l        d0,d2            ;                                         -=Comparing "k" with "N"=-
0x0000005c: 65f4                                bcs          .FORk2           ;                                         -=If (k<N) then jump to .FORk2=-
                             .NEXTif                                          ;
                             ;---== End of cycle of getting Y[i] ==---
0x0000005e: a187                                move.l       acc,d7           ; 	*pCurY++=output;                    -=Moving accumulator to general register=-
0x00000060: 20c7                                move.l       d7,(a0)+         ;                                         -=Store Y[i]=-
0x00000062: 5281                                addq.l       #1,d1            ;i++                                      -=Incrementing "i"=-
0x00000064: 60bc                                bra          .FORi1           ;                                         -=Jumping to .FORi1=-
                             .NEXTi1                                          ; 		}
                             ;---====== End of cycle Y[1]..Y[N-1] ======---
                             ;---====== Begin of cycle of getting Y[N]..Y[n] ======---
0x00000066: 2200                                move.l       d0,d1            ; 	for(i=N;i<=n;i++)                   -=Begin of outer loop (number 2)=-
                             .FORi2                                           
0x00000068: b286                                cmp.l        d6,d1            ;                                         -=Comparing "i" with "N"=-
0x0000006a: 62000026                            bhi          .NEXTi2          ; 	{                                   -=If (i>n) then jump to .NEXTi2=-
0x0000006e: a13c00000000                        move.l       #0,acc           ; 	output=0;                           -=Accumulator initialization=-
0x00000074: 43f51c00                            lea          (0,a5,d1.l*4),a1 ; 	pCurX=pX+i-1;                       -=Current sample pointer initialization=-
0x00000078: 2652                                move.l       (a2),a3          ; 	pCurCoef=pFIR->pFirCoef;            -=Current coefficient pointer initialization=-
                             ;---== Begin of cycle of getting Y[i] ==---
0x0000007a: 7400                                moveq        #0,d2            ; 	for(k=0;k<N;k++)                    -=Begin of inner loop=-
0x0000007c: 281b                                move.l       (a3)+,d4         ; 	{                                   -=Getting current coefficient=-
                             .FORk3                                           
0x0000007e: 2621                                move.l       -(a1),d3         ; 	output+=*pCurX--*(*pCurCoef++);     -=Getting next current sample=-
0x00000080: a89b4ac3                            mac.l        d3,d4,<<,(a3)+,d4 ;                                    -=MAC and getting next current coefficient=-
0x00000084: 5282                                addq.l       #1,d2            ;                                         -=Incrementing "k"=-
0x00000086: b480                                cmp.l        d0,d2            ;                                         -=Comparing "k" with "N"=-
0x00000088: 65f4                                bcs          .FORk3           ; 	}                                   -=If (k<N) then jump to .FORk3=-
                             ;---== End of cycle of getting Y[i] ==---
0x0000008a: a187                                move.l       acc,d7           ; 	*pCurY++=output;                    -=Moving accumulator to general register=-
0x0000008c: 20c7                                move.l       d7,(a0)+         ;                                         -=Store Y[i]=-
0x0000008e: 5281                                addq.l       #1,d1            ;                                         -=Incrementing "i"=-
0x00000090: 60d6                                bra          .FORi2           ;                                         -=Jumping to .FORi2=-
                             .NEXTi2                                          ; }
                             ;---====== End of cycle Y[N]..Y[n] ======---
                             ;---====== Begin of History Buffer Loading ======---
0x00000092: 2e06                                move.l       d6,d7            ; 	-=pCurX=pX+n-N+1;=-
0x00000094: 9e80                                sub.l        d0,d7            
0x00000096: 43f57c04                            lea          (4,a5,d7.l*4),a1 
0x0000009a: 284e                                move.l       a6,a4            ; 	pCurHistory=pFIR->pFirHistory;
0x0000009c: 7201                                moveq        #1,d1            ; 	for(i=1;i<N;i++)                   -= i=1 =-
                             .FORbuf                                          
0x0000009e: b280                                cmp.l        d0,d1            ;                                        -=Comparing "i" with "N"=-
0x000000a0: 64000008                            bcc          .ENDbuf          ; 	{                                  -=If (i=>N) then jump to .ENDbuf=-
0x000000a4: 28d9                                move.l       (a1)+,(a4)+      ; 	*pCurHistory++=*pCurX++;
0x000000a6: 5281                                addq.l       #1,d1            ;                                        -=Incrementing "i"=-
0x000000a8: 60f4                                bra          .FORbuf          ;                                        -=Jumping to .FORbuf=-
                             .ENDbuf                                          ; 	}
0x000000aa: 5381                                subq.l       #1,d1            ; 	pFIR->iFirHistoryCount=N-1;
0x000000ac: 2541000c                            move.l       d1,12(a2)        ; 	}
                             ;---====== End of History Buffer Loading ======---
                             ;-=Restoring values of used registers=-
0x000000b0: 4cd77fff                            movem.l      (a7),d0-d7/a0-a6 
0x000000b4: 4fef003c                            lea          60(a7),a7        
0x000000b8: 4e75                                rts                           

⌨️ 快捷键说明

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