Upload
doomachaley
View
214
Download
0
Embed Size (px)
Citation preview
8/9/2019 lec06-pipelining-mips.ppt
1/56
Lecture 6: PipeliningMIPS R4000 and More
http://list.zju.edu.cn/kaibu/comparch
8/9/2019 lec06-pipelining-mips.ppt
2/56
Lab 2Demo due April 15
Report due April 1
Assignment 2
http://list !"u edu cn/#aibu/comparch/Assignment$2 pd%
http://list.zju.edu.cn/kaibu/comparch/Assignment-2.pdfhttp://list.zju.edu.cn/kaibu/comparch/Assignment-2.pdfhttp://list.zju.edu.cn/kaibu/comparch/Assignment-2.pdfhttp://list.zju.edu.cn/kaibu/comparch/Assignment-2.pdf
8/9/2019 lec06-pipelining-mips.ppt
3/56
Appendi& ' ($' )
8/9/2019 lec06-pipelining-mips.ppt
4/56
8/9/2019 lec06-pipelining-mips.ppt
5/56
Multic cle ,P *peration
! ,loating$point 3,P operations takemore time than inte"er operations do
! #o complete an $% op in 1 cc:a slo& clock'man( lo"ic in $% units'
8/9/2019 lec06-pipelining-mips.ppt
6/56
Multic cle ,P *peration
! ,P pipelineallo& )or a lon"er latenc( )or op*
t&o chan"es o+er inte"er pipeline:repeat ,-*use multiple $% )unctional units*
8/9/2019 lec06-pipelining-mips.ppt
7/56
,P Pipeline
8/9/2019 lec06-pipelining-mips.ppt
8/56
*utline
! ultic(cle $% perations! 0azards and $or&ardin"
! %2 R3444 %ipeline
8/9/2019 lec06-pipelining-mips.ppt
9/56
*utline
! ultic(cle $% perations! 0azards and $or&ardin"
! %2 R3444 %ipeline
8/9/2019 lec06-pipelining-mips.ppt
10/56
,P Pipelineloads and stores
integer ALU operationsbranches
FP addFP subtract
FP conversion
FP and integer multiplier
FP and integer divider
8/9/2019 lec06-pipelining-mips.ppt
11/56
,P Pipeline
! ,- is not pipelined! o other instruction usin" that
)unctional unit ma( issue until thepre+ious instruction lea+es ,-
! ) an instruction cannot proceed to ,-6the entire pipeline behind thatinstruction &ill be stalled
8/9/2019 lec06-pipelining-mips.ppt
12/56
,P Pipeline
! Latencthe number o) inter+enin" c(clesbet&een an instruction that produces aresult and an instruction that uses theresult
! Initiation/Repeat Inter5althe number o) c(cles that must elapsebet&een issuin" t&o operations o) a
"i+en t(pe
8/9/2019 lec06-pipelining-mips.ppt
13/56
,P Pipeline
Essentially, pipeline latency is 1 cycleless than the depth of the execution
pipelinee.g., FP add takes 4 stages
8/9/2019 lec06-pipelining-mips.ppt
14/56
enerali!ed ,P Pipeline
! ,- is pipelined 7e8cept )or $% di+ider9! Additional pipeline re"isters
e.".6 D/A1
FP divider: 24 CCs
8/9/2019 lec06-pipelining-mips.ppt
15/56
enerali!ed ,P Pipeline
! ,8ampleitalics: sta"e &here data is needed
bold : sta"e &here a result is a+ailable
8/9/2019 lec06-pipelining-mips.ppt
16/56
*utline
! ultic(cle $% perations! 0azards and $or&ardin"
! %2 R3444 %ipeline
8/9/2019 lec06-pipelining-mips.ppt
17/56
7a!ard
! Di+ider is not )ull( pipelined structural hazard
8/9/2019 lec06-pipelining-mips.ppt
18/56
7a!ard
! nstructions ha+e +ar(in" runnin"times6 ma(be ;1 re"ister &rite in ac(cle < structural hazard
8/9/2019 lec06-pipelining-mips.ppt
19/56
7a!ard
! nstructions no lon"er reach =B inorder Write after write W!W" hazard
8/9/2019 lec06-pipelining-mips.ppt
20/56
7a!ard
! nstructions ma( complete in adi))erent order than the( &ere issued exceptions
8/9/2019 lec06-pipelining-mips.ppt
21/56
7a!ard
! >on"er latenc( o) operations #orefre$uent stalls for %!W hazards
8/9/2019 lec06-pipelining-mips.ppt
22/56
RA 7a!ards
8/9/2019 lec06-pipelining-mips.ppt
23/56
Structural 7a!ards
8/9/2019 lec06-pipelining-mips.ppt
24/56
Structural 7a!ards
! nterlock Detection! ethod 1: track the use o) the &rite
port in the D sta"e and stall aninstruction be)ore it issues:: a shi)t re"ister tracks &hen alread(<issued instructions &ill use the re"ister)ile* i) the instruction in D is needs to usethe re"ister )ile at the same time6 stall
8/9/2019 lec06-pipelining-mips.ppt
25/56
Structural 7a!ards
! nterlock Detection! ethod : stall a con)lictin" instruction
&hen it tries to enter , /=B:: could stall either issuin" or issued one* "i+e priorit( to the unit &ith the lon"estlatenc(*#ore co#plicated : stall arises )rom, /=B
8/9/2019 lec06-pipelining-mips.ppt
26/56
A 7a!ards
! ) >.D &ere issued one c(cle earlier! >.D &ould &rite $ one c(cle earlier than
ADD.D W!W hazard what if another instruction using F& 'etween
the#( ))) *o W!W
8/9/2019 lec06-pipelining-mips.ppt
27/56
7a!ard -etection in I-
! 1. ?heck )or structural ha!ards&ait until the re uired )unctional unit isnot bus( 7onl( )or di+ides9*make sure the re"ister &rite port isa+ailable &hen it &ill be needed*
8/9/2019 lec06-pipelining-mips.ppt
28/56
7a!ard -etection in I-
! . ?heck )or RA data ha!ards&ait until source re"isters are a+ailable&hen needed
8/9/2019 lec06-pipelining-mips.ppt
29/56
7a!ard -etection in I-
! . ?heck )or A data ha!ardsdetermine i) an( instruction in A1 A36D6 1< has the same re"isterdestination as this instruction*i) so6 stall the issue o) the instr in D
8/9/2019 lec06-pipelining-mips.ppt
30/56
,or8arding
! Ceneralized &ith more sources,-/ , 6 A3/ , 6 / , 6 D/ , 6, /=B
8/9/2019 lec06-pipelining-mips.ppt
31/56
*ut$o%$order 'ompletion
! ADD and 2 B complete be)ore D E! ut
8/9/2019 lec06-pipelining-mips.ppt
32/56
*ut$o%$order 'ompletion
0o& to deal &ith out
8/9/2019 lec06-pipelining-mips.ppt
33/56
*utline
! ultic(cle $% perations! 0azards and $or&ardin"
! %2 R3444 %ipeline
8/9/2019 lec06-pipelining-mips.ppt
34/56
All in MIPS R4000
8/9/2019 lec06-pipelining-mips.ppt
35/56
MIPS R4000
! 5
8/9/2019 lec06-pipelining-mips.ppt
36/56
MIPS R4000
! I,: )irst hal) o) instruction )etch*%? selection*initiation o) instruction cache access*
8/9/2019 lec06-pipelining-mips.ppt
37/56
MIPS R4000
! IS: s econd hal) o) instruction )etch*completion o) instruction cache access*
8/9/2019 lec06-pipelining-mips.ppt
38/56
MIPS R4000
! R,:instruction decode and re"ister )etch*
hazard checkin"*instruction cache hit detection*
8/9/2019 lec06-pipelining-mips.ppt
39/56
MIPS R4000
! . : e8ecutione))ecti+e address calculation*
A> operation*branch
8/9/2019 lec06-pipelining-mips.ppt
40/56
MIPS R4000
! -,: data )etch)irst hal) o) data access*
8/9/2019 lec06-pipelining-mips.ppt
41/56
MIPS R4000
! -S: s econd hal) o) data )etchcompletion o) data cache access*
8/9/2019 lec06-pipelining-mips.ppt
42/56
MIPS R4000
! 9': ta" checkdetermine &hether the data cacheaccess hit*
8/9/2019 lec06-pipelining-mips.ppt
43/56
MIPS R4000
! 1: &rite back)or loads and re"ister
8/9/2019 lec06-pipelining-mips.ppt
44/56
8/9/2019 lec06-pipelining-mips.ppt
45/56
!
8/9/2019 lec06-pipelining-mips.ppt
46/56
MIPS R4000
!
8/9/2019 lec06-pipelining-mips.ppt
47/56
MIPS R4000
!
8/9/2019 lec06-pipelining-mips.ppt
48/56
MIPS R4000
! $or&ardin"A> / , or , /=B
8/9/2019 lec06-pipelining-mips.ppt
49/56
MIPS R4000
! $% %ipeline! $% unit &ith three )unctional units:
$% di+ider6 $% multiplier6 $% adder! c(cles to 11 c(cles
8/9/2019 lec06-pipelining-mips.ppt
50/56
MIPS R4000
! $% unit &ith ei"ht di))erent sta"es
8/9/2019 lec06-pipelining-mips.ppt
51/56
MIPS R4000
! $% operations: latenc( and initiationinter+al
8/9/2019 lec06-pipelining-mips.ppt
52/56
MIPS R4000
! $% operations ,8ample 1$% multipl( G $% add
8/9/2019 lec06-pipelining-mips.ppt
53/56
MIPS R4000
! $% operations ,8ample $% add G $% multipl(
8/9/2019 lec06-pipelining-mips.ppt
54/56
MIPS R4000
! $% operations ,8ample : di+ide G add
8/9/2019 lec06-pipelining-mips.ppt
55/56
MIPS R4000
! $% operations ,8ample 3$% add G $% di+ide
8/9/2019 lec06-pipelining-mips.ppt
56/56