SlideShare una empresa de Scribd logo
1 de 29
PIPELINE HAZARDS
The events which leads to Pipeline stall by preventing the next instruction to
execute are known as Hazards.
1.Structural Hazard
2.Data Hazard
3.Control Hazard
Pipelined Data Path with
Control Signals
Structural Hazard
IF ID EX MEM WB
IF ID EX MEM WBlw $10,20($1)
IF ID EX MEM WB
IF ID EX MEM WB
1 2 3 4 5 6 7 8 9
CLOCK CYCLES
PROGRAMINSTRUCTIONS
Instruction 1
IF ID EX MEM WB
IF ID EX MEM WB
Instruction 2Instruction 3Instruction 4
sub $11,$2,$3
add $12,$3,$4
lw $13,24($1)
add $14,$5,$6
Pipeline Stall
Von Neumann Vs Harvard Architecture
Pipeline Hardware Resouces
DATA HAZARD
Data hazards occur when the pipeline get stalled because one step must wait for
another to complete.
Data Dependency
IF ID EX MEM WB
IF ID EX MEM WB
1 2 3 4 5 6 7 8
add $s0, $t0, $t1
sub $t2, $s0, $t3
Types of Data Hazard
There are three situations in which a data hazard can occur
Read After Write (RAW)
a true dependency
Write After Read (WAR)
an anti-dependency
write after write (WAW)
an output dependency
add $s0, $t0, $t1
sub $t2, $s0, $t3
add $s1, $t2, $t1
sub $t2, $s0, $t3
add $s1, $t2, $t1
sub $s1, $s0, $t3
How is to overcome Data Hazard?
1. Forwarding / Bypassing
Forwarding Unit to
overcome pipeline stall
Load-use Data hazard
lw $s0, 20($t1)
sub $t2, $s0, $t3
IF ID EX MEM WB
IF ID EX MEM WB
1 2 3 4 5 6 7 8
2. Pipeline Stall / Bubble
lw $s0, 20($t1)
NOP
sub $t2, $s0, $t3
NOP
3. Re-ordering the code
a = b + e;
c = b + f;
lw $t1, 0($t0)
lw $t2, 4($t0)
add $t3, $t1,$t2
sw $t3, 12($t0)
lw $t4, 8($t0)
add $t5, $t1,$t4
sw $t5, 16($t0)
lw $t1, 0($t0)
lw $t2, 4($t0)
add $t3, $t1,$t2
sw $t3, 12($t0)
lw $t4, 8($t0)
add $t5, $t1,$t4
sw $t5, 16($t0)
lw $t1, 0($t0)
lw $t2, 4($t0)
lw $t4, 8($t0)
add $t3, $t1,$t2
sw $t3, 12($t0)
add $t5, $t1,$t4
sw $t5, 16($t0)
Computer Organization and Design by David A Patterson – Page no. 361
I1: or r1,r2,r3
I2: or r2,r1,r4
I3: or r1,r1,r2
1. Indicate dependences and their type
Comparing I1 & I2
a. RAW on r1 – True Dependency
b. WAR on r2 – Anti - Dependency
Computer Organization and Design by David A Patterson – Page no. 361
I1: or r1,r2,r3
I2: or r2,r1,r4
I3: or r1,r1,r2
1. Indicate dependences and their type
Comparing I1 & I3
a. RAW on r1 – True Dependency
b. WAW on r1 – Output Dependency
Computer Organization and Design by David A Patterson – Page no. 361
I1: or r1,r2,r3
I2: or r2,r1,r4
I3: or r1,r1,r2
1. Indicate dependences and their type
Comparing I2 & I3
a. RAW on r2 – True Dependency
b. WAR on r1 – Anti- Dependency
Computer Organization and Design by David A Patterson – Page no. 361
I1: or r1,r2,r3
I2: or r2,r1,r4
I3: or r1,r1,r2
2. Assume there is no forwarding in this pipelined
processor. Indicate hazards and add NOP instructions
to eliminate them.
or r1,r2,r3
NOP
NOP
or r2,r1,r4
NOP
NOP
NOP
NOP
or r1,r1,r2
IF ID EX MEM WB
IF ID EX MEM WB
1 2 3 4 5 6 7 8 9 10 11
IF ID EX MEM WB
Computer Organization and Design by David A Patterson – Page no. 361
I1: or r1,r2,r3
I2: or r2,r1,r4
I3: or r1,r1,r2
3. Assume there is full forwarding. Indicate hazards and add
NOP instructions to eliminate them.
or r1,r2,r3
or r2,r1,r4
or r1,r1,r2
IF ID EX MEM WB
IF ID EX MEM WB
1 2 3 4 5 6 7
IF ID EX MEM WB
Control Hazard / Branch Hazard
control hazard arising from the need to make a decision based on the results
of one instruction while others are executing
beq $6,$7,7
sub $11,$2,$3
add $12,$3,$4
IF ID EX MEM WB
IF ID EX MEM
1 2 3 4 5 6 7
IF ID EX
Control Hazard / Branch Hazard
control hazard arising from the need to make a decision based on the results
of one instruction while others are executing
A control hazard is when we need to find destination of a branch, and can’t
fetch any new instruction until we know that destination
A branch is either
Taken : PC + 4 + Immediate address * 4
Not Taken : PC + 4
Penalty is 3 Clock Cycle
How to overcome Control Hazard?
1. Stall – Stop loading the instructions until the branch target is available
2. Prediction – Assume whether branch is taken or not and continue
fetching the instructions (Static Branch and Dynamic Branch Prediction)
3. Delayed Branch
Assume Branch is Not Taken
Static Prediction
FLUSH
Reducing the Delay of Branches
sub $11,$2,$3
beq $6,$7,7
add $12,$3,$4
IF ID EX MEM WB
IF ID EX MEM
1 2 3 4 5 6 7
IF ID EX
WB
MEM WB
Complication Factors
1. New forwarding unit is required
2. Data dependency from previous instruction
Dynamic Branch Prediction
Prediction of branches at run time using run time information
1.1-bit Prediction scheme
2.2-bit Prediction scheme
Dynamic Branch Prediction
1-bit Prediction scheme
Branch Prediction Buffer / Branch History Table (BHT)
- A small memory indexed by the lower portion of the address of the branch instruction
Prediction Bit
1 if Branch is taken previously
0 if Branch is not taken previously
Dynamic Branch Prediction
Disadvantage of 1-bit Prediction scheme
Even if a branch is almost taken always, there is a possibility to
predict it incorrectly twice, when the branch is not taken
Dynamic Branch Prediction
2-bit Prediction scheme
The prediction is changed
iff the branch is wrongly
predicted twice
Advanced Prediction Schemes
Correlation Predictor Tournament Predictor
A branch predictor that
combines local behavior of a
particular branch and global
information about the behavior
of some recent number of
executed branches.
A branch predictor with
multiple predictions for each
branch and a selection
mechanism that chooses
which predictor to enable for
a given branch

