SlideShare ist ein Scribd-Unternehmen logo
1 von 23
Five-stage Pipelined Datapath
1
Instruction
memory
Address
4
32
0
Add
Add
result
Shift
left 2
Instruction
IF/ID EX/MEM MEM/WB
M
u
x
0
1
Add
PC
0
Write
data
M
u
x
1
Registers
Read
data 1
Read
data 2
Read
register 1
Read
register 2
16
Sign
extend
Write
register
Write
data
Read
data
1
ALU
result
M
u
x
ALU
Zero
ID/EX
Data
memory
Address
Inst. Fetch Inst. Decode Exec Mem WB
02/08/2019 C.KARTHIKEYAN , AP/ECE
Example for lw instruction:
Instruction Fetch (IF)
2
Instruction
memory
Address
4
32
0
Add
Add
result
Shift
left 2
Instruction
IF/ID EX/MEM MEM/WB
M
u
x
0
1
Add
PC
0
Write
data
M
u
x
1
Registers
Read
data1
Read
data2
Read
register 1
Read
register 2
16
Sign
extend
Write
register
Write
data
Read
data
1
ALU
result
M
u
x
ALU
Zero
ID/EX
Data
memory
Address
Instruction fetch
02/08/2019 C.KARTHIKEYAN , AP/ECE
Example for lw instruction:
Instruction Decode (ID)
3
Instruction
memory
Address
4
32
0
Add
Add
result
Shift
left 2
Instruction
IF/ID EX/MEM MEM/WB
M
u
x
0
1
Add
PC
0
Write
data
M
u
x
1
Registers
Read
data1
Read
data2
Read
register 1
Read
register 2
16
Sign
extend
Write
register
Write
data
Read
data
1
ALU
result
M
u
x
ALU
Zero
ID/EX
Data
memory
Address
Instruction decode
02/08/2019 C.KARTHIKEYAN , AP/ECE
Example for lw instruction: Execution (EX)
4
Instruction
memory
Address
4
32
0
Add
Add
result
Shift
left 2
Instruction
IF/ID EX/MEM MEM/WB
M
u
x
0
1
Add
PC
0
Write
data
M
u
x
1
Registers
Read
data1
Read
data2
Read
register 1
Read
register 2
16
Sign
extend
Write
register
Write
data
Read
data
1
ALU
result
M
u
x
ALU
Zero
ID/EX
Data
memory
Address
Execution
02/08/2019 C.KARTHIKEYAN , AP/ECE
Example for lw instruction: Memory (MEM)
5
Instruction
memory
Address
4
32
0
Add
Add
result
Shift
left 2
Instruction
IF/ID EX/MEM MEM/WB
M
u
x
0
1
Add
PC
0
Write
data
M
u
x
1
Registers
Read
data1
Read
data2
Read
register 1
Read
register 2
16
Sign
extend
Write
register
Write
data
Read
data
1
ALU
result
M
u
x
ALU
Zero
ID/EX
Data
memory
Address
Memory
02/08/2019 C.KARTHIKEYAN , AP/ECE
Example for lw instruction: Writeback (WB)
6
Instruction
memory
Address
4
32
0
Add
Add
result
Shift
left 2
Instruction
IF/ID EX/MEM MEM/WB
M
u
x
0
1
Add
PC
0
Write
data
M
u
x
1
Registers
Read
data1
Read
data2
Read
register 1
Read
register 2
16
Sign
extend
Write
register
Write
data
Read
data
1
ALU
result
M
u
x
ALU
Zero
ID/EX
Data
memory
Address
Writeback
02/08/2019 C.KARTHIKEYAN , AP/ECE
Example for sw instruction: Memory (MEM)
7
Instruction
memory
Address
4
32
0
Add
Add
result
Shift
left 2
Instruction
IF/ID EX/MEM MEM/WB
M
u
x
0
1
Add
PC
0
Write
data
M
u
x
1
Registers
Read
data1
Read
data2
Read
register 1
Read
register 2
16
Sign
extend
Write
register
Write
data
Read
data
1
ALU
result
M
u
x
ALU
Zero
ID/EX
Data
memory
Address
Memory
02/08/2019 C.KARTHIKEYAN , AP/ECE
Example for sw instruction: Writeback (WB): do nothing
8
Instruction
memory
Address
4
32
0
Add
Add
result
Shift
left 2
Instruction
IF/ID EX/MEM MEM/WB
M
u
x
0
1
Add
PC
0
Write
data
M
u
x
1
Registers
Read
data1
Read
data2
Read
register 1
Read
register 2
16
Sign
extend
Write
register
Write
data
Read
data
1
ALU
result
M
u
x
ALU
Zero
ID/EX
Data
memory
Address
Writeback
02/08/2019 C.KARTHIKEYAN , AP/ECE
Datapath with Control
10
PC
Instruction
memory
Instruction
Add
Instruction
[20– 16]
MemtoReg
ALUOp
Branch
RegDst
ALUSrc
4
16 32Instruction
[15– 0]
0
0
M
u
x
0
1
Add
Add
result
Registers
Write
register
Write
data
Read
data 1
Read
data 2
Read
register 1
Read
register 2
Sign
extend
M
u
x
1
ALU
result
Zero
Write
data
Read
data
M
u
x
1
ALU
control
Shift
left 2RegWrite
MemRead
Control
ALU
Instruction
[15– 11]
6
EX
M
WB
M
WB
WB
IF/ID
PCSrc
ID/EX
EX/MEM
MEM/WB
M
u
x
0
1
MemWrite
Address
Data
memory
Address
IF: lw $10, 8($1)
02/08/2019 C.KARTHIKEYAN , AP/ECE
Datapath with Control
11
PC
Instruction
memory
Instruction
Add
Instruction
[20– 16]
MemtoReg
ALUOp
Branch
RegDst
ALUSrc
4
16 32Instruction
[15– 0]
0
0
M
u
x
0
1
Add
Add
result
Registers
Write
register
Write
data
Read
data 1
Read
data 2
Read
register 1
Read
register 2
Sign
extend
M
u
x
1
ALU
result
Zero
Write
data
Read
data
M
u
x
1
ALU
control
Shift
left 2RegWrite
MemRead
Control
ALU
Instruction
[15– 11]
6
X
M
WB
M
WB
WB
IF/ID
PCSrc
ID/EX
EX/MEM
MEM/WB
M
u
x
0
1
MemWrite
Address
Data
memory
Address
IF: sub $11, $2, $3 ID: lw $10, 8($1)
01
00
000 E
“lw”
02/08/2019 C.KARTHIKEYAN , AP/ECE
Datapath with Control
12
PC
Instruction
memory
Instruction
Add
Instruction
[20– 16]
MemtoReg
ALUOp
Branch
RegDst
ALUSrc
4
16 32Instruction
[15– 0]
0
0
M
u
x
0
1
Add
Add
result
Registers
Write
register
Write
data
Read
data 1
Read
data 2
Read
register 1
Read
register 2
Sign
extend
M
u
x
1
ALU
result
Zero
Write
data
Read
data
M
u
x
1
ALU
control
Shift
left 2RegWrite
MemRead
Control
ALU
Instruction
[15– 11]
6
X
M
WB
M
WB
WB
IF/ID
PCSrc
ID/EX
EX/MEM
MEM/WB
M
u
x
0
1
MemWrite
Address
Data
memory
Address
11
010
00E
ID: sub $11, $2, $3 EX: lw $10, 8($1)IF: and $12, $4, $5
1
0
10
000
1100
“sub”
02/08/2019 C.KARTHIKEYAN , AP/ECE
Datapath with Control
13
PC
Instruction
memory
Instruction
Add
Instruction
[20– 16]
MemtoReg
ALUOp
Branch
RegDst
ALUSrc
4
16 32Instruction
[15– 0]
0
0
M
u
x
0
1
Add
Add
result
Registers
Write
register
Write
data
Read
data 1
Read
data 2
Read
register 1
Read
register 2
Sign
extend
M
u
x
1
ALU
result
Zero
Write
data
Read
data
M
u
x
1
ALU
control
Shift
left 2RegWrite
MemRead
Control
ALU
Instruction
[15– 11]
6
X
M
WB
M
WB
WB
IF/ID
PCSrc
ID/EX
EX/MEM
MEM/WB
M
u
x
0
1
MemWrite
Address
Data
memory
Address
10
000
10E
EX: sub $11, $2, $3 MEM: lw $10, 8($1)ID: and $12, $4, $5
0
1
10
000
1100
IF: or $13, $6, $7
11
0
1
0
“and”
02/08/2019 C.KARTHIKEYAN , AP/ECE
Datapath with Control
14
PC
Instruction
memory
Instruction
Add
Instruction
[20– 16]
MemtoReg
ALUOp
Branch
RegDst
ALUSrc
4
16 32Instruction
[15– 0]
0
0
M
u
x
0
1
Add
Add
result
Registers
Write
register
Write
data
Read
data 1
Read
data 2
Read
register 1
Read
register 2
Sign
extend
M
u
x
1
ALU
result
Zero
Write
data
Read
data
M
u
x
1
ALU
control
Shift
left 2RegWrite
MemRead
Control
ALU
Instruction
[15– 11]
6
X
M
WB
M
WB
WB
IF/ID
PCSrc
ID/EX
EX/MEM
MEM/WB
M
u
x
0
1
MemWrite
Address
Data
memory
Address
10
000
10E
MEM: sub $11, .. WB: lw $10,
8($1)
EX: and $12, $4, $5
0
1
10
000
1100
ID: or $13, $6, $7
10
0
0
0
“or”
IF: add $14, $8, $9
1
1
02/08/2019 C.KARTHIKEYAN , AP/ECE
Datapath with Control
15
PC
Instruction
memory
Instruction
Add
Instruction
[20– 16]
MemtoReg
ALUOp
Branch
RegDst
ALUSrc
4
16 32Instruction
[15– 0]
0
0
M
u
x
0
1
Add
Add
result
Registers
Write
register
Write
data
Read
data 1
Read
data 2
Read
register 1
Read
register 2
Sign
extend
M
u
x
1
ALU
result
Zero
Write
data
Read
data
M
u
x
1
ALU
control
Shift
left 2RegWrite
MemRead
Control
ALU
Instruction
[15– 11]
6
X
M
WB
M
WB
WB
IF/ID
PCSrc
ID/EX
EX/MEM
MEM/WB
M
u
x
0
1
MemWrite
Address
Data
memory
Address
10
000
10E
WB: sub $11, ..MEM: and $12…
0
1
10
000
1100
EX: or $13, $6, $7
10
0
0
0
“add”
ID: add $14, $8, $9
1
0
IF: xxxx
02/08/2019 C.KARTHIKEYAN , AP/ECE
Datapath with Control
16
PC
Instruction
memory
Instruction
Add
Instruction
[20– 16]
MemtoReg
ALUOp
Branch
RegDst
ALUSrc
4
16 32Instruction
[15– 0]
0
0
M
u
x
0
1
Add
Add
result
Registers
Write
register
Write
data
Read
data 1
Read
data 2
Read
register 1
Read
register 2
Sign
extend
M
u
x
1
ALU
result
Zero
Write
data
Read
data
M
u
x
1
ALU
control
Shift
left 2RegWrite
MemRead
Control
ALU
Instruction
[15– 11]
6
M
WB
WB
IF/ID
PCSrc
EX/MEM
MEM/WB
M
u
x
0
1
MemWrite
Address
Data
memory
Address
10
000
10
WB: and $12…
0
1
MEM: or $13, ..
10
0
0
0
EX: add $14, $8, $9
1
0
IF: xxxx ID: xxxx
X
M
WB
ID/EX
E
02/08/2019 C.KARTHIKEYAN , AP/ECE
Datapath with Control
17
WB: or $13…
PC
Instruction
memory
Instruction
Add
Instruction
[20– 16]
MemtoReg
ALUOp
Branch
RegDst
ALUSrc
4
16 32Instruction
[15– 0]
0
0
M
u
x
0
1
Add
Add
result
Registers
Write
register
Write
data
Read
data 1
Read
data 2
Read
register 1
Read
register 2
Sign
extend
M
u
x
1
ALU
result
Zero
Write
data
Read
data
M
u
x
1
ALU
control
Shift
left 2RegWrite
MemRead
Control
ALU
Instruction
[15– 11]
6
M
WB
WB
IF/ID
PCSrc
EX/MEM
MEM/WB
M
u
x
0
1
MemWrite
Address
Data
memory
Address
MEM: add $14, ..
10
0
0
0
EX: xxxx
1
0
IF: xxxx ID: xxxx
X
M
WB
ID/EX
E
02/08/2019 C.KARTHIKEYAN , AP/ECE
Datapath with Control
18
PC
Instruction
memory
Instruction
Add
Instruction
[20– 16]
MemtoReg
ALUOp
Branch
RegDst
ALUSrc
4
16 32Instruction
[15– 0]
0
0
M
u
x
0
1
Add
Add
result
Registers
Write
register
Write
data
Read
data 1
Read
data 2
Read
register 1
Read
register 2
Sign
extend
M
u
x
1
ALU
result
Zero
Write
data
Read
data
M
u
x
1
ALU
control
Shift
left 2RegWrite
MemRead
Control
ALU
Instruction
[15– 11]
6
M
WB
WB
IF/ID
PCSrc
EX/MEM
MEM/WB
M
u
x
0
1
MemWrite
Address
Data
memory
Address
WB: add $14..MEM: xxxxEX: xxxx
1
0
IF: xxxx ID: xxxx
X
M
WB
ID/EX
E
02/08/2019 C.KARTHIKEYAN , AP/ECE
Forwarding (operand selection)
19
ALU
Data
Memory
Register
File
MUX
ID/EX EX/MEM MEM/WB
MUXMUX
Forwarding
Unit
02/08/2019 C.KARTHIKEYAN , AP/ECE
Forwarding (operand propagation)
20
ALU
Data
Memory
Register
File
MUX
ID/EX EX/MEM MEM/WB
MUXMUX
Forwarding
Unit
Rt
Rs
MUX
Rd
Rt
EX/MEM Rd
MEM/WB Rd
02/08/2019 C.KARTHIKEYAN , AP/ECE
Data Hazard Even with Forwarding
21
Time (clock cycles)
lw r1, 0(r2)
sub r4,r1,r6
and r6,r1,r7
or r8,r1,r9
Reg
ALU
DMemIfetch Reg
Reg
ALU
DMemIfetch Reg
Reg
ALU
DMemIfetch Reg
Reg
ALU
DMemIfetch Reg
Forward backward in time… no way!! (or way?)
Instructionorder
02/08/2019 C.KARTHIKEYAN , AP/ECE
Data Hazard Even with Forwarding
22
Time (clock cycles)
or r8,r1,r9
lw r1, 0(r2)
sub r4,r1,r6
and r6,r1,r7
Reg
ALU
DMemIfetch Reg
RegIfetch
ALU
DMem RegBubble
Ifetch
ALU
DMem RegBubble Reg
Ifetch
ALU
DMemBubble Reg
Need “pipeline interlock” (or stall) to stop instructions
from issuing. How is this detected?
Instructionorder
02/08/2019 C.KARTHIKEYAN , AP/ECE
Hazard Detection Unit
• Stall by letting an instruction that won’t write anything go forward
• Stall the pipeline if ID/EX is a load, and (rt=IF/ID.rs or rt=IF/ID.rt)
23
PC
Instruction
memory
Registers
M
u
x
M
u
x
M
u
x
Control
ALU
EX
M
WB
M
WB
WB
ID/EX
EX/MEM
MEM/WB
Data
memory
M
u
x
Hazard
detection
unit
Forwarding
unit
0
M
u
x
IF/ID
Instruction
ID/EX.MemRead
IF/IDWrite
PCWrite
ID/EX.RegisterRt
IF/ID.RegisterRd
IF/ID.RegisterRt
IF/ID.RegisterRt
IF/ID.RegisterRs
Rt
Rs
Rd
Rt
EX/MEM.RegisterRd
MEM/WB.RegisterRd
02/08/2019 C.KARTHIKEYAN , AP/ECE
Code Rescheduling to Avoid Load Hazards
Fast code:
LW Rb,b
LW Rc,c
LW Re,e
ADD Ra,Rb,Rc
LW Rf,f
SW a,Ra
SUB Rd,Re,Rf
SW d,Rd
24
Try producing fast code for
a = b + c;
d = e – f;
assuming a, b, c, d ,e, and f in memory.
Slow code:
LW Rb,b
LW Rc,c
ADD Ra,Rb,Rc
SW a,Ra
LW Re,e
LW Rf,f
SUB Rd,Re,Rf
SW d,Rd
Compiler optimizes for performance. Hardware checks for safety.
02/08/2019 C.KARTHIKEYAN , AP/ECE

