Datorteknik Pipelining bild 1 Acceleration How to improve speed? At what costs?
Dec 14, 2015
Datorteknik Pipelining bild 1
Acceleration
How to improve speed? At what costs?
Datorteknik Pipelining bild 2
T=Nq * CPI * Cycletime
Nq, Number of instructions CPI, Cycles Per Instruction Cycletime
Datorteknik Pipelining bild 3
Single Cycle Design
CPI = 1 Cycletime = Long (Longest path)
Datorteknik Pipelining bild 4
Multiple Cycle
1 < CPI < S Cycletime = Factor 1/S
Datorteknik Pipelining bild 5
Pipelined design
CPI = 1, (Constant) Cycletime = Factor 1/S
Datorteknik Pipelining bild 6
“THROUGHPUT”
The total amount of work done in a given time
Datorteknik Pipelining bild 7
Branch
logic
Sgn/Ze
extend
Zero ext.
ALU
A
B
31
0
4+
+
INSTRUCTIONMEMORY
INSTRUCTION MEMORY STAGE (IM)
Datorteknik Pipelining bild 8
Branch
logic
Sgn/Ze
extend
Zero ext.
ALU
A
B
31
0
4+
+
INSTRUCTION DECODE STAGE (DE)
Datorteknik Pipelining bild 9
Branch
logic
Sgn/Ze
extend
Zero ext.
ALU
A
B
31
0
4+
+
INSTRUCTION EXECUTE STAGE (EX)
Datorteknik Pipelining bild 10
Branch
logic
Sgn/Ze
extend
Zero ext.
ALU
A
B
31
0
4+
+
DATA MEMORY STAGE (DM)
DATA MEMORY
Datorteknik Pipelining bild 11
Branch
logic
Sgn/Ze
extend
Zero ext.
ALU
A
B
31
0
4+
+
WRITEBACK STAGE (WB)
Datorteknik Pipelining bild 12
Pipeline
5 stages, (IM, DE, EX, DM, WB) Writeback NOT in critical path Cut critical path by 4
Datorteknik Pipelining bild 13
Branch
logic
Sgn/Ze
extend
Zero ext.
ALU
A
B
31
0
4+
+
CAN READ/WRITETHE SAME REG!
WRITEBACK STAGE (WB)
Datorteknik Pipelining bild 14
Single Cycle
IM
Reg DM Reg
IM
Reg DM Reg
Datorteknik Pipelining bild 15
IM
Reg DM Reg
4 Stage Pipe
IM
Reg DM Reg
IM
Reg DM Reg
IM
Reg DM Reg
Datorteknik Pipelining bild 16
A Program
0x30 sub $6 $0 $1
0x34 add $7 $0 $1
0x38 ori $2 $0 0xABCD
0x3C sw $5 4($0)
$1 holds value 0x05
Datorteknik Pipelining bild 17
IM
Reg DM Reg
4 Stage Pipe
IM
Reg DM Reg
IM
Reg DM Reg
IM
Reg DM Reg
0x30 sub $6 $0 $1
0x34 add $7 $0 $1
0x38 ori $2 $0 0xABCD
0x3C sw $5 4($0)
Datorteknik Pipelining bild 18
IM
Reg DM Reg
Step 1
IM
Reg DM Reg
IM
Reg DM Reg
IM
Reg DM Reg
0x30 sub $6 $0 $1
0x34 add $7 $0 $1
0x38 ori $2 $0 0xABCD
0x3C sw $5 4($0)
Datorteknik Pipelining bild 19
IM
Reg DM Reg
Step 2
IM
Reg DM Reg
IM
Reg DM Reg
IM
Reg DM Reg
0x30 sub $6 $0 $1
0x34 add $7 $0 $1
0x38 ori $2 $0 0xABCD
0x3C sw $5 4($0)
Datorteknik Pipelining bild 20
IM
Reg DM Reg
Step 3
IM
Reg DM Reg
IM
Reg DM Reg
IM
Reg DM Reg
0x30 sub $6 $0 $1
0x34 add $7 $0 $1
0x38 ori $2 $0 0xABCD
0x3C sw $5 4($0)
Datorteknik Pipelining bild 21
IM
Reg DM Reg
Step 4
IM
Reg DM Reg
IM
Reg DM Reg
IM
Reg DM Reg0x3C sw $5 4($0)
0x30 sub $6 $0 $1
0x34 add $7 $0 $1
0x38 ori $2 $0 0xABCD
Datorteknik Pipelining bild 22
IM
Reg DM Reg
Step 5
IM
Reg DM Reg
IM
Reg DM Reg
IM
Reg DM Reg0x3C sw $5 4($0)
0x30 sub $6 $0 $1
0x34 add $7 $0 $1
0x38 ori $2 $0 0xABCD
Datorteknik Pipelining bild 23
Branch
logic
Sgn/Ze
extend
Zero ext.
> 0x30 sub $6 $0 $1 0x34 add $7 $0 $1 0x38 ori $2 $0 0xABCD 0x3C sw $5 4($0)
ALU
A
B
31
0
4+
+
Datorteknik Pipelining bild 24
Branch
logic
Sgn/Ze
extend
Zero ext.
0x30 sub $6 $0 $1> 0x34 add $7 $0 $1 0x38 ori $2 $0 0xABCD 0x3C sw $5 4($0)
ALU
A
B
31
0
4+
+
Datorteknik Pipelining bild 25
Branch
logic
Sgn/Ze
extend
Zero ext.
ALU
A
B
31
0
4+
+
0x30 sub $6 $0 $1 0x34 add $7 $0 $1> 0x38 ori $2 $0 0xABCD 0x3C sw $5 4($0)
Datorteknik Pipelining bild 26
Branch
logic
Sgn/Ze
extend
Zero ext.
ALU
A
B
31
0
4+
+
0x30 sub $6 $0 $1 0x34 add $7 $0 $1 0x38 ori $2 $0 0xABCD> 0x3C sw $5 4($0)