计算机体系结构习题及解答

Exercise

For the 5-stage pipeline (RR and RW take half a cycle)

For the following pairs of instructions, how many stalls will the 2nd instruction experience (with and without bypassing)?

1.

ADD R3 ⬅R1+R2

ADD R5 ⬅ R3+R4  

Answer:0 stall with bypassing,2 stalls without bypassing

No bypassing

F

D

E

M

W

F

S

S

D

E

M

W

 bypassing

F

D

E

M

W

F

D

E

M

W

2.

LD R2 ⬅ [R1]

ADD R4 ⬅ R2+R3

Answer:1 stall with bypassing,2 stalls without bypassing

No bypassing

F

D

E

M

W

F

D

S

S

E

M

W

 bypassing

F

D

E

M

W

F

D

S

E

M

W

R1所映射的存储器的值在访存后才知道是多少

3.

LD R2 ⬅ [R1]

SD R3 ⬅ [R2]

Answer:1 stall with bypassing,2 stalls without bypassing

No bypassing

F

D

E

M

W

F

D

S

S

E

M

W

 bypassing

F

D

E

M

W

F

D

S

E

M

W

  • LD R2 ⬅ [R1]
    • 取指阶段:从存储器中读取指令LD R2 ⬅ [R1]
    • 译码阶段:译码指令,得到操作码、寄存器地址和偏移量,从寄存器堆中读取R1的值
    • 执行阶段:将R1的值加上偏移量,得到存储器地址
    • 访存阶段:从存储器中读取该地址的数据
    • 写回阶段:将数据写入R2寄存器
  • SD R3 ⬅ [R2]
    • 取指阶段:从存储器中读取指令SD R3 ⬅ [R2]
    • 译码阶段:译码指令,得到操作码、寄存器地址和偏移量,从寄存器堆中读取R2和R3的值
    • 执行阶段:将R2的值加上偏移量,得到存储器地址
    • 访存阶段:将R3的值写入存储器中该地址的位置
    • 写回阶段:无

4.

LD R2 ⬅ [R1]

SD R2 ⬅ [R3]

Answer:0 stall with bypassing,2 stalls without bypassing

No bypassing

F

D

E

M

W

F

D

S

S

E

M

W

 bypassing

F

D

E

M

W

F

D

E

M

W

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值