免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
123
最近访问板块 发新帖
楼主: jwwzhh
打印 上一主题 下一主题

arm中mov r0, r0的作用是? [复制链接]

论坛徽章:
0
21 [报告]
发表于 2011-07-26 14:37 |只看该作者
回复  azzurris




ARM流水线关键技术分析与代码优化
时间: 2009-03-30 10:15:21 来源:单片机与嵌 ...
fei1700 发表于 2011-07-26 13:33



    非常感谢,我先看看

论坛徽章:
0
22 [报告]
发表于 2011-07-26 15:53 |只看该作者
好像你理解有误吧,采用五级流水的就是哈佛结构,比如arm9。包括你提供的资料里面写的也是:arm9系列则采用了五级流水的哈佛结构。不是冯诺依曼结构。
你说的2.1节,应该描述的是3级流水的arm7.

关于arm9的五级流水线哈佛结构,这里有个简单介绍http://infocenter.arm.com/help/t ... i0022a/DVI0022A.pdf

论坛徽章:
0
23 [报告]
发表于 2011-07-26 22:27 |只看该作者
好像你理解有误吧,采用五级流水的就是哈佛结构,比如arm9。包括你提供的资料里面写的也是:arm9系列则采用 ...
azzurris 发表于 2011-07-26 15:53


谢谢你,是理解错了

我有看到一个专门写pipeline harzards 第15-31页有专门说到几种harzards及LDR interlock。
[PDF] ARM Processor Architecture

http://www.google.com.hk/url?sa=t&source=web&cd=4&ved=0CDUQFjAD&url=http%3A%2F%2Ftwins.ee.nctu.edu.tw%2Fcourses%2Fsoclab_04%2Fhandout_pdf%2F03_ARM_Processor_Architecture.pdf&rct=j&q=arm%205-stage%20pipeline%20hazards&ei=8ckuTovWK63ymAWWmfhF&usg=AFQjCNETBVkQ9BZW-L6iVTJ1r2xXNvPi4A&cad=rja
---------------------------
Pipeline Hazards
  There are situations, called hazards, that prevent the next
  instruction in the instruction stream from being executing
  during its designated clock cycle. Hazards reduce the
  performance from the ideal speedup gained by pipelining.
  There are three classes of hazards:
   – Structural Hazards
       • They arise from resource conflicts when the hardware cannot support all
         possible combinations of instructions in simultaneous overlapped
         execution.
   – Data Hazards
       • They arise when an instruction depends on the result of a previous
         instruction in a way that is exposed by the overlapping of instructions in
         the pipeline.
   – Control Hazards
       • They arise from the pipelining of branches and other instructions that
         change the PC



后来又看到那个文后面的3.1节描述了,也贴一下
http://www.21ic.com/app/embed/200903/34441_2.htm

3.1 五级流水线互锁分析
    五级流水线只存在一种互锁,即寄存器冲突。读寄存器是在译码阶段,写寄存器是在回写阶段。如果当前指令(A)的目的操作数寄存器和下一条指令(B)的源操作数寄存器一致,B指令就需要等A回写之后才能译码。这就是五级流水线中的寄存器冲突。如图6所示,LDR指令写R9是在回写阶段,而MOV中需要用到的R9正是LDR在回写阶段将会重新写入的寄存器值,MOV译码需要等待,直到LDR指令的寄存器回写操作完成。(注:现在处理器设计中,可以通过寄存器旁路技术对流水线进行优化,解决流水线的寄存器冲突问题。)

    虽然流水线互锁会增加代码执行时间,但是为初期的设计者提供了巨大的方便,可以不必考虑使用的寄存器会不会造成冲突;而且编译器以及汇编程序员可以通过重新设计代码的顺序或者其他方法来减少互锁的数量。另外分支指令和中断的发生仍然会阻断五级流水线。

论坛徽章:
0
24 [报告]
发表于 2011-07-28 09:41 |只看该作者
谢谢你,是理解错了

我有看到一个专门写pipeline harzards 第15-31页有专门说到几种harzards及LDR i ...
fei1700 发表于 2011-07-26 22:27



    你找资料的能力真强啊,我就没找到。还能介绍一些有关arm结构的不错的资料吗。

论坛徽章:
0
25 [报告]
发表于 2024-04-20 21:12 |只看该作者
本帖最后由 Cloudprogram 于 2024-04-20 21:20 编辑

回复 12# xzko

ARM7TDMI-SData Sheet
ARM7DI Data Sheet
R15 not in list and S bit set (User bank transfer)
For both LDM and STM instructions, the User bank registers aretransferred rather than theregister bank corresponding to the current mode. This is useful for saving theuser state on process switches.Base write-back should not be used when this mechanism is employed.
When the instruction is LDM, care must be taken not to read from abanked register during thefollowing cycle (inserting a dummy instruction such as MOV R0, R0 after the LDM will ensure safety).
官方手册 说明ldm 操作用户模式寄存器的时候后面要注意不要访问寄存器,一般加nop语句。
arm体系结构与编程
P99页
LDM(2)用户模式的批量内存字数据读取指令
指令的使用
在本指令的后面不能紧跟访问备份寄存器(bankedregisters)的指令,最好跟一条NOP指令。
在用户模式和系统模式下使用本指令会产生不可预知的结果。

未命名图片.jpg (409.05 KB, 下载次数: 6)

arm体系结构与编程

arm体系结构与编程
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP