了解气泡、失速、重复解码/获取

Joh*_*n D 5 assembly computer-science mips cpu-architecture pipelining

我真的很困惑气泡、停顿和重复解码/获取之间的区别。我的文本是帕特森文本,第三版。
示例1:

add $3, $4, $6
sub $5, $3, $2
lw $7, 100($5)
add $8, $7, $2
Run Code Online (Sandbox Code Playgroud)

解决方案:点击这里(使用图像,因为很难输入其中的内容)
在此示例/解决方案中,将五个气泡插入到第三条和第四条指令之间的新行中。

示例2:

lw $4, 100($2)
sub $6, $4, $3
add $2, $3, $5
Run Code Online (Sandbox Code Playgroud)

解决方案:点击这里
在此示例中,气泡包裹了时钟周期 4 中的第二条和第三条指令。在时钟周期 4 中,重复 I2 的解码并重复 I3 的取指。


示例 1 和示例 2 有什么区别?为什么示例 1 中插入了一行气泡,而示例 2 中插入了一个气泡并重复解码/获取?它们的功能相同吗?如果它们在功能上相同,那么这对于示例 1 来说是一个有效的解决方案吗?

I1: IF ID EX MEM WB
I2:    IF ID EX  MEM WB
I3:       IF ID  EX  MEM WB
I4:          IF  NOP ID  EX MEM WB 
Run Code Online (Sandbox Code Playgroud)

对于示例 1,这也是一个有效的解决方案吗?

I1: IF ID EX MEM WB
I2:    IF ID EX  MEM WB
I3:       IF ID  EX  MEM WB
I4:          NOP IF  ID  EX MEM WB 
Run Code Online (Sandbox Code Playgroud)

对于示例 2,这是否是一个有效的解决方案?

I1: IF ID EX  MEM WB
I2:    IF NOP ID  EX MEM WB
I3:       NOP IF  ID EX  MEM WB
Run Code Online (Sandbox Code Playgroud)

对于示例 2,这也是一个有效的解决方案吗?

I1: IF ID EX  MEM WB
I2:    IF ID  ID  EX MEM WB
I3:       IF  IF  ID EX  MEM WB
Run Code Online (Sandbox Code Playgroud)

小智 0

I know the question is old, but I hope this helps. Stalling and bubbling is used in different context. Stalling represents keeping the register with the same inputs and continuing onto the next stages with same inputs, meaning no output or no regsisters inputs are different, while bubble represent a NOP instruction, that will make the register inputs be 0(If i am not wrong). Now the difference between bubble and stalling you can understand by the following example. In the case of a jump mispredicted branch you have following instructions that you dont know yet if they will be taken or not. For cost purposes of delay and bandwidth the stalling will keep the decode stage in stalling, while if a bubble would be entered you will be back of two stages the fetch and the decode. In the case the branch was good selected and was stalled, then the resume will be already in the decode stage, while if was bubbled the result would have to start again from the fetch instruction. I think that the difference is also of costs, in adding inputs to registers.