理解与流水线MIPS汇编 [英] understanding MIPS assembly with pipelining

查看:1138
本文介绍了理解与流水线MIPS汇编的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过标准的5级流水线的MIPS架构,并假设一些指令彼此依赖,如何管道泡沫被插入到下面的汇编code?

With the standard 5-stage pipeline for the MIPS architecture and assuming some instructions depend on each other, how the pipeline bubbles are inserted to the following assembly code?

I1: lw   $1, 0($0)
I2: lw   $2, 4($0)
I3: add  $3, $1, $2      ; I1 & I2 -> I3
I4: sw   $3, 12($0)      ; I3 -> I4
I5: lw   $4, 8($0)
I6: add  $5, $1, $4      ; I1 & I5 -> I6
I7: sw   $5, 16($0)      ; I6 -> I7

在我们插入泡沫首先,我们

In the first place that we insert a bubble, we

I1:  IF   ID   EX   MEM   WB 
I2:       IF   ID   EX    MEM
I3:            IF   ID    --
I4:                 IF    ID

正如你所看到的,而I3被停止,I4可以进行解码。是不是啊?接下来,

As you can see, while I3 is stalled, I4 can proceed for decoding. Isn't that right? Next,

I1:  IF   ID   EX   MEM   WB 
I2:       IF   ID   EX    MEM   WB
I3:            IF   ID    --    EX   MEM  WB
I4:                 IF    ID    --   --   EX   MEM   WB
I5:                       IF    ID   EX   MEM  WB 
I6:                             IF   ID   --   EX    MEM   WB
I7:                                  IF   ID   --    --    EX   MEM   WB

我认为这是可能与MIPS的标准管道,但也有人说,每当一个泡沫插入整个流水线停滞。怎么说也想通了?

I think that is possible with the standard pipeline of MIPS, but some say that whenever a bubble is inserted the whole pipeline is stalled. How that can be figured out?

推荐答案

在您的previous问题,你用帕特森的书,所以让我借它的图之一:

In your previous question you were using Patterson's book, so let me borrow one of its diagrams:

危险检测单元

这里的重要的位是危险检测单元,这是造成气泡。如果您已经阅读附带的文本,您是否知道,它确实该方法

The important bit here is the hazard detection unit, which is causing the bubbles. If you've read the accompanying text, you know that the method by which it does that is


  • NOP出控制信号,

  • 暂停IF 的(保持固定的IF / ID缓冲区,不提前PC)

  • NOP out the control signals,
  • pause IF (keep the IF/ID buffer fixed and don't advance PC)

这意味着你的管道图中不能发生这样的。不会有进入每个周期一个新的指令。同时认为,如果你有不同的code,你可能会安排硬件危害发生,因为小丑描述。所以这是明显不好,并且将溶液失速中频

Which means that your pipeline diagram cannot happen like that. There will not be a new instruction entering every cycle. Also consider that if you had different code, you could have arranged for hardware hazards to happen, as Jester described. So that's obviously bad, and the solution is stalling IF.

这是会发生什么:

I1:  IF   ID   EX   MEM   WB 
I2:       IF   ID   EX    MEM   WB
I3:            IF   ID    --    --    --
I3:                 IF    ID    --    --    --
I3:                       IF    ID    EX    MEM   WB
I4:                             IF    ID    --    --    --

等。

这篇关于理解与流水线MIPS汇编的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