Вы находитесь на странице: 1из 8

Program Notes

Lecture 10:
Pipelining + ,- .& $ #

+ / 0 1( 2 " #
3

+ 4 . 2 " #

+ 5 67 6 )

! "#
$%
%&''

(
)* ! "

Pipelining is Natural: Assembly Line! Sequential Laundry

# 8 % 6 PM 7 8 9 10 11 12 1 2 AM
+ 9 # *! A B C D
! % (% " T 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30
a Time
0" # (% A
s
+ - " 1" ' " B
k
C
+ *# 1" ' " O
r D
+ :$ % ; 1" ' " d
e
r < %% # 1 "= "( % "
+ : " ; 1" ' "
% " 0 " >
( #% % 0% 0 % % # 1 ?
Pipelined Laundry: Start work ASAP Slow Dryers

6 PM 7 8 9 10 11 12 1 2 AM 6 PM 7 8 9 10 11 12 1 2 AM

30 30 30 30 30 30 30 Time 30 30 30 30 30 30 30 30 30 30 30 Time
T T
a A a A
s s
k B k B
C C
O O
D D
r r
d d
e e
r r
+ % % # 1" ) "( % "
3 ) , ") - " ?

Pipelining Lessons MIPS


Pipe Stages == The Five Execution Steps
6 PM 7 8 9 ) % "@ %% # ) >" $
(" % " 1 %"
Time ( 0 1 %
T &) >" * 5 " $
&) /%% " 1 "
a 30 30 30 30 30 30 30 " % "%
#" (
(
s " " ) 8 / # "
" 9 %
A
k ) %" AB
B " " ) / # "
" 56 # " %
) % % #
O C "
%0 " % " ) - 69 1
r ) % % "(
d D " " ""
e 7) 2 :(%
%
; %
r : ; "
"
) %
%( * "
Pipelining in MIPS Can We Pipeline the Multicycle Datapath?

IDEAL?

Can We Pipeline the Unicycle Datapath? Unicycle

How do we split the datapath into stages?


Basic Idea Slicing of Datapath
5 % " % " "

Slicing of Datapath Corrected Datapath


# 0 " ?

Other(?) Control Signals?


Another View: Performance?
Single Cycle, Multiple Cycle, vs. Pipeline (Is it worth the pain?)
Cycle 1 Cycle 2
Clk # % /
Single Cycle Implementation: "# % 8 >8 '' " A '' "
Load Store Waste

Cycle 1 Cycle 2 Cycle 3 Cycle 4 Cycle 5 Cycle 6 Cycle 7 Cycle 8 Cycle 9 Cycle 10
Clk / % # % /
' "# % 8)
7 >C " 8
D8 '' " A 7'' "
Multiple Cycle Implementation:
Load Store R-type
Ifetch Reg Exec Mem Wr Ifetch Reg Exec Mem Ifetch

Pipeline Implementation:
Looks good, but…. > % % 0 % " "
Load Ifetch Reg Exec Mem Wr ' " # % 8C >8 '' " E # % DA ' ' "
Store Ifetch Reg Exec Mem Wr

R-type Ifetch Reg Exec Mem Wr

Unicycle Implementation Detail 3 Stage Pipeline Implementation Detail

# # #

&
! '' !

" # " $ " " #


%%%
" $
+ " "
"

+ " % ( 8 " ( + "8


+ "" " %%% " % "%
#
Limitation 1: Nonuniform Pipelining Limitation 2: Deep Pipelines

) ) ) ) ) )

) #) #

(* , #$* !

#* + )( + * " " "0 % " "


)) !
+ 5 " %#
" % (
+ 2 % #"
%0 " " +> " % #
* %# #%1 F (" "
+ %
% "

+ /" % " "


( %
# % "
G

Pipeline Hazards Pipeline Hazards


Control Hazards
B 8 " %# ( %% 0 ! " + - " 8 " ?
" " ( ) + 9 " " 1 "
)
% H %%
2 # "H % % *

%, "
+ 5" ! " "
+ " 0 %# #
+ >% # 1( 0 " #

Pipeline Stall (AKA Bubble)


Pipeline Hazards Pipeline Hazards
Control Hazards Control Hazards
+ - " 8 " ? + - " 8 " ?
+ 9 " " 1 "
) + 9 " " 1 "
)
% &H 9 2 % &HC
/"D 9 2

Pipeline Hazards Pipeline Hazards


Control Hazards Data Hazards
+ - " 8 " ? I % ( " " ( 0 1
+ 9 " " 1 "
)
% H* %# * " C" /> D 2# % >" C 0 " D
H

50% Fill Rate

More about Branch Prediction/Delayed Branching Later…


Pipeline Hazards Pipeline Hazards
Data Hazards Data Hazards
I % ( " " ( 0 1 I % ( " " ( 0 1

* , H 6 " * , H Options: Delayed Load or Bubble


Solution: Bypassing

Dependences Summary and Real Stuff


(Not in the book, but you will see it again…)
* " "" #
+ $%0 + % " ( % "
+ + /%% " " (
%
+ #% (% " " #!
")2
+
+ % + , " 0 1
"

+ 5 !" H* %# 9 5 % ( (
+ 5 !" H* %# " + /> > " " % !" %
C %# %# % D
+ / ( ( % " %
%%"

+ "&& " "


3

Вам также может понравиться