ImageVerifierCode 换一换
你正在下载:

project.doc

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

加入VIP,免费下载
 

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

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

下载须知

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

版权提示 | 免责声明

本文(project.doc)为本站会员(b****1)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

project.doc

1、 project; Exercise 1 ; This is an assembly version of the following C code (assuming a, b and c already declared) ; ; for(int i=0;i6;i+) ; ai = ai + bi + ci; ; .data a: .space 48 b: .word 10,11,12,13,0,1 c: .word 1,2,3,4,5,6 .text ;initialize registers daddi r1,r0,a daddi r2,r0,b daddi r3,r0,c daddi

2、 r4,r0,6 Loop: lw r5,0(r1) ; element of a lw r6,0(r2) ; element of blw r7,0(r3) ; element of c dadd r8,r5,r6 ; ai + bi dadd r9,r7,r8 ; ai = ai + bi + ci; sw r9,0(r1) ; store value in ai daddi r1,r1,8 ; increment memory pointers daddi r2,r2,8 daddi r3,r3,8 daddi r4,r4,-1 ; i+ bnez r4,Loop end: halt 1

3、) Load ex1.s into the memory of MIPS64 and disable the forwarding logic, the delay slot and the Branch target buffer from the Configure menu in the main toolbar. Before running the program, try to predict where stalls occur, how many clock cycles they will take, and for what kind of hazards they occ

4、ur. Then compare your prediction with the simulation results. 答:时钟周期数=19 6 + 4 + 4 = 122 RAW data hazard=7 6 = 42 次。 仿真器的模拟结果为: 2) The program of ex1.s consists a loop plus some other instructions outside it. After running the program to completion, estimate the CPI using the Statistics window. In t

5、he case of a program containing a “hot spot” (i.e. an internal loop whose instructions are executed much more frequently than all the other instructions) the CPI can be roughly estimated just using the asymptotic CPI, i.e. where Nout and Sout are the number of instructions and the number of stalls o

6、utside the “hot spot”, respectively, L is the number of loop cycles of the innermost loop, and IChot and Shot are the number of instructions and the number of stalls of the “hot spot”. Compare the asymptotic CPI with the value resulting from simulations. Are results compatible? 答:Simulator CPI=(11+7

7、)*6+4+5+5+1)/(11*6)=1.848CPIAsymptotic=(11+7)/11=1.636执行情况如下:3) Enable the forwarding logic and execute the code again. Compute the CPI again. Justify the remaining stalls and comment why some of them occur after ID stage rather than after IF.答: Simulator CPI=(11+1)*6+5+5+4)/(11*6)=1.303 CPI Asympto

8、tic=(11+1)/11=1.091不相同。因为存在forwarding,ID阶段可以先读取寄存器的地址,默认的寄存器的值为错,bnez指令需要放回寄存器中的值,所以不接受daddi指令。EXE阶段forwarding的值,而要等到WB后的值。4) Disable the forwarding logic and assume that the MIPS hardware cannot detect hazards. Modify the source code by inserting NOPs where appropriate without reordering the code (

9、NOP stuffing technique). Check with the simulator that no stall occurs, and check whether the CPI has changed. Do we have better performance? 答:加入NOP: .data a: .space 48 b: .word 10,11,12,13,0,1 c: .word 1,2,3,4,5,6 .text daddi r1,r0,a daddi r2,r0,b daddi r3,r0,c daddi r4,r0,6 Loop: lw r5,0(r1) lw r

10、6,0(r2) lw r7,0(r3) NOP dadd r8,r5,r6 NOP NOP dadd r9,r7,r8 NOP NOP sw r9,0(r1) daddi r1,r1,8 daddi r2,r2,8 daddi r3,r3,8 daddi r4,r4, -1 NOP NOP bnez r4,Loop end: halt 加入了nop后,没有stall,CPI改变,性能变弱。 5)Reschedule the instructions (code moving technique) in order to avoid stalls without modifying the pr

11、ogram semantics (check the final result to see if after moving the instructions the result is the same). Recompute the normal and asymptotic CPI values. 答:代码如下: 执行情况:.text ;initialize registers daddi r1,r0,a daddi r2,r0,b daddi r3,r0,c daddi r4,r0,6 Loop: lw r5,0(r1) lw r6,0(r2) lw r7,0(r3) daddi r2

12、,r2,8 dadd r8,r5,r6 daddi r3,r3,8 dadd r9,r7,r8 daddi r4,r4,-1 sw r9,0(r1) daddi r1,r1,8 bnez r4,Loop end: halt 故CPI Asymptotic =(11+3)/11=1.273实际为1.2966) Combine rescheduling and forwarding techniques and note the differences with respect to the forwardingonly and reschedulingonly cases. Try to ena

13、ble the “Branch target buffer” look at the simulation code and determine the CPI. Has performance improved? Try to modify the original code by adding 6 additional input values in a and b. What do you expect from CPI?答:加入forwarding的执行情况: 在此基础上加入“Branch target buffer”,得到的结果如下: forwarding: rescheduling

14、: 把循环的次数增加到 12次的时,增加输入的个数,CPI 又会有提高。代码如下: .data a: .space 96 b: .word 10,11,12,13,0,1,1,0,13,12,11,10 c: .word 1,2,3,4,5,6,6,5,4,3,2,1 .text ;initialize registers daddi r1,r0,a daddi r2,r0,b daddi r3,r0,c daddi r4,r0,12 Loop: lw r5,0(r1) lw r6,0(r2) lw r7,0(r3) daddi r2,r2,8 dadd r8,r5,r6 daddi r3,r

15、3,8 dadd r9,r7,r8 daddi r4,r4,-1 sw r9,0(r1) daddi r1,r1,8 bnez r4,Loop end: halt 程序的执行情况如下: rescheduling: 增加循环次数后,代码变为: .data a: .space 96 b: .word 10,11,12,13,0,1,1,0,13,12,11,10 c: .word 1,2,3,4,5,6,6,5,4,3,2,1 .text ;initialize registers daddi r1,r0,a daddi r2,r0,b daddi r3,r0,c daddi r4,r0,12 Loop: lw r5,0(r1) ; element of a

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1