第三讲 ARM指令集.pptVIP

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
  4. 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
  5. 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们
  6. 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
  7. 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
第三讲 ARM指令集

第三节 ARM指令集 凌 明 东南大学国家专用集成电路系统工程技术研究中心 trio@ trio@ Why do we need to know the instruction set ARM and Thumb instruction sets were designed to give the best output from compilers Especially the Thumb Instruction set Most design effort for many systems is focussed on compiled code and knowledge of the instruction set is not required But….. Embedded systems require initialisation code and interrupt routines All systems require debugging – possibly at the instruction level Performance gains can be made by writing assembler routines Some features of the ARM architecture are not available with compilers 目录 ARM指令集 汇编语言编程简介 ARM指令集 ARM指令集 所有指令都是32位长 许多指令都是单周期指令 指令可条件执行 LOAD/STORE架构 例 数据处理指令 SUB r0,r1,#5 ADD r2,r3,r3,LSL #2 ANDS r4,r4,#0x20 ADDEQ r5,r5,r6 特定的访问存储器的指令 LDR R0,[R1],#4 STRNEB r2,[r3,r4] LDRSH r5,[r6,#8]! STMFD sp!,{r0,r2-r7,r10} ARM指令的一般编码格式 ARM指令字长为固定的32位。一条典型的ARM指令编码格式如图。 Opcode 指令操作符编码 Cond 指令执行的条件编码 S 决定指令的操作是否影响CPSR的值 Rd 目标寄存器编码 Rn 包含第1个操作数的寄存器编码 Shifter_operand 表示第二个操作数 指令格式opcode{cond}{S} Rd, Rn{,operand2} Conditional Execution and Flags ARM instructions can be made to execute conditionally by post-fixing them with the appropriate condition code This can increase code density and increase performance by reducing the number of forward branches CMP r0, r1 ADDGT r2, r2, #1 ADDLE r3, r3, #1 By default, data processing instructions do not affect the condition flags but this can be achieved by post fixing the instruction (and any condition code) with an “S” loop ADD r2, r2, r3 SUBS r1, r1, #0x01 BNE loop Conditional execution examples 条件码 条件执行 ARM指令可以通过增加条件执行码后缀来条件执行 这样可以增加代码密度,看下面的例子 CMP r3,r0# CMP r3,#0 BEQ skip ADDNE r0,r1,r2 ADD r0,r1,r2 skip 缺省情况下,数据处理指令不影响条件码标志,但是条件码标志可由“S”来设置,CMP不需要加“S” SUBS r1,r1,#1 r1减1并设置标志 BNE loop 如果Z标志清除则跳转 条件执行的例子 使用一系列条件执行的指令 If (a==0) func(1); CMP r0,#0 MOVEQ r0,#1 BLEQ func 设置标志后使用不同的条件码 If (a==0) x=0; If (a0) x=1; CMP r0,#0 MOVEQ r1,#0 MOVGT r1,#

文档评论(0)

shuwkb + 关注
实名认证
文档贡献者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档