WAR危险会导致管道中的气泡(MIPS)?

时间:2016-05-13 18:38:24

标签: assembly mips hazard

如果我有2行汇编,如:

add $s1, $s3, $s5 
sub $s3, $s6, $s8

这会导致WAR(读后写)危险,对吗?

问题是我不明白它是否会导致在管道中插入气泡,因为我必须绘制管道表。

是否有任何不同的情况会导致危险?

1 个答案:

答案 0 :(得分:3)

  

合理的(有序的)WAR危险并不常见/不可能   管道

Pipeline Hazards, Page 2

这是一个表格,用于演示为什么,在5级流水线CPU中。让我们将它们标记为1和2。

 IF | ID | EX | MEM | WB
-------------------------
 1  |    |    |     |
-------------------------
 2  |(1) |    |     |     Instruction 1 is obtaining $s3
-------------------------
    | 2  | 1  |     |    
-------------------------
    |    | 2  |  1  |
-------------------------
    |    |    |  2  | 1
-------------------------
    |    |    |     |(2)  Instruction 2 is writing $s3 back

指令在ID(指令解码)阶段从寄存器文件中获取操作数,但在WB(写回)阶段之前,结果不会写回寄存器文件。指令1在指令2处于WB阶段之前的4个时钟周期内处于ID阶段,因此在使用$s3之前不可能覆盖<Grid> <ListView IsItemClickEnabled="True" ItemClick="ListView_ItemClick"> <ListViewItem> <StackPanel Orientation="Horizontal"> <SymbolIcon Symbol="AlignCenter" Foreground="White" /> <TextBlock Text="MAPS" Foreground="White" /> </StackPanel> </ListViewItem> </ListView> </Grid>