Weitere ähnliche Inhalte

Was ist angesagt?

Chapter 2 The 8088 Microprocessor
Chapter 2   The 8088 MicroprocessorChapter 2   The 8088 Microprocessor
Chapter 2 The 8088 Microprocessor
Dwight Sabio
 
8086 lectures
8086 lectures8086 lectures
8086 lectures
sekhar031
 
digital communication,micro processor,pulse and digital circuits
digital communication,micro processor,pulse and digital circuitsdigital communication,micro processor,pulse and digital circuits
digital communication,micro processor,pulse and digital circuits
Manasa Mona
 
26677766 8086-microprocessor-architecture-110905125037-phpapp02
26677766 8086-microprocessor-architecture-110905125037-phpapp0226677766 8086-microprocessor-architecture-110905125037-phpapp02
26677766 8086-microprocessor-architecture-110905125037-phpapp02
Avijeet Negel
 
3 organization of intel 8086
3 organization of intel 80863 organization of intel 8086
3 organization of intel 8086
ELIMENG
 

Was ist angesagt? (18)

Arch 8086
Arch 8086Arch 8086
Arch 8086
 
Z 80 processors (History-Products)
Z 80 processors (History-Products)Z 80 processors (History-Products)
Z 80 processors (History-Products)
 
8086 Architecture
8086 Architecture8086 Architecture
8086 Architecture
 