Más contenido relacionado

La actualidad más candente

Instruction pipeline: Computer Architecture
Instruction pipeline: Computer ArchitectureInstruction pipeline: Computer Architecture
Instruction pipeline: Computer ArchitectureInteX Research Lab
 
Cache memory
Cache memoryCache memory
Cache memoryAnuj Modi
 
Chapter 4 The Processor
Chapter 4 The ProcessorChapter 4 The Processor
Chapter 4 The Processorguest4f73554
 
Error Correction And Hamming Code Ibrar
Error Correction And Hamming Code IbrarError Correction And Hamming Code Ibrar
Error Correction And Hamming Code Ibraribrar562
 
Operating System Overview
Operating System OverviewOperating System Overview
Operating System OverviewAnas Ebrahim
 
Counters & time delay
Counters & time delayCounters & time delay
Counters & time delayHemant Chetwani
 
Assembly Language Basics
Assembly Language BasicsAssembly Language Basics
Assembly Language BasicsEducation Front
 
Micro programmed control
Micro programmed  controlMicro programmed  control
Micro programmed controlShashank Singh
 
Computer organization memory
Computer organization memoryComputer organization memory
Computer organization memoryDeepak John
 
Cache replacement policies,cache miss,writingtechniques
Cache replacement policies,cache miss,writingtechniquesCache replacement policies,cache miss,writingtechniques
Cache replacement policies,cache miss,writingtechniquesSnehalataAgasti
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OSvampugani
 

