资源描述:
《DSP-常用算法代码》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、一、32位加法//链接命令文件MEMORY{PAGE0:ROM:origin=0080h,length=1000hROM:origin=0060h,length=10hPAGE1:OTHER:origin=0400h,length=40h}SECTIONS{.text:{}>ROMPAGE0.data:{}>ROMPAGE0.bss:{}>OTHERPAGE1.stack:{}>OTHERPAGE1}//汇编语言源代码.title"ADD32".mmregs.defstart,_c_int00.bssxhi,2,1,1.bssyhi,2,1,1.bsszhi,2,1,1table.l
2、ong13578468H.long1020B30AH.text_c_int00bstartnopnopstart:LD#xhi,DPSTM#xhi,AR1RPT#3MVPDtable,*AR1+DLDxhi,ADADDyhi,ADSTA,zhiEND:BEND.end二、64位加法/减法//链接命令文件/*ADDSUB64.cmd*/ADDSUB64.obj-mADDSUB64.map-oADDSUB64.outMEMORY{PAGE0:ROM:origin=0080h,length=1000hROM:origin=0060h,length=10hPAGE1:OTHER:origin
3、=0400h,length=40h}SECTIONS{.text:{}>ROMPAGE0.data:{}>ROMPAGE0.bss:{}>OTHERPAGE1.stack:{}>OTHERPAGE1}//汇编语言源代码.title"ADDSUB64".mmregs.defstart,_c_int00.bssx1,2,1,1.bssx3,2,1,1.bssy1,2,1,1.bssy3,1.bssy2,1.bssz1,2,1,1.bssz3,1.bssz2,1.bssw1,2,1,1.bssw3,2,1,1table.long12345678H;x1x0.long02468ACEH;x3
4、x2.long22222222H;y1y0.word1357H,2468H;y3,y2.long44444444H;z1z0.word1020H,0B30AH;z3,z2.text_c_int00bstartnopnopstart:LD#x1,DPSTM#x1,AR1RPT#11MVPDtable,*AR1+DLDx1,A;A=X1X0DADDy1,A;A=X1X0+Y1Y0,产生进位CDLDx3,B;B=X3X2ADDCy2,B;B=X3X2+00Y2+CADDy3,16,B;B=X3X2+Y3Y2+CDSUBz1,A;A=X1X0+Y1Y0-Z1Z0,产生借位C'DSTA,w1;
5、W1W0=X1X0+Y1Y0-Z1Z0SUBBz2,B;B=X3X2+Y3Y2+C-00Z2-C'SUBz3,16,B;B=X3X2+Y3Y2+C-Z3Z2-C'DSTB,w3;W3W2=X3X2+Y3Y2+C-Z3Z2-C'END:BEND.end三、FIR滤波//链接命令文件fir.obj-mfir.map-ofir.outMEMORY{PAGE0:ROM1(RIX):ORIGIN=0080H,LENGTH=100HPAGE1:INTRAM1(RW):ORIGIN=2400H,LENGTH=0200HINTRAM2(RW):ORIGIN=2600H,LENGTH=0100HINT
6、RAM3(RW):ORIGIN=2700H,LENGTH=0100HB2B(RW):ORIGIN=0070H,LENGTH=10H}SECTIONS{.text:{}>ROM1PAGE0.data:{}>INTRAM1PAGE1FIR_COFF:{}>INTRAM2PAGE1FIR_BFR:{}>INTRAM3PAGE1.stack:{}>B2BPAGE1}//汇编语言源代码;一个FIR滤波器源程序fir.asm.mmregs.globalstart.defstart,_c_int00INDEX.set1KS.set256;模拟输入数据缓冲区大小N.set17COFF_FIR.sec
7、t"COFF_FIR";FIR滤波器系数.word0.word158.word264.word-290.word-1406.word-951.word3187.word9287.word12272.word9287.word3187.word-951.word-1406.word-290.word260.word158.word0.dataINPUT.copy"firin.inc";模拟输入在数据存储区0x2400OUTPUT.space1024;输出数据