8086ppt
8086ppt8086ppt
8086ppt
 
Chapter 2 The 8088 Microprocessor
Chapter 2   The 8088 MicroprocessorChapter 2   The 8088 Microprocessor
Chapter 2 The 8088 Microprocessor
 
1326 Introduction To 8086 Microprocessor
1326 Introduction To 8086 Microprocessor1326 Introduction To 8086 Microprocessor
1326 Introduction To 8086 Microprocessor
 
8086 microprocessor
8086 microprocessor8086 microprocessor
8086 microprocessor
 
8086 lectures
8086 lectures8086 lectures
8086 lectures
 
Memory Segmentation of 8086
Memory Segmentation of 8086Memory Segmentation of 8086
Memory Segmentation of 8086
 
Computer Architecture - Data Path & Pipeline Hazards
Computer Architecture - Data Path & Pipeline HazardsComputer Architecture - Data Path & Pipeline Hazards
Computer Architecture - Data Path & Pipeline Hazards
 
8086 Microprocessor
8086 Microprocessor 8086 Microprocessor
8086 Microprocessor
 
digital communication,micro processor,pulse and digital circuits
digital communication,micro processor,pulse and digital circuitsdigital communication,micro processor,pulse and digital circuits
digital communication,micro processor,pulse and digital circuits
 