La actualidad más candente (20)

Instruction pipeline: Computer Architecture
Instruction pipeline: Computer ArchitectureInstruction pipeline: Computer Architecture
Instruction pipeline: Computer Architecture
 
ADDRESSING MODES
ADDRESSING MODESADDRESSING MODES
ADDRESSING MODES
 
Cache memory
Cache memoryCache memory
Cache memory
 
Deadlock
DeadlockDeadlock
Deadlock
 
Chapter 4 The Processor
Chapter 4 The ProcessorChapter 4 The Processor
Chapter 4 The Processor
 
Complete Operating System notes
Complete Operating System notesComplete Operating System notes
Complete Operating System notes
 
Error Correction And Hamming Code Ibrar
Error Correction And Hamming Code IbrarError Correction And Hamming Code Ibrar
Error Correction And Hamming Code Ibrar
 
Operating System Overview
Operating System OverviewOperating System Overview
Operating System Overview
 
viva q&a for mp lab
viva q&a for mp labviva q&a for mp lab
viva q&a for mp lab
 
Pthread
PthreadPthread
Pthread
 
Counters & time delay
Counters & time delayCounters & time delay
Counters & time delay
 
Assembly Language Basics
Assembly Language BasicsAssembly Language Basics
Assembly Language Basics
 
Instruction Pipelining
Instruction PipeliningInstruction Pipelining
Instruction Pipelining
 
Micro programmed control
Micro programmed  controlMicro programmed  control
Micro programmed control
 
DMA operation
DMA operationDMA operation
DMA operation
 
Hamming codes
Hamming codesHamming codes
Hamming codes
 
Computer organization memory
Computer organization memoryComputer organization memory
Computer organization memory
 
Ch12 microprocessor interrupts
Ch12 microprocessor interruptsCh12 microprocessor interrupts
Ch12 microprocessor interrupts
 
Cache replacement policies,cache miss,writingtechniques
Cache replacement policies,cache miss,writingtechniquesCache replacement policies,cache miss,writingtechniques
Cache replacement policies,cache miss,writingtechniques
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
 

Similar a Pipeline hazards | Structural Hazard, Data Hazard & Control Hazard

4. Pipeline Hazards.pptx
4. Pipeline Hazards.pptx4. Pipeline Hazards.pptx
4. Pipeline Hazards.pptxKarthikeyanC53
 
Losing Data in a Safe Way – Advanced Replication Strategies in Apache Hadoop ...
Losing Data in a Safe Way – Advanced Replication Strategies in Apache Hadoop ...Losing Data in a Safe Way – Advanced Replication Strategies in Apache Hadoop ...
Losing Data in a Safe Way – Advanced Replication Strategies in Apache Hadoop ...DataWorks Summit
 
Implementation of pipelining in datapath
Implementation of pipelining in datapathImplementation of pipelining in datapath
Implementation of pipelining in datapathbabuece
 
Lec19 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Pr...
Lec19 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Pr...Lec19 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Pr...
Lec19 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Pr...Hsien-Hsin Sean Lee, Ph.D.
 
pipeline and vector processing
pipeline and vector processingpipeline and vector processing
pipeline and vector processingAcad
 
Chapter 2 Part2 C
Chapter 2 Part2 CChapter 2 Part2 C
Chapter 2 Part2 Cececourse
 
ICSE2013
ICSE2013ICSE2013
ICSE2013swy351
 
