ImageVerifierCode 换一换
格式:PPT , 页数:29 ,大小:233KB ,
资源ID:7269028      下载积分:10 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.docduoduo.com/d-7269028.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录   微博登录 

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(DSP 2835 教程 附录3 DSP汇编语言.ppt)为本站会员(scg750829)主动上传,道客多多仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知道客多多(发送邮件至docduoduo@163.com或直接QQ联系客服),我们立即给予删除!

DSP 2835 教程 附录3 DSP汇编语言.ppt

1、Assembly Programming,Copyright 2009 Texas Instruments. All rights reserved.,Appendix C TMS320C28x MCU Workshop,Learning Objectives,Perform simple program control using branch and conditional codes Write C28x code to perform basic arithmetic Use the multiplier to implement sum-of-products equations U

2、se the RPT instruction (repeat) to optimize loops Use MAC for long sum-of-products Efficiently transfer the contents of one area of memory to another Examine read-modify-write operations,Program Control ALU / Multiply Operations Data Move Logical Operations Special Instructions,Branch Types and Rang

3、e,PC,Program Memory,0x000000,0x3FFFFF,3 Branch Types,Program Control - Branches,Function,Short Branch SB 8bit,cond 7/4 1 Fast Short Branch SBF 8bit,EQ|NEQ|TC|NTC 4/4 1 Fast Relative Branch B 16bit,cond 7/4 2 Fast Branch BF 16bit,cond 4/4 2 Absolute Branch LB 22bit 4 2 Dynamic Branch LB *XAR7 4 1 Bra

4、nch on AR BANZ 16bit,ARn- 4/2 2 Branch on compare BAR 16bit,ARn,ARn,EQ|NEQ 4/2 2,The assembler will optimize B to SB if possible,NEQ EQ GT GEQ,LT LEQ HI HIS (C),LO (NC) LOS NOV OV,NTC TC UNC NBIO,Condition Code,Instruction,Cycles T/F,Size,Condition flags are set on the prior use of the ALU,Program C

5、ontrol - Call/Return,BANZ Loop Control Example,Auxiliary register used as loop counterBranch if Auxiliary Register not zeroTest performed on lower 16-bits of XARx only,Program Control ALU / Multiply Operations Data Move Logical Operations Special Instructions,ALU and Accumulator,16/32 data mem, 16/3

6、2 bit registers,Product (32),MUX,Accumulator - Basic Math Instructions,MOV Ax, loc16 ADD Ax, loc16 SUB Ax, loc16,AND Ax, loc16 OR Ax, loc16 XOR Ax, loc16,AND Ax,loc16,#16b NOT Ax NEG Ax MOV loc16,Ax,Ax = AH or AL Operations,xxx = instruction: MOV, ADD, SUB, . Ax = AH, or AL Assembler will automatica

7、lly convert to 1 word instruction.,Two word instructions with shift option One word instruction, no shift,ADD ACC, #01234h4 ADDB AL, #34h,ACC Operations,MOV ACC,loc16shift ADD SUB,from memory (left shift optional),MOV loc16,ACC shift ;AL MOVH loc16,ACC shift ;AH,Format,Ex,Variation,Shift the Accumul

8、ator,Shift full ACC,LSL ACC shift,LSL ACC T,ACC,31 0,SFR,ACC,31 0,LSL,0,C,C,SXM,Shift AL or AH,LSL AX T,LSL AX shift,Ax,15 0,ASR,Ax,15 0,LSL,0,C,C,SXM,Ax,15 0,LSR,C,0,(1-16),(0-15),32 Bit Shift Operations ACC,ACC,31 0,0,C,Examples: LSLL ACC, T LSRL ACC, T ASRL ACC, T,ACC,31 0,C,0 or 1,ACC,31 0,C,0,N

9、ote: T(4:0) are used; other bits are ignored,based on SXM,Logical Shift Left Long: LSLL,Logical Shift Right Long: LSRL,Arithmetic Shift Right Long: ASRL,Multiply Unit,Multiplier Instructions,Instruction Execution Purpose,MOV T,loc16 T = loc16 Get first operand,MPY ACC,T,loc16 ACC = T*loc16 For singl

10、e or first product MPY P,T,loc16 P = T*loc16 For nth product,MPYB ACC,T,#8bu ACC = T*8bu Using 8-bit unsigned const MPYB P,T,#8bu P = T*8bu Using 8-bit unsigned const,MOV ACC,P ACC = P Move 1st productPM to ACC ADD ACC,P ACC += P Add nth productPM to ACC SUB ACC,P ACC -= P Sub nth productPM fr. ACC,

11、Sum-of-Products,ZAPA ;ACC = P = OVC = 0 MOV T,X1 ;T = X1 MPY P,T,A ;P = A*X1 MOVA T,X2 ;T = X2 ;ACC = A*X1 MPY P,T,B ;P = B*X2 MOVA T,X3 ;T = X3 ;ACC = A*X1 + B*X2 MPY P,T,C ;P = C*X3 MOVA T,X4 ;T = X4;ACC = A*X1 + B*X2 + C*X3 MPY P,T,D ;P = D*X4 ADDL ACC,PPM ;ACC = Y MOVL y,ACC,Y = A*X1 + B*X2 + C*