8086 class notes-Y.N.M
8086 class notes-Y.N.M8086 class notes-Y.N.M
8086 class notes-Y.N.M
 
8086 Microprocessor
8086 Microprocessor8086 Microprocessor
8086 Microprocessor
 
8086
80868086
8086
 
26677766 8086-microprocessor-architecture-110905125037-phpapp02
26677766 8086-microprocessor-architecture-110905125037-phpapp0226677766 8086-microprocessor-architecture-110905125037-phpapp02
26677766 8086-microprocessor-architecture-110905125037-phpapp02
 
8086
80868086
8086
 
3 organization of intel 8086
3 organization of intel 80863 organization of intel 8086
3 organization of intel 8086
 

Ähnlich wie Pipeline data path u3

IntroductionCPU performance factorsInstruction countDeterm.docx
IntroductionCPU performance factorsInstruction countDeterm.docxIntroductionCPU performance factorsInstruction countDeterm.docx
IntroductionCPU performance factorsInstruction countDeterm.docx
normanibarber20063
 
Fordrazborka.zu8.ru eec iv-usa
Fordrazborka.zu8.ru eec iv-usaFordrazborka.zu8.ru eec iv-usa
Fordrazborka.zu8.ru eec iv-usa
rukford
 
Fordrazborka.zu8.ru eec iv-usa
Fordrazborka.zu8.ru eec iv-usaFordrazborka.zu8.ru eec iv-usa
Fordrazborka.zu8.ru eec iv-usa
rukford
 
3 embedded gr_ppapag_msp430_arch
3 embedded gr_ppapag_msp430_arch3 embedded gr_ppapag_msp430_arch
3 embedded gr_ppapag_msp430_arch
chandrika
 

