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

📄 _initalgorithm.asm

📁 在ADSP-2126x上编写的优化过的FIR滤波器程序(用c和汇编编写)。
💻 ASM
字号:
/**************************************************************************
 *                                                                        *
 *  Initialize the variables and data structures used in the algorithm    *
 *                                                                        *
 **************************************************************************/

#include <def21262.h>

.global _initAlgorithmDataStructures;
.global inbuf;
.global outbuf;
.global delaybuf;
.global coefficients;

#define FRAMESIZE 2   /* stereo  */
#define TAPS 8        /* Number of FIR coefficients */


/***********************************************************************/
.section /dm seg_dmda;

.var  inbuf[FRAMESIZE];  /* All of the channels in each frame are processed */
                         /*   when the last channel arrives and the         */

.var  outbuf[FRAMESIZE]; /*   double-buffering feeds the SPORT as needed    */
                         /*  tag data to check if ever assigned a value     */

.var  delaybuf[TAPS*2]; /* Holds intermediate variables (state) for the */
                            /*   IIR.  Each of the two compute units needs  */
                            /*   storage for w[x-1] and w[x-2] for each     */
                            /*   biquad section.                            */

/***********************************************************************/
.section /pm seg_pmda;

 /* This file contains TAPS floating point FIR filter coefficients in */
 /*   ASCII, one per line with alternating left and right channels.   */

.var   coefficients[TAPS*2] = "FIR_coeffs.dat";

/***********************************************************************/
.section /pm seg_pmco;
_initAlgorithmDataStructures:

    /* Set up a circular buffer delay line */
    l0 = TAPS*2;
    b0 = delaybuf;
    m0 = 2;

    /* Set up input */
    l1 = 1;
    b1 = inbuf;
    m1 = 0;

    /* Set up output */
    l2 = 1;
    b2 = outbuf;

    /* Set up the coefficient buffer in program memory */
    l8 = TAPS*2;
    b8 = coefficients;
    m8 = 2;

    /* Initialize the delay line */
    r0 = TAPS*2;
    lcntr=r0, do clear until lce;
       clear:  dm(i0,m0)=0;

    rts;

_initAlgorithmDataStructures.end:


⌨️ 快捷键说明

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