作者nickboy0211 (Silly Boy)
看板Grad-ProbAsk
标题Re: [理工] [计组]-95 台大资工
时间Thu Oct 29 22:19:20 2009
是否是因为 beq在id stage中,直接将两个从register file 读出来的内容直接作比较。
图可参考白算盘三版p.420
且forwarding Unit只支援从Mem To ALU与WB To ALU这两个Forwarding path.
因此无法使用Forwarding Unit 来解决此Data Hazard。
我的想法是这样。有问题,还请大大指正。
至於中央那个解答。我就不太清楚了。
※ 引述《lwtistunning (考验)》之铭言:
: ADDI r1,r0,#101
: ADDI r2,r0,A
: Loop:LD r3,0(r2)
: ADDI r3,r3,#1
: SD r3,0(r2)
: ADDI r2,r2,#4
: SUBI r1,r1,#1
: BNE r1,r0,Loop
: Assume that the branch is resolved during the instruction decode stage,
: and full register forwarding are implemented.
: Assume that all memory reference hit in the cache and TLBs.
: the pipeline does not implement any branch prediction mechanism.
: How many stall cycle are in one loop iteration including stalls caused
: by the branch instruction?
: 我想问的是 SUBI r1,r1,#1
: BNE r1,r0,Loop 这两指令中 明显有data hazard存在
: 题目说有支援forwarding,那不就应该靠forwarding就能解决这边的data hazard了吗?
: 解答却是说,需要在这两道指令中再加一个stall才可。
: 有人能教我一下为什麽这边还要stall一个clock呢?
: (解答这样说;Since branch decision is resolved during ID stage,a clock stall is
: needed between SUBI and BEQ.)
: 因为我在做其它考古题时,也有遇到类似情形,但如果有支援forwarding下
: 都是不用再加一个stall的。
: 例如中央97的一题 or $3,$2,$1
: beq $2,$3,loop 显然也有data hazard存在
: 但解答是说用forwarding即可解。
: 难道是有提到branch decision is resolved during ID stage.
: 那麽即使在有支援forwarding下,还是要stall一个clock??
: 麻烦各位指导一下,还是我观念有错? 谢谢!!
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 122.146.34.46
1F:→ lwtistunning:感谢 10/31 22:16