Ähnlich wie Pipeline data path u3 (20)

Lec1 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Pipelining
Lec1 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- PipeliningLec1 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Pipelining
Lec1 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- Pipelining
 
PROCESSOR AND CONTROL UNIT
PROCESSOR AND CONTROL UNITPROCESSOR AND CONTROL UNIT
PROCESSOR AND CONTROL UNIT
 
Chapter 4
Chapter 4Chapter 4
Chapter 4
 
PLC Training Intro
PLC Training IntroPLC Training Intro
PLC Training Intro
 
Iog20 device
Iog20 deviceIog20 device
Iog20 device
 
IntroductionCPU performance factorsInstruction countDeterm.docx
IntroductionCPU performance factorsInstruction countDeterm.docxIntroductionCPU performance factorsInstruction countDeterm.docx
IntroductionCPU performance factorsInstruction countDeterm.docx
 
Arch 1112-6
Arch 1112-6Arch 1112-6
Arch 1112-6
 
CAAL_CCSU_U1.pdf
CAAL_CCSU_U1.pdfCAAL_CCSU_U1.pdf
CAAL_CCSU_U1.pdf
 
Basic Computer Organization and Design
Basic  Computer  Organization  and  DesignBasic  Computer  Organization  and  Design
Basic Computer Organization and Design
 
L11.ppt
L11.pptL11.ppt
L11.ppt
 
3. Single Cycle Data Path in computer architecture
3. Single Cycle Data Path in computer architecture3. Single Cycle Data Path in computer architecture
3. Single Cycle Data Path in computer architecture
 
Computer architecture 3
Computer architecture 3Computer architecture 3
Computer architecture 3
 
01142_17_00878_STT_Electric_Power_Steering_Strategy.doc
01142_17_00878_STT_Electric_Power_Steering_Strategy.doc01142_17_00878_STT_Electric_Power_Steering_Strategy.doc
01142_17_00878_STT_Electric_Power_Steering_Strategy.doc
 
Fordrazborka.zu8.ru eec iv-usa
Fordrazborka.zu8.ru eec iv-usaFordrazborka.zu8.ru eec iv-usa
Fordrazborka.zu8.ru eec iv-usa
 
Fordrazborka.zu8.ru eec iv-usa
Fordrazborka.zu8.ru eec iv-usaFordrazborka.zu8.ru eec iv-usa
Fordrazborka.zu8.ru eec iv-usa
 
Memory Reference instruction
Memory Reference instructionMemory Reference instruction
Memory Reference instruction
 
01142_17_00878_STT_Electric_Power_Steering_Strategy.doc
01142_17_00878_STT_Electric_Power_Steering_Strategy.doc01142_17_00878_STT_Electric_Power_Steering_Strategy.doc
01142_17_00878_STT_Electric_Power_Steering_Strategy.doc
 
01142_17_00878_STT_Electric_Power_Steering_Strategy.doc
01142_17_00878_STT_Electric_Power_Steering_Strategy.doc01142_17_00878_STT_Electric_Power_Steering_Strategy.doc
01142_17_00878_STT_Electric_Power_Steering_Strategy.doc
 
Lecture 9 310h-2
Lecture 9 310h-2Lecture 9 310h-2
Lecture 9 310h-2
 
3 embedded gr_ppapag_msp430_arch
3 embedded gr_ppapag_msp430_arch3 embedded gr_ppapag_msp430_arch
3 embedded gr_ppapag_msp430_arch
 

Mehr von Karthik Vivek

Mehr von Karthik Vivek (20)

Peak detector, instrumentation amp
Peak detector, instrumentation ampPeak detector, instrumentation amp
Peak detector, instrumentation amp
 
U3 op amp applications
U3 op amp applicationsU3 op amp applications
U3 op amp applications
 
Unit 1 ic fab
Unit 1 ic fabUnit 1 ic fab
Unit 1 ic fab
 
Fabrication of diodes, resistors, capacitors, fe ts
Fabrication of diodes, resistors, capacitors, fe tsFabrication of diodes, resistors, capacitors, fe ts
Fabrication of diodes, resistors, capacitors, fe ts
 
Unit 3 part2
Unit 3 part2Unit 3 part2
Unit 3 part2
 
Unit 3 part2
Unit 3 part2Unit 3 part2
Unit 3 part2
 
Unit 3 part2
Unit 3 part2Unit 3 part2
Unit 3 part2
 
Compiler optimization
Compiler optimizationCompiler optimization
Compiler optimization
 
Embedded programming u3 part 1
Embedded programming u3 part 1Embedded programming u3 part 1
Embedded programming u3 part 1
 
ARM stacks, subroutines, Cortex M3, LPC 214X
ARM  stacks, subroutines, Cortex M3, LPC 214XARM  stacks, subroutines, Cortex M3, LPC 214X
ARM stacks, subroutines, Cortex M3, LPC 214X
 
ARM inst set part 2
ARM inst set part 2ARM inst set part 2
ARM inst set part 2
 
ARM instruction set
ARM instruction  setARM instruction  set
ARM instruction set
 
ARM instruction set
ARM instruction  setARM instruction  set
ARM instruction set
 
ARM Versions, architecture
ARM Versions, architectureARM Versions, architecture
ARM Versions, architecture
 
Unit 1a train
Unit 1a trainUnit 1a train
Unit 1a train
 
Unit2 arm
Unit2 armUnit2 arm
Unit2 arm
 