Big Data & NoSQL - EFS'11 (Pavlo Baron)
Big Data & NoSQL - EFS'11 (Pavlo Baron)Big Data & NoSQL - EFS'11 (Pavlo Baron)
Big Data & NoSQL - EFS'11 (Pavlo Baron)Pavlo Baron
 
What is in All of Those SSTable Files Not Just the Data One but All the Rest ...
What is in All of Those SSTable Files Not Just the Data One but All the Rest ...What is in All of Those SSTable Files Not Just the Data One but All the Rest ...
What is in All of Those SSTable Files Not Just the Data One but All the Rest ...DataStax
 
3. Implementation of Pipelining in Datapath.pptx
3. Implementation of Pipelining in Datapath.pptx3. Implementation of Pipelining in Datapath.pptx
3. Implementation of Pipelining in Datapath.pptxKarthikeyanC53
 
Call Execute For Everyone
Call Execute For EveryoneCall Execute For Everyone
Call Execute For EveryoneDaniel Boisvert
 
23_Advanced_Processors controller system
23_Advanced_Processors controller system23_Advanced_Processors controller system
23_Advanced_Processors controller systemstellan7
 
Error Control in Multimedia Communications using Wireless Sensor Networks report
Error Control in Multimedia Communications using Wireless Sensor Networks reportError Control in Multimedia Communications using Wireless Sensor Networks report
Error Control in Multimedia Communications using Wireless Sensor Networks reportMuragesh Kabbinakantimath
 
Ccnp3 lab 3_1_en (hacer)
Ccnp3 lab 3_1_en (hacer)Ccnp3 lab 3_1_en (hacer)
Ccnp3 lab 3_1_en (hacer)Omar Herrera
 
Instruction Level Parallelism – Compiler Techniques
Instruction Level Parallelism – Compiler TechniquesInstruction Level Parallelism – Compiler Techniques
Instruction Level Parallelism – Compiler TechniquesDilum Bandara
 
DRP for Big Data - Stream Processing Architectures
DRP for Big Data - Stream Processing ArchitecturesDRP for Big Data - Stream Processing Architectures
DRP for Big Data - Stream Processing ArchitecturesMohamed Mehdi Ben Aissa
 
High Performance Computer Architecture
High Performance Computer ArchitectureHigh Performance Computer Architecture
High Performance Computer ArchitectureSubhasis Dash
 
DPDK & Layer 4 Packet Processing
DPDK & Layer 4 Packet ProcessingDPDK & Layer 4 Packet Processing
DPDK & Layer 4 Packet ProcessingMichelle Holley
 

Similar a Pipeline hazards | Structural Hazard, Data Hazard & Control Hazard (20)

4. Pipeline Hazards.pptx
4. Pipeline Hazards.pptx4. Pipeline Hazards.pptx
4. Pipeline Hazards.pptx
 
Losing Data in a Safe Way – Advanced Replication Strategies in Apache Hadoop ...
Losing Data in a Safe Way – Advanced Replication Strategies in Apache Hadoop ...Losing Data in a Safe Way – Advanced Replication Strategies in Apache Hadoop ...
Losing Data in a Safe Way – Advanced Replication Strategies in Apache Hadoop ...
 
L12-Forwarding.ppt
L12-Forwarding.pptL12-Forwarding.ppt
L12-Forwarding.ppt
 
Implementation of pipelining in datapath
Implementation of pipelining in datapathImplementation of pipelining in datapath
Implementation of pipelining in datapath
 
Lec19 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Pr...
Lec19 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Pr...Lec19 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Pr...
Lec19 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Pr...
 
pipeline and vector processing
pipeline and vector processingpipeline and vector processing
pipeline and vector processing
 
Chapter 2 Part2 C
Chapter 2 Part2 CChapter 2 Part2 C
Chapter 2 Part2 C
 
ICSE2013
ICSE2013ICSE2013
ICSE2013
 
Big Data & NoSQL - EFS'11 (Pavlo Baron)
Big Data & NoSQL - EFS'11 (Pavlo Baron)Big Data & NoSQL - EFS'11 (Pavlo Baron)
Big Data & NoSQL - EFS'11 (Pavlo Baron)
 
