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

📄 corr.asm

📁 五部分
💻 ASM
字号:
/*_______________________________________________________________________
Relate.ASM         ADSP-2106x

 Calculate the correlation of x[], y[]. The length of x[] and y[] must
  be equal.
_________________________________________________________________________*/

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

.SECTION/DM     dm_data;        /* Declare variables in data memory */
.VAR inputx[LENGTH]= "square64.dat";
.VAR inputy[LENGTH]= "noise64.dat";
.VAR output[2*LENGTH];


.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;
		I0=inputx;
		L0=0;
		I1=inputy;
		L8=0;
		L1=0;
		CALL compute;

end:            IDLE;

/*___________________________Compute Subroutine___________________________*/
compute:
		I2=output;
		R1=0;
		I10=0;
		L10=0;
		F15=0;                  /* Zero to clear accumulators */
	LCNTR=LENGTH, DO left UNTIL LCE;

		  I0=inputx;		// point to x
		  I9=inputy+LENGTH-1;
		  M8=I10;
		  MODIFY(I9,M8);
		  R1=R1+1;
		  F9=PASS F15, F0=DM(I0,M1), F5=PM(I9,M9);

		  LCNTR=R1, DO inner1 UNTIL LCE;
		    F13=F0*F5;
inner1:		F9=F9+F13, F0=DM(I0,M1), F5=PM(I9,M9);	/* F0=x , F5=y */

		  DM(I2,M1)=F9;      			/* Write  result */
left:	  MODIFY(I10,-1);


		I10=0;
		L10=0;
		R1=LENGTH;
		M8=0;
		F15=0;                  /* Zero to clear accumulators */
	LCNTR=LENGTH-1, DO right UNTIL LCE;

		  I1=inputy;
		  I9=inputx+1;
		  M8=I10;          	/* Update accessing addr */
		  MODIFY(I9,M8);
		  R1=R1-1;
		  F9=PASS F15, F0=DM(I1,M1), F5=PM(I9,M9);

		  LCNTR=R1, DO inner2 UNTIL LCE;
		    F13=F0*F5;
inner2:		F9=F9+F13, F0=DM(I1,M1),F5=PM(I9,M9);	 /*F0= y, F5= x */
		  DM(I2,M1)=F9;     			 /* Write  result */
right:	  MODIFY(I10,M9);

		RTS;


⌨️ 快捷键说明

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