Unit 1c
Unit 1cUnit 1c
Unit 1c
 
Unit 1b
Unit 1bUnit 1b
Unit 1b
 
Unit 1a train
Unit 1a trainUnit 1a train
Unit 1a train
 
Introduction
IntroductionIntroduction
Introduction
 

Kürzlich hochgeladen

%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
Abortion Pill Prices Boksburg [(+27832195400*)] 🏥 Women's Abortion Clinic in ...
Abortion Pill Prices Boksburg [(+27832195400*)] 🏥 Women's Abortion Clinic in ...Abortion Pill Prices Boksburg [(+27832195400*)] 🏥 Women's Abortion Clinic in ...
Abortion Pill Prices Boksburg [(+27832195400*)] 🏥 Women's Abortion Clinic in ...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 

Kürzlich hochgeladen (20)

%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
Abortion Pill Prices Boksburg [(+27832195400*)] 🏥 Women's Abortion Clinic in ...
Abortion Pill Prices Boksburg [(+27832195400*)] 🏥 Women's Abortion Clinic in ...Abortion Pill Prices Boksburg [(+27832195400*)] 🏥 Women's Abortion Clinic in ...
Abortion Pill Prices Boksburg [(+27832195400*)] 🏥 Women's Abortion Clinic in ...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
WSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AIWSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AI
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 