What is in All of Those SSTable Files Not Just the Data One but All the Rest ...
What is in All of Those SSTable Files Not Just the Data One but All the Rest ...What is in All of Those SSTable Files Not Just the Data One but All the Rest ...
What is in All of Those SSTable Files Not Just the Data One but All the Rest ...
 
3. Implementation of Pipelining in Datapath.pptx
3. Implementation of Pipelining in Datapath.pptx3. Implementation of Pipelining in Datapath.pptx
3. Implementation of Pipelining in Datapath.pptx
 
Call Execute For Everyone
Call Execute For EveryoneCall Execute For Everyone
Call Execute For Everyone
 
23_Advanced_Processors controller system
23_Advanced_Processors controller system23_Advanced_Processors controller system
23_Advanced_Processors controller system
 
Error Control in Multimedia Communications using Wireless Sensor Networks report
Error Control in Multimedia Communications using Wireless Sensor Networks reportError Control in Multimedia Communications using Wireless Sensor Networks report
Error Control in Multimedia Communications using Wireless Sensor Networks report
 
Talk About Performance
Talk About PerformanceTalk About Performance
Talk About Performance
 
Ccnp3 lab 3_1_en (hacer)
Ccnp3 lab 3_1_en (hacer)Ccnp3 lab 3_1_en (hacer)
Ccnp3 lab 3_1_en (hacer)
 
Instruction Level Parallelism – Compiler Techniques
Instruction Level Parallelism – Compiler TechniquesInstruction Level Parallelism – Compiler Techniques
Instruction Level Parallelism – Compiler Techniques
 
DRP for Big Data - Stream Processing Architectures
DRP for Big Data - Stream Processing ArchitecturesDRP for Big Data - Stream Processing Architectures
DRP for Big Data - Stream Processing Architectures
 
High Performance Computer Architecture
High Performance Computer ArchitectureHigh Performance Computer Architecture
High Performance Computer Architecture
 
DPDK & Layer 4 Packet Processing
DPDK & Layer 4 Packet ProcessingDPDK & Layer 4 Packet Processing
DPDK & Layer 4 Packet Processing
 

Más de babuece

Hardware Multi-Threading
Hardware Multi-ThreadingHardware Multi-Threading
Hardware Multi-Threadingbabuece
 
Introduction to Advance Computer Architecture
Introduction to Advance Computer ArchitectureIntroduction to Advance Computer Architecture
Introduction to Advance Computer Architecturebabuece
 
Clusters and Wharehouse Scale Computers
Clusters and Wharehouse Scale ComputersClusters and Wharehouse Scale Computers
Clusters and Wharehouse Scale Computersbabuece
 
Introduction to GPU
Introduction to GPUIntroduction to GPU
Introduction to GPUbabuece
 
Shared Memory Multi Processor
Shared Memory Multi ProcessorShared Memory Multi Processor
Shared Memory Multi Processorbabuece
 
Instruction Level Parallelism | Static Multiple Issue & Dynamic Multiple Issu...
Instruction Level Parallelism | Static Multiple Issue & Dynamic Multiple Issu...Instruction Level Parallelism | Static Multiple Issue & Dynamic Multiple Issu...
Instruction Level Parallelism | Static Multiple Issue & Dynamic Multiple Issu...babuece
 
Exception | How Exceptions are Handled in MIPS architecture
Exception | How Exceptions are Handled in MIPS architectureException | How Exceptions are Handled in MIPS architecture
Exception | How Exceptions are Handled in MIPS architecturebabuece
 
Introduction to Embedded Laboratory EC 8711
Introduction to Embedded Laboratory EC 8711 Introduction to Embedded Laboratory EC 8711
Introduction to Embedded Laboratory EC 8711 babuece
 
Datapath design with control unit
Datapath design with control unitDatapath design with control unit
Datapath design with control unitbabuece
 