12、X3 + D*X4,32x32 Long Multiplication,IMPYAL P,XT,loc32 P = u(XT)*u(loc32) QMPYAL ACC,XT,loc32 ACC = (XT)*(loc32),X,Y,X,XO * Y0,Z1 Z0,IMACL P,loc32,*XAR7 ACC += P; P = u(loc32)*u(loc32) QMACL P,loc32,*XAR7 ACC += P; P = (loc32)*(loc32),Integer long multiplication u(long) = u(long) * u(long),Fraction l

13、ong multiplication: (long) = (long) * (long),(long) 64 = (long) 32 * (long) 32,Y1 * X1,Z3 Z2,Accumulator P-register,Repeat Next: RPT,Features: Next instruction iterated N+1 times Saves code space - 1 word Low overhead - 1 cycle Easy to use Non-interruptible Requires use of | | before next line May b

14、e nested within BANZ loops,Options: RPT #8bit up to 256 iterations RPT loc16 location “loc16” holds count value,Refer to User Guide for more repeatable instructions,Sum-of-Products: RPT / MAC,XAR1+,X0,X1,.,X19,MOV T,loc16 ADD ACC,P,MPY P,T,loc16,MOVA T,loc16,MAC,XAR7+,A0,A1,.,A19,Second operand must

15、 use XAR7,Program Control ALU / Multiply Operations Data Move Logical Operations Special Instructions,Data Move Instructions,DATA DATA (4G 64K),DATA PGM (4G 4M),32-bit address memory location,16-bit address concatenated with 16 leading zeros,Conditional Moves,If AB, Then B=A,MOVW DP, #A MOV AL, A CM

16、P AL, B,A .usect “var”,2,1 B .set A+1.sect “code”,MOV B, AL, LT,Before,After,Instruction Execution (if COND is met) MOVL loc32,ACC,COND loc32 = AX,Byte Operations,Byte = 1. Low byte for register addressing2. Low byte for direct addressing3. Selected byte for offset indirect addressing,Byte Addressin

17、g,MOVL XAR2, #MemA,MOVB *+XAR21, AL.LSB,MOVB *+XAR22, AL.MSB,MOVB *+XAR25, AH.LSB,MOVB *+XAR26, AH.MSB,AH.MSB AH.LSB AL.MSB AL.LSB,16 bit memory,12 34 56 78,MOVL XAR2, #MemA,MOVB AL.LSB,*+XAR21,MOVB AL.MSB,*+XAR22,MOVB AH.LSB,*+XAR24,MOVB AH.MSB,*+XAR27,Example of Byte Packing,Example of Byte Un-Pac

18、king,Test and Change Memory,Instruction Execution Affects TBIT loc16,#(0-15) ST0(TC) = loc16(bit_no) TC TSET loc16,#(0-15) Test (loc16(bit) then set bit TC TCLR loc16,#(0-15) Test (loc16(bit) then clr bit TC CMPB AX, #8bit Test (AX - 8bit unsigned) C,N,Z CMP AX, loc16 Test (AX loc16) C,N,Z CMP loc16

19、,#16b Test (loc16 - #16bit signed) C,N,Z CMPL ACC, P Test (ACC - P PM) C,N,Z,MIN/MAX Operations,MOVL ACC,#0MOVL XAR1,#tableRPT #(table_length 1) | MAXL ACC,*XAR1+,Find the maximum 32-bit number in a table:,Read-Modify-Write Instructions,AND loc16,#16b OR loc16,#16b XOR loc16,#16b,ADD loc16,#16b SUBR

20、 loc16,#16b,AND loc16,AX OR loc16,AX XOR loc16,AX,ADD loc16,AX SUB loc16,AX SUBR loc16,AX,INC loc16 DEC loc16,TSET loc16,#bit TCLR loc16,#bit,AH, AL,16- bit constant,Work directly on memory bypass ACCAtomic Operations protected from interrupts,Read-Modify-Write Examples,MOV AL, VarB ADD VarA, AL,Var

21、A += VarB,VarA += 100,VarA += 1,ADD VarA,#100,INC VarA,SETC INTM MOV AL, VarB ADD AL, VarA MOV VarA, AL CLRC INTM,SETC INTM MOV AL, VarA ADD AL, #100 MOV VarA, AL CLRC INTM,SETC INTM MOV AL, VarA ADD AL, #1 MOV VarA, AL CLRC INTM,update with a mem,update with a constant,update by 1,Benefits of Read-

22、Modify-Write Instructions,Lab C: Procedure Assembly Programming,1. Edit .ASM to perform the sum of products Replace initialization routine using load/store operation with a BANZ process Add a MAC-based sum of products implementation In a real system application, the coeff array may well be constant

23、(values do not change), therefore one can modify the initialization routine to skip the transfer of this arrays, thus reducing the amount of data RAM and cycles required for initialization; also, there is no need to copy the zero to clear the result location 2. Build and debug your code using Code Composer StudioOptional LabC-C: Sum-of-Products in C,ti,

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报