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

📄 matrix.asm

📁 dsp程序:矩阵乘法
💻 ASM
字号:
/*_______________________________________________________________________
Matrix.ASM         ADSP-2106x matrix
 
__________________________________________________*/

#include "def21160.h"           /* Memory Mapped IOP register definitions */
//#define N 64                    /* Constant for number of points in input */

.SECTION/DM     dm_data;        /* Declare variables in data memory */
.VAR B[16]= "B_matrix.dat";
/*.VAR real[N];
.VAR imag[N];*/
.VAR output[16];


.SECTION/PM     pm_data;        /* Declare variables in program memory */
.VAR A[16]= "A_matrix.dat";      
                                

.SECTION/PM     pm_rsti;           /* The reset vector resides in this space */
		NOP;
		USTAT2= 0x108421;  /* 1st instr. to be executed after reset */
		DM(WAIT)=USTAT2;   /* Set external memory waitstates to 0 */
		JUMP start;
	     


.SECTION/PM     pm_code;       
start:          
        /*M1=1;
		M9=1;*/
		M0=1;
		M1=1;
		M8=1;
		B0=B;
		L0=@B;              /* Input buffer is circular */
		/*I1=imag;
		L1=0;*/
		MODE1 = 0x1000000;		/* Enable Circular buffer */
		/*CALL dft (DB);*//* Example delayed call instruction */
		CALL mul_matrix(DB);
		  //I2=real;              /* In delay field of call */
		  //L2=0;*/                
		I1=output;
		L1=0;
end:            IDLE;

/*___________________________DFT Subroutine___________________________*/
mul_matrix:            
        //B8=sine;                /* Sine pointer */
        B8=A;
		//L8=@sine;
		L8=@A;
		M10=-4; //amend I8 pointer
		M11=4;
		
		//B9=sine;                /* Derive cosine from sine by */
		//I9=sine+N/4;            /* shifting pointer over 2pi/4 */
		//L9=@sine;              /* and using a circular buffer.*/
		//I10=0;                  /* I10 is used to increment the */
		//L10=0;                  /* frequency of sine lookup.*/
		//F15=0;                  /* Zero to clear accumulators */
	    LCNTR=4,DO outer UNTIL LCE;	
		  LCNTR=4, DO middle UNTIL LCE;
		     F15=0;
		     LCNTR=4,DO inner UNTIL LCE;
		         F0=DM(I0,M0),F1=PM(I8,M8);
		         F3=F0*F1;
		     inner:F15=F15+F3;
		         DM(I1,M1)=F15;
		  middle:MODIFY(I8,M10);
	    outer:MODIFY(I8,M11);
	    RTS;
		  //F8=PASS F15, M8=I10;          /* Update frequency */
		  //F9=PASS F15, F0=DM(I0,M1), F5=PM(I9,M8);
		  //F12=F0*F5, F4=PM(I8,M8);
		  //LCNTR= N-1 , DO inner UNTIL LCE;
		    //F13=F0*F4, F9=F9+F12, F0=DM(I0,M1), F5=PM(I9,M8);
		  //inner: F12=F0*F5, F8=F8-F13, F4=PM(I8,M8);
 		  //F13=F0*F4, F9=F9+F12;
		  //F8=F8-F13, DM(I2,M1)=F9;      /* Write real result */
		  //MODIFY(I10,M9);               /* Increment frequency */
		//outer: DM(I1,M1)=F8;                 /* Write imaginary result */
		//RTS;


⌨️ 快捷键说明

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