Introduction to datapath design
Introduction to datapath designIntroduction to datapath design
Introduction to datapath designbabuece
 
Floating point Binary Represenataion
Floating point Binary RepresenataionFloating point Binary Represenataion
Floating point Binary Represenataionbabuece
 
Introduction to floating point Arithmetic
Introduction to floating point ArithmeticIntroduction to floating point Arithmetic
Introduction to floating point Arithmeticbabuece
 
Improved version of division
Improved version of divisionImproved version of division
Improved version of divisionbabuece
 
Booth's algorithm part 3
Booth's algorithm part 3Booth's algorithm part 3
Booth's algorithm part 3babuece
 
Booth's algorithm part 1
Booth's algorithm part 1Booth's algorithm part 1
Booth's algorithm part 1babuece
 
Modified booths algorithm part 1
Modified booths algorithm part 1Modified booths algorithm part 1
Modified booths algorithm part 1babuece
 
Booth's algorithm part 2
Booth's algorithm part 2Booth's algorithm part 2
Booth's algorithm part 2babuece
 
Booth's algorithm part 4
Booth's algorithm part 4Booth's algorithm part 4
Booth's algorithm part 4babuece
 
Modified booth's algorithm Part 2
Modified booth's algorithm Part 2Modified booth's algorithm Part 2
Modified booth's algorithm Part 2babuece
 
Sequential Version / Version 1 Unsigned Multiplication Algorithm
Sequential Version / Version 1 Unsigned Multiplication AlgorithmSequential Version / Version 1 Unsigned Multiplication Algorithm
Sequential Version / Version 1 Unsigned Multiplication Algorithmbabuece
 

Más de babuece (20)

Hardware Multi-Threading
Hardware Multi-ThreadingHardware Multi-Threading
Hardware Multi-Threading
 
Introduction to Advance Computer Architecture
Introduction to Advance Computer ArchitectureIntroduction to Advance Computer Architecture
Introduction to Advance Computer Architecture
 
Clusters and Wharehouse Scale Computers
Clusters and Wharehouse Scale ComputersClusters and Wharehouse Scale Computers
Clusters and Wharehouse Scale Computers
 
Introduction to GPU
Introduction to GPUIntroduction to GPU
Introduction to GPU
 
Shared Memory Multi Processor
Shared Memory Multi ProcessorShared Memory Multi Processor
Shared Memory Multi Processor
 
Instruction Level Parallelism | Static Multiple Issue & Dynamic Multiple Issu...
Instruction Level Parallelism | Static Multiple Issue & Dynamic Multiple Issu...Instruction Level Parallelism | Static Multiple Issue & Dynamic Multiple Issu...
Instruction Level Parallelism | Static Multiple Issue & Dynamic Multiple Issu...
 
Exception | How Exceptions are Handled in MIPS architecture
Exception | How Exceptions are Handled in MIPS architectureException | How Exceptions are Handled in MIPS architecture
Exception | How Exceptions are Handled in MIPS architecture
 
Introduction to Embedded Laboratory EC 8711
Introduction to Embedded Laboratory EC 8711 Introduction to Embedded Laboratory EC 8711
Introduction to Embedded Laboratory EC 8711
 
Datapath design with control unit
Datapath design with control unitDatapath design with control unit
Datapath design with control unit
 
Introduction to datapath design
Introduction to datapath designIntroduction to datapath design
Introduction to datapath design
 
Floating point Binary Represenataion
Floating point Binary RepresenataionFloating point Binary Represenataion
Floating point Binary Represenataion
 
Introduction to floating point Arithmetic
Introduction to floating point ArithmeticIntroduction to floating point Arithmetic
Introduction to floating point Arithmetic
 
Improved version of division
Improved version of divisionImproved version of division
Improved version of division
 
Booth's algorithm part 3
Booth's algorithm part 3Booth's algorithm part 3
Booth's algorithm part 3
 
Booth's algorithm part 1
Booth's algorithm part 1Booth's algorithm part 1
Booth's algorithm part 1
 
Modified booths algorithm part 1
Modified booths algorithm part 1Modified booths algorithm part 1
Modified booths algorithm part 1
 
Booth's algorithm part 2
Booth's algorithm part 2Booth's algorithm part 2
Booth's algorithm part 2
 
Booth's algorithm part 4
Booth's algorithm part 4Booth's algorithm part 4
Booth's algorithm part 4
 
Modified booth's algorithm Part 2
Modified booth's algorithm Part 2Modified booth's algorithm Part 2
Modified booth's algorithm Part 2
 
Sequential Version / Version 1 Unsigned Multiplication Algorithm
Sequential Version / Version 1 Unsigned Multiplication AlgorithmSequential Version / Version 1 Unsigned Multiplication Algorithm
Sequential Version / Version 1 Unsigned Multiplication Algorithm
 

Último

Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 

Último (20)

Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 

Pipeline hazards | Structural Hazard, Data Hazard & Control Hazard

  • 1. PIPELINE HAZARDS The events which leads to Pipeline stall by preventing the next instruction to execute are known as Hazards. 1.Structural Hazard 2.Data Hazard 3.Control Hazard
  • 2. Pipelined Data Path with Control Signals
  • 3. Structural Hazard IF ID EX MEM WB IF ID EX MEM WBlw $10,20($1) IF ID EX MEM WB IF ID EX MEM WB 1 2 3 4 5 6 7 8 9 CLOCK CYCLES PROGRAMINSTRUCTIONS Instruction 1 IF ID EX MEM WB IF ID EX MEM WB Instruction 2Instruction 3Instruction 4 sub $11,$2,$3 add $12,$3,$4 lw $13,24($1) add $14,$5,$6
  • 5. Von Neumann Vs Harvard Architecture Pipeline Hardware Resouces
  • 6. DATA HAZARD Data hazards occur when the pipeline get stalled because one step must wait for another to complete. Data Dependency IF ID EX MEM WB IF ID EX MEM WB 1 2 3 4 5 6 7 8 add $s0, $t0, $t1 sub $t2, $s0, $t3
  • 7. Types of Data Hazard There are three situations in which a data hazard can occur Read After Write (RAW) a true dependency Write After Read (WAR) an anti-dependency write after write (WAW) an output dependency add $s0, $t0, $t1 sub $t2, $s0, $t3 add $s1, $t2, $t1 sub $t2, $s0, $t3 add $s1, $t2, $t1 sub $s1, $s0, $t3
  • 8. How is to overcome Data Hazard? 1. Forwarding / Bypassing
  • 9.
  • 10.
  • 11. Forwarding Unit to overcome pipeline stall
  • 12. Load-use Data hazard lw $s0, 20($t1) sub $t2, $s0, $t3 IF ID EX MEM WB IF ID EX MEM WB 1 2 3 4 5 6 7 8 2. Pipeline Stall / Bubble lw $s0, 20($t1) NOP sub $t2, $s0, $t3 NOP
  • 13. 3. Re-ordering the code a = b + e; c = b + f; lw $t1, 0($t0) lw $t2, 4($t0) add $t3, $t1,$t2 sw $t3, 12($t0) lw $t4, 8($t0) add $t5, $t1,$t4 sw $t5, 16($t0) lw $t1, 0($t0) lw $t2, 4($t0) add $t3, $t1,$t2 sw $t3, 12($t0) lw $t4, 8($t0) add $t5, $t1,$t4 sw $t5, 16($t0) lw $t1, 0($t0) lw $t2, 4($t0) lw $t4, 8($t0) add $t3, $t1,$t2 sw $t3, 12($t0) add $t5, $t1,$t4 sw $t5, 16($t0)
  • 14. Computer Organization and Design by David A Patterson – Page no. 361 I1: or r1,r2,r3 I2: or r2,r1,r4 I3: or r1,r1,r2 1. Indicate dependences and their type Comparing I1 & I2 a. RAW on r1 – True Dependency b. WAR on r2 – Anti - Dependency
  • 15. Computer Organization and Design by David A Patterson – Page no. 361 I1: or r1,r2,r3 I2: or r2,r1,r4 I3: or r1,r1,r2 1. Indicate dependences and their type Comparing I1 & I3 a. RAW on r1 – True Dependency b. WAW on r1 – Output Dependency
  • 16. Computer Organization and Design by David A Patterson – Page no. 361 I1: or r1,r2,r3 I2: or r2,r1,r4 I3: or r1,r1,r2 1. Indicate dependences and their type Comparing I2 & I3 a. RAW on r2 – True Dependency b. WAR on r1 – Anti- Dependency
  • 17. Computer Organization and Design by David A Patterson – Page no. 361 I1: or r1,r2,r3 I2: or r2,r1,r4 I3: or r1,r1,r2 2. Assume there is no forwarding in this pipelined processor. Indicate hazards and add NOP instructions to eliminate them. or r1,r2,r3 NOP NOP or r2,r1,r4 NOP NOP NOP NOP or r1,r1,r2 IF ID EX MEM WB IF ID EX MEM WB 1 2 3 4 5 6 7 8 9 10 11 IF ID EX MEM WB
  • 18. Computer Organization and Design by David A Patterson – Page no. 361 I1: or r1,r2,r3 I2: or r2,r1,r4 I3: or r1,r1,r2 3. Assume there is full forwarding. Indicate hazards and add NOP instructions to eliminate them. or r1,r2,r3 or r2,r1,r4 or r1,r1,r2 IF ID EX MEM WB IF ID EX MEM WB 1 2 3 4 5 6 7 IF ID EX MEM WB
  • 19. Control Hazard / Branch Hazard control hazard arising from the need to make a decision based on the results of one instruction while others are executing beq $6,$7,7 sub $11,$2,$3 add $12,$3,$4 IF ID EX MEM WB IF ID EX MEM 1 2 3 4 5 6 7 IF ID EX
  • 20. Control Hazard / Branch Hazard control hazard arising from the need to make a decision based on the results of one instruction while others are executing A control hazard is when we need to find destination of a branch, and can’t fetch any new instruction until we know that destination A branch is either Taken : PC + 4 + Immediate address * 4 Not Taken : PC + 4
  • 21. Penalty is 3 Clock Cycle
  • 22. How to overcome Control Hazard? 1. Stall – Stop loading the instructions until the branch target is available 2. Prediction – Assume whether branch is taken or not and continue fetching the instructions (Static Branch and Dynamic Branch Prediction) 3. Delayed Branch
  • 23. Assume Branch is Not Taken Static Prediction FLUSH
  • 24. Reducing the Delay of Branches sub $11,$2,$3 beq $6,$7,7 add $12,$3,$4 IF ID EX MEM WB IF ID EX MEM 1 2 3 4 5 6 7 IF ID EX WB MEM WB Complication Factors 1. New forwarding unit is required 2. Data dependency from previous instruction
  • 25. Dynamic Branch Prediction Prediction of branches at run time using run time information 1.1-bit Prediction scheme 2.2-bit Prediction scheme
  • 26. Dynamic Branch Prediction 1-bit Prediction scheme Branch Prediction Buffer / Branch History Table (BHT) - A small memory indexed by the lower portion of the address of the branch instruction Prediction Bit 1 if Branch is taken previously 0 if Branch is not taken previously
  • 27. Dynamic Branch Prediction Disadvantage of 1-bit Prediction scheme Even if a branch is almost taken always, there is a possibility to predict it incorrectly twice, when the branch is not taken
  • 28. Dynamic Branch Prediction 2-bit Prediction scheme The prediction is changed iff the branch is wrongly predicted twice
  • 29. Advanced Prediction Schemes Correlation Predictor Tournament Predictor A branch predictor that combines local behavior of a particular branch and global information about the behavior of some recent number of executed branches. A branch predictor with multiple predictions for each branch and a selection mechanism that chooses which predictor to enable for a given branch