Pipeline data path u3

  • 1. Five-stage Pipelined Datapath 1 Instruction memory Address 4 32 0 Add Add result Shift left 2 Instruction IF/ID EX/MEM MEM/WB M u x 0 1 Add PC 0 Write data M u x 1 Registers Read data 1 Read data 2 Read register 1 Read register 2 16 Sign extend Write register Write data Read data 1 ALU result M u x ALU Zero ID/EX Data memory Address Inst. Fetch Inst. Decode Exec Mem WB 02/08/2019 C.KARTHIKEYAN , AP/ECE
  • 2. Example for lw instruction: Instruction Fetch (IF) 2 Instruction memory Address 4 32 0 Add Add result Shift left 2 Instruction IF/ID EX/MEM MEM/WB M u x 0 1 Add PC 0 Write data M u x 1 Registers Read data1 Read data2 Read register 1 Read register 2 16 Sign extend Write register Write data Read data 1 ALU result M u x ALU Zero ID/EX Data memory Address Instruction fetch 02/08/2019 C.KARTHIKEYAN , AP/ECE
  • 3. Example for lw instruction: Instruction Decode (ID) 3 Instruction memory Address 4 32 0 Add Add result Shift left 2 Instruction IF/ID EX/MEM MEM/WB M u x 0 1 Add PC 0 Write data M u x 1 Registers Read data1 Read data2 Read register 1 Read register 2 16 Sign extend Write register Write data Read data 1 ALU result M u x ALU Zero ID/EX Data memory Address Instruction decode 02/08/2019 C.KARTHIKEYAN , AP/ECE
  • 4. Example for lw instruction: Execution (EX) 4 Instruction memory Address 4 32 0 Add Add result Shift left 2 Instruction IF/ID EX/MEM MEM/WB M u x 0 1 Add PC 0 Write data M u x 1 Registers Read data1 Read data2 Read register 1 Read register 2 16 Sign extend Write register Write data Read data 1 ALU result M u x ALU Zero ID/EX Data memory Address Execution 02/08/2019 C.KARTHIKEYAN , AP/ECE
  • 5. Example for lw instruction: Memory (MEM) 5 Instruction memory Address 4 32 0 Add Add result Shift left 2 Instruction IF/ID EX/MEM MEM/WB M u x 0 1 Add PC 0 Write data M u x 1 Registers Read data1 Read data2 Read register 1 Read register 2 16 Sign extend Write register Write data Read data 1 ALU result M u x ALU Zero ID/EX Data memory Address Memory 02/08/2019 C.KARTHIKEYAN , AP/ECE
  • 6. Example for lw instruction: Writeback (WB) 6 Instruction memory Address 4 32 0 Add Add result Shift left 2 Instruction IF/ID EX/MEM MEM/WB M u x 0 1 Add PC 0 Write data M u x 1 Registers Read data1 Read data2 Read register 1 Read register 2 16 Sign extend Write register Write data Read data 1 ALU result M u x ALU Zero ID/EX Data memory Address Writeback 02/08/2019 C.KARTHIKEYAN , AP/ECE
  • 7. Example for sw instruction: Memory (MEM) 7 Instruction memory Address 4 32 0 Add Add result Shift left 2 Instruction IF/ID EX/MEM MEM/WB M u x 0 1 Add PC 0 Write data M u x 1 Registers Read data1 Read data2 Read register 1 Read register 2 16 Sign extend Write register Write data Read data 1 ALU result M u x ALU Zero ID/EX Data memory Address Memory 02/08/2019 C.KARTHIKEYAN , AP/ECE
  • 8. Example for sw instruction: Writeback (WB): do nothing 8 Instruction memory Address 4 32 0 Add Add result Shift left 2 Instruction IF/ID EX/MEM MEM/WB M u x 0 1 Add PC 0 Write data M u x 1 Registers Read data1 Read data2 Read register 1 Read register 2 16 Sign extend Write register Write data Read data 1 ALU result M u x ALU Zero ID/EX Data memory Address Writeback 02/08/2019 C.KARTHIKEYAN , AP/ECE
  • 9. Datapath with Control 10 PC Instruction memory Instruction Add Instruction [20– 16] MemtoReg ALUOp Branch RegDst ALUSrc 4 16 32Instruction [15– 0] 0 0 M u x 0 1 Add Add result Registers Write register Write data Read data 1 Read data 2 Read register 1 Read register 2 Sign extend M u x 1 ALU result Zero Write data Read data M u x 1 ALU control Shift left 2RegWrite MemRead Control ALU Instruction [15– 11] 6 EX M WB M WB WB IF/ID PCSrc ID/EX EX/MEM MEM/WB M u x 0 1 MemWrite Address Data memory Address IF: lw $10, 8($1) 02/08/2019 C.KARTHIKEYAN , AP/ECE
  • 10. Datapath with Control 11 PC Instruction memory Instruction Add Instruction [20– 16] MemtoReg ALUOp Branch RegDst ALUSrc 4 16 32Instruction [15– 0] 0 0 M u x 0 1 Add Add result Registers Write register Write data Read data 1 Read data 2 Read register 1 Read register 2 Sign extend M u x 1 ALU result Zero Write data Read data M u x 1 ALU control Shift left 2RegWrite MemRead Control ALU Instruction [15– 11] 6 X M WB M WB WB IF/ID PCSrc ID/EX EX/MEM MEM/WB M u x 0 1 MemWrite Address Data memory Address IF: sub $11, $2, $3 ID: lw $10, 8($1) 01 00 000 E “lw” 02/08/2019 C.KARTHIKEYAN , AP/ECE
  • 11. Datapath with Control 12 PC Instruction memory Instruction Add Instruction [20– 16] MemtoReg ALUOp Branch RegDst ALUSrc 4 16 32Instruction [15– 0] 0 0 M u x 0 1 Add Add result Registers Write register Write data Read data 1 Read data 2 Read register 1 Read register 2 Sign extend M u x 1 ALU result Zero Write data Read data M u x 1 ALU control Shift left 2RegWrite MemRead Control ALU Instruction [15– 11] 6 X M WB M WB WB IF/ID PCSrc ID/EX EX/MEM MEM/WB M u x 0 1 MemWrite Address Data memory Address 11 010 00E ID: sub $11, $2, $3 EX: lw $10, 8($1)IF: and $12, $4, $5 1 0 10 000 1100 “sub” 02/08/2019 C.KARTHIKEYAN , AP/ECE
  • 12. Datapath with Control 13 PC Instruction memory Instruction Add Instruction [20– 16] MemtoReg ALUOp Branch RegDst ALUSrc 4 16 32Instruction [15– 0] 0 0 M u x 0 1 Add Add result Registers Write register Write data Read data 1 Read data 2 Read register 1 Read register 2 Sign extend M u x 1 ALU result Zero Write data Read data M u x 1 ALU control Shift left 2RegWrite MemRead Control ALU Instruction [15– 11] 6 X M WB M WB WB IF/ID PCSrc ID/EX EX/MEM MEM/WB M u x 0 1 MemWrite Address Data memory Address 10 000 10E EX: sub $11, $2, $3 MEM: lw $10, 8($1)ID: and $12, $4, $5 0 1 10 000 1100 IF: or $13, $6, $7 11 0 1 0 “and” 02/08/2019 C.KARTHIKEYAN , AP/ECE
  • 13. Datapath with Control 14 PC Instruction memory Instruction Add Instruction [20– 16] MemtoReg ALUOp Branch RegDst ALUSrc 4 16 32Instruction [15– 0] 0 0 M u x 0 1 Add Add result Registers Write register Write data Read data 1 Read data 2 Read register 1 Read register 2 Sign extend M u x 1 ALU result Zero Write data Read data M u x 1 ALU control Shift left 2RegWrite MemRead Control ALU Instruction [15– 11] 6 X M WB M WB WB IF/ID PCSrc ID/EX EX/MEM MEM/WB M u x 0 1 MemWrite Address Data memory Address 10 000 10E MEM: sub $11, .. WB: lw $10, 8($1) EX: and $12, $4, $5 0 1 10 000 1100 ID: or $13, $6, $7 10 0 0 0 “or” IF: add $14, $8, $9 1 1 02/08/2019 C.KARTHIKEYAN , AP/ECE
  • 14. Datapath with Control 15 PC Instruction memory Instruction Add Instruction [20– 16] MemtoReg ALUOp Branch RegDst ALUSrc 4 16 32Instruction [15– 0] 0 0 M u x 0 1 Add Add result Registers Write register Write data Read data 1 Read data 2 Read register 1 Read register 2 Sign extend M u x 1 ALU result Zero Write data Read data M u x 1 ALU control Shift left 2RegWrite MemRead Control ALU Instruction [15– 11] 6 X M WB M WB WB IF/ID PCSrc ID/EX EX/MEM MEM/WB M u x 0 1 MemWrite Address Data memory Address 10 000 10E WB: sub $11, ..MEM: and $12… 0 1 10 000 1100 EX: or $13, $6, $7 10 0 0 0 “add” ID: add $14, $8, $9 1 0 IF: xxxx 02/08/2019 C.KARTHIKEYAN , AP/ECE
  • 15. Datapath with Control 16 PC Instruction memory Instruction Add Instruction [20– 16] MemtoReg ALUOp Branch RegDst ALUSrc 4 16 32Instruction [15– 0] 0 0 M u x 0 1 Add Add result Registers Write register Write data Read data 1 Read data 2 Read register 1 Read register 2 Sign extend M u x 1 ALU result Zero Write data Read data M u x 1 ALU control Shift left 2RegWrite MemRead Control ALU Instruction [15– 11] 6 M WB WB IF/ID PCSrc EX/MEM MEM/WB M u x 0 1 MemWrite Address Data memory Address 10 000 10 WB: and $12… 0 1 MEM: or $13, .. 10 0 0 0 EX: add $14, $8, $9 1 0 IF: xxxx ID: xxxx X M WB ID/EX E 02/08/2019 C.KARTHIKEYAN , AP/ECE
  • 16. Datapath with Control 17 WB: or $13… PC Instruction memory Instruction Add Instruction [20– 16] MemtoReg ALUOp Branch RegDst ALUSrc 4 16 32Instruction [15– 0] 0 0 M u x 0 1 Add Add result Registers Write register Write data Read data 1 Read data 2 Read register 1 Read register 2 Sign extend M u x 1 ALU result Zero Write data Read data M u x 1 ALU control Shift left 2RegWrite MemRead Control ALU Instruction [15– 11] 6 M WB WB IF/ID PCSrc EX/MEM MEM/WB M u x 0 1 MemWrite Address Data memory Address MEM: add $14, .. 10 0 0 0 EX: xxxx 1 0 IF: xxxx ID: xxxx X M WB ID/EX E 02/08/2019 C.KARTHIKEYAN , AP/ECE
  • 17. Datapath with Control 18 PC Instruction memory Instruction Add Instruction [20– 16] MemtoReg ALUOp Branch RegDst ALUSrc 4 16 32Instruction [15– 0] 0 0 M u x 0 1 Add Add result Registers Write register Write data Read data 1 Read data 2 Read register 1 Read register 2 Sign extend M u x 1 ALU result Zero Write data Read data M u x 1 ALU control Shift left 2RegWrite MemRead Control ALU Instruction [15– 11] 6 M WB WB IF/ID PCSrc EX/MEM MEM/WB M u x 0 1 MemWrite Address Data memory Address WB: add $14..MEM: xxxxEX: xxxx 1 0 IF: xxxx ID: xxxx X M WB ID/EX E 02/08/2019 C.KARTHIKEYAN , AP/ECE
  • 18. Forwarding (operand selection) 19 ALU Data Memory Register File MUX ID/EX EX/MEM MEM/WB MUXMUX Forwarding Unit 02/08/2019 C.KARTHIKEYAN , AP/ECE
  • 19. Forwarding (operand propagation) 20 ALU Data Memory Register File MUX ID/EX EX/MEM MEM/WB MUXMUX Forwarding Unit Rt Rs MUX Rd Rt EX/MEM Rd MEM/WB Rd 02/08/2019 C.KARTHIKEYAN , AP/ECE
  • 20. Data Hazard Even with Forwarding 21 Time (clock cycles) lw r1, 0(r2) sub r4,r1,r6 and r6,r1,r7 or r8,r1,r9 Reg ALU DMemIfetch Reg Reg ALU DMemIfetch Reg Reg ALU DMemIfetch Reg Reg ALU DMemIfetch Reg Forward backward in time… no way!! (or way?) Instructionorder 02/08/2019 C.KARTHIKEYAN , AP/ECE
  • 21. Data Hazard Even with Forwarding 22 Time (clock cycles) or r8,r1,r9 lw r1, 0(r2) sub r4,r1,r6 and r6,r1,r7 Reg ALU DMemIfetch Reg RegIfetch ALU DMem RegBubble Ifetch ALU DMem RegBubble Reg Ifetch ALU DMemBubble Reg Need “pipeline interlock” (or stall) to stop instructions from issuing. How is this detected? Instructionorder 02/08/2019 C.KARTHIKEYAN , AP/ECE
  • 22. Hazard Detection Unit • Stall by letting an instruction that won’t write anything go forward • Stall the pipeline if ID/EX is a load, and (rt=IF/ID.rs or rt=IF/ID.rt) 23 PC Instruction memory Registers M u x M u x M u x Control ALU EX M WB M WB WB ID/EX EX/MEM MEM/WB Data memory M u x Hazard detection unit Forwarding unit 0 M u x IF/ID Instruction ID/EX.MemRead IF/IDWrite PCWrite ID/EX.RegisterRt IF/ID.RegisterRd IF/ID.RegisterRt IF/ID.RegisterRt IF/ID.RegisterRs Rt Rs Rd Rt EX/MEM.RegisterRd MEM/WB.RegisterRd 02/08/2019 C.KARTHIKEYAN , AP/ECE
  • 23. Code Rescheduling to Avoid Load Hazards Fast code: LW Rb,b LW Rc,c LW Re,e ADD Ra,Rb,Rc LW Rf,f SW a,Ra SUB Rd,Re,Rf SW d,Rd 24 Try producing fast code for a = b + c; d = e – f; assuming a, b, c, d ,e, and f in memory. Slow code: LW Rb,b LW Rc,c ADD Ra,Rb,Rc SW a,Ra LW Re,e LW Rf,f SUB Rd,Re,Rf SW d,Rd Compiler optimizes for performance. Hardware checks for safety. 02/08/2019 C.KARTHIKEYAN , AP/ECE