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

📄 _initalgorithm.asm

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

#include <def21262.h>

.global _initializeAlgorithmDataStructures;
.global inbuf;
.global outbuf;
.global delaybuf;
.global coefficients;

#define FRAMESIZE 2   /* stereo  */
#define SECTIONS 3    /* Number of second-order sections (biquads)         */
                      /* Each channel will be filtered by SECTIONS biquads */


/***********************************************************************/
.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[SECTIONS*4]; /* 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;

 /* Coefficients are ordered a2,a1,b2,b1 and coefficients for PEx are      */
 /*   immediately followed by those for PEy.  Repeat the sequence for each */
 /*   successive cascaded biquad pair.                                     */

.var   coefficients[SECTIONS*8] =
{
  -.92128010,-.92128010,1.8039191,1.8039191,   /* a2x_1, a2y_1, a1x_1, a1y_1, */
  -1.0000000,-1.0000000,0.00000000,0.00000000, /* b2x_1, b2y_1, b1x_1, b1y_1, */
  -.96266572,-.96266572,1.8060702, 1.8060702,  /* a2x_2, a2y_2, a1x_2, a1y_2, */
   1.0000000, 1.0000000,-1.7640328,-1.7640328, /* b2x_2, b2y_2, b1x_2, b1y_2, */
  -.97108089,-.97108089,1.8791107, 1.8791107,  /* a2x_3, a2y_3, a1x_3, a1y_3, */
   1.0000000, 1.0000000,-1.9376569,-1.9376569  /* b2x_3, b2y_3, b1x_3, b1y_3  */
};

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

        m1=2;  /* modifiers=2 for SIMD reads & writes */
		m2=1;
        m8=2;

    /* Not using circular addressing with any of the pointers, so */
    /*  we must ensure that it is disabled by setting length = 0  */

        l3=0;  /* i3 points to inbuf */
        l4=0;  /* i4 points to outbuf */

        /* i0 and i1 are pointer into delaybuf */
        /*    and track w[n-1] and w[n-2]      */

        l0=12;  /* w[n-1], w[n-2] for PEx, PEy */
        l1=0;

        l8=0;  /* i8 points to the coefficient buffer */



        /* zero the delay line */

        r0=SECTIONS;
        b0=delaybuf;
        f2=0;

        lcntr=r0, do clear until lce;     /* for each section, do:       */
            dm(i0,m2)=f2;                  /*   clear w[n-1] and w[n-2]  */
clear:      dm(i0,m2)=f2;

	rts;

_initializeAlgorithmDataStructures.end:


⌨️ 快捷键说明

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