




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





chapter 6
chapter 6
Vacuum, Wash, Dry each takes5 minutesNonpipelined Car Wash Stationserving one customer per 15minutes Pipelined Car Wash Stationafter the first customer (it takes15 minutes), then every 5minutes finishing service fora new customer
chapter 6
chapter 6
-^ Suppose we execute 100 instruction •^ single cycle implementation^ –^ 50 ns/cycle x 1 CPI x 100 inst. = 5000 ns •^ multiple cycle implementation^ –^ 10 ns/cycle x 4.6 CPI (instr. mix) x 100 inst = 4600 ns •^ ideal pipelined processor^ –^ 10 ns/cycle x (1 CPI x 100 inst + 4 cycle to fill up the pipe)= 1040 ns^ –^ here we assume that 5 stages in the pipeline^ –^ 5 stages : IF, ID, EX, MEM, WB
chapter 6
chapter 6
-^ Start the next instruction before the current one has completed^ –^ improves throughput - total amount of work done in a giventime^ –^ instruction latency (execution time, delay time, response time- time from the start of an instruction to its completion) is
Cycle 2
Cycle 3 Cycle 4
Cycle 5
IFetch^
Dec^
Exec^
Mem^
Cycle 7 Cycle 6^
Cycle 8
IFetch^
Dec^
Exec^
Mem^
IFetch^
Dec^
Exec^
Mem^
chapter 6
Dec^ Exec
Mem
Cycle 2 Cycle 3 Cycle 4 Cycle 5 Cycle 6 Cycle 7 Cycle 8 Cycle 9Cycle 10
IFetch^
Dec^ Exec
Mem
lw^
sw
R-type^ IFetch
lw^ IFetch
Dec^
Exec^
Mem^
Pipeline Implementation:
IFetch^
Dec^ Exec
Mem
sw
IFetch^
Dec^ Exec
Mem
R-type Single Cycle Implementation:Clk
lw^
sw^
Waste
Cycle 1^
Cycle 2
chapter 6
-^ What do we need to add/modify in our MIPS datapath?^ –^ State registers between each pipeline stage to isolate them^ Instruction^ ReadAddress
Add 4 MemoryPC
Read Addr 1^ RegisterRead Addr 2FileWrite Addr Write Data
ReadData 1ReadData 2 16
32
AddShiftleft 2 ALU
DataMemoryRead AddressDataWrite Data
IFetch/Dec
Dec/Exec
Exec/Mem
Mem/WB
IF:IFetch
ID:Dec^
EX:Execute
MEM:MemAccess
WB:WriteBack
System Clock
SignExtend
lw Inst 1Inst 2Inst 3Inst 4
Mem^
Reg^
Mem^
Reg ALU
Mem^
Reg^
Mem^
Reg ALU
Mem^
Reg^
Mem^
Reg ALU
Mem^
Reg^
Mem^
Reg ALU
Mem^
Reg^
Mem^
Reg
-^ Fix with separate instr and data memories (I$ and D$)
add $1, Inst 1Inst 2 add $2,$1,
IM^ Reg
Reg ALU IM^ Reg
Reg ALU IM^ Reg
Reg ALU IM^ Reg
Reg
chapter 6
Inst 1Inst 2
IM^ Reg
Reg ALU IM^ Reg
Reg ALU IM^ Reg
Reg ALU IM^ Reg
add $1, add $2,$1,^ clock edge that controlsregister writing
chapter 6
IM^ Reg
Reg ALU IM^ Reg
Reg ALU IM^ Reg
Reg ALU IM^ Reg
Reg ALU IM^ Reg
Reg
-^ Dependencies backward in time cause hazards^ •^ Read before write data hazard
chapter 6
IM^ Reg
Reg ALU IM^ Reg
Reg ALU IM^ Reg
Reg ALU IM^ Reg
Reg ALU IM^ Reg
Reg
-^ Dependencies backward in time cause hazards add $1,sub $4,$1,$5and $6,$1,$7or^ $8,$1,$9xor $4,$1,$5^ •^ Read before write data hazard
chapter 6
IM^ Reg
Reg ALU IM^ Reg
Reg ALU IM^ Reg
Reg ALU IM^ Reg
Reg ALU IM^ Reg
Reg
-^ Dependencies backward in time cause hazards^ •^ Load-use data hazard
chapter 6
IM^ Reg
Reg
sub $4,$1,$5and $6,$1,$
IM^ Reg
Reg ALU IM^ Reg
Reg
IM^ Reg
Reg
sub $4,$1,$5and $6,$1,$
IM^ Reg
Reg ALU IM^ Reg
or^ xor $4,$1,$
$8,$1,$
IM^ Reg
Reg ALU IM^ Reg
Reg
chapter 6
IM^ Reg
Reg
lw
IM^ Reg
Reg ALU
Inst 3
IM^ Reg
chapter 6
Add (^4) PC
Read Addr 1^ RegisterRead Addr 2FileWrite Addr Write Data
ReadData 1ReadData 2 16
32
AddShiftleft 2 ALU
DataMemoryRead AddressDataWrite Data
IF/ID
SignExtend
ID/EX^
EX/MEM
MEM/WB
chapter 6
Add (^4) PC
Read Addr 1^ RegisterRead Addr 2FileWrite Addr Write Data
ReadData 1ReadData 2 16
32
AddShiftleft 2 ALU
DataMemoryRead AddressDataWrite Data
IF/ID
SignExtend
ID/EX^
EX/MEM
MEM/WB
chapter 6
Add (^4) PC
Read Addr 1^ RegisterRead Addr 2FileWrite Addr Write Data
ReadData 1ReadData 2 16
32
AddShiftleft 2 ALU
DataMemoryRead AddressDataWrite Data
IF/ID
SignExtend
ID/EX
EX/MEM
MEM/WB
Control
chapter 6
IM^ Reg
Reg MUL ALU IM^ Reg
DM2Reg
-^ What if the data memory access is twice as slow as theinstruction memory?^ –^ make the clock twice as slow or …^ –^ let data memory access take two cycles (and keep the sameclock rate)
RegDM1 DM
IM^ Reg
PC updateIM access
decoderegaccess
ALU opDM accessshift/rotatecommit result(write back) ALU IM^ Reg
Reg Reg^ SHFT PC updateBTB accessstart IM access
IM access
decodereg 1 accessshift/rotatereg 2 access
ALU opstart DM accessexception
DM writereg write