SlideShare a Scribd company logo
1 of 27
Afjal Hossain | Emran
Hossain
Raihan Mahmud| Rejuanul
Haque
Toriqul Islam
Department of Software
Instruction Pipelining
SWE-311
Pipelining
 A technique used in advanced
microprocessors where the microprocessor
begins executing a second instruction before
the first has been completed.
2
Two Stage Instruction Pipeline
3
Six Stage Instruction Pipeline
4
Six Stage Instruction Pipeline
 Fetch Instruction (FI): Read the next expected
introduction into a buffer
 Decode Instruction (DI): Determine the opcode and the
operand specifiers
 Calculate Operands (CO): Calculate the effective address
of each source operand. This may involve displacement,
register indirect, indirect or other forms of address
calculations.
 Fetch Operands (FO): Fetch each operand from memory.
Operands in register need not be fetched.
 Execute Instruction (EI): Perform the indicated operation
and store the result, if any, in the specified destination
operand location.
 Write Operand (WO): Store result in memory5
Types of hazards
6
Resource Data Control
HAZARD
Resource Hazards
 Two (or more) instructions in pipeline need
same resource
 Executed in serial rather than parallel for part
of pipeline
 Also called structural hazard
 E.g. Assume simplified five-stage pipeline
 Each stage takes one clock cycle
 Ideal case is new instruction enters pipeline
each clock cycle
 Assume main memory has single ports
7
Data Hazards
 Attempt to use item before it is ready
 Instruction depends on result of prior
instruction still in the pipeline
8
Types of Data Hazard
9
RAW WAR WAW
DATA
HAZARD
Read After Write (RAW)
 It is also known as True dependency
 An instruction modifies a register or memory
location
 Hazard if read takes place before write
complete
 B tries to read a register before A has written
10
Write After Read (WAR)
 It is also known as Anti dependency
 An instruction reads a register or memory
location
 Hazard if write completes before read takes
place
 B tries to write a register before A has read it
 In this case, A uses the new (incorrect) value
11
Write After Write (WAW)
 It is also known as Output dependency
 Two instructions both write to same location
 Hazard if writes take place in reverse of order
intended sequence
 B tries to write an operand before A has
written it
 After instruction B has executed, the value of
the register should be B's result, but A's result12
Control Hazard
 Instructions that disrupt the sequential flow of
control present problems for pipelines.
 Also known as branch hazard
 Control hazards occur because the PC
following a control instruction is not known
until control instruction computes if branch
should be taken or not.
13
14
Types of Control hazards
o Unconditional branches
o Conditional branches
o Indirect branches
o Procedure calls
o Procedure returns
15
Dealing with Branches
 Multiple Streams
 Prefetch Branch Target
 Loop buffer
 Branch prediction
 Delayed branching
16
Solutions for Control Hazards
 Pipeline stall cycles
 Branch delay slots
 Branch prediction
 Indirect branch prediction
 Return address stack (RAS)
17
Multiple Streams
 Have two pipelines
 Prefetch each branch into a separate pipeline
 Use appropriate pipeline
 Leads to bus & register contention
 Multiple branches lead to further pipelines
being needed
18
Prefetch Branch Target
 Target of branch is prefetched in addition to
instructions following branch
 Keep target until branch is executed
 Used by IBM 360/91
19
Loop Buffer
 Very fast memory
 Maintained by fetch stage of pipeline
 Check buffer before fetching from memory
 Very good for small loops or jumps
 Used by CRAY-1
20
Loop Buffer Diagram
21
Prediction
 Easy to fetch multiple (consecutive)
instructions per cycle
 Essentially speculating on sequential flow
 Jump: unconditional change of control flow
 Always taken
 Branch: conditional change of control flow
 Taken typically ~50% of the time in applications
 Backward: 30% of the Branch  80% taken = ~24%
 Forward: 70% of the Branch  40% taken = ~28%
22
What is Branch Prediction
 In a computer architecture, a branch predictor
is a digital circuit that tries to guess which way
a branch. Will go before this is known
definitively. The purpose of the branch
predictor is to improve the flow in the
instruction pipeline.
23
Branch Prediction Techniques
 Static Branch Prediction
 Some branch instructions predicted as taken and
others as not taken
 End or program loop
 Beginning of program loop
 Hardware or compiler
 Dynamic Branch Prediction
 Bitmap for Lower bits of PC address
 Says whether or not branch taken last time
 If Instr is Branch, predict and update the table
24
 Predict by Opcode
 Some instructions are more likely to result in a jump
than theirs
 Can get up to 75% success
 Taken/Not taken switch
 Based on previous history
 Good for loops
 Refined by two-level or correlation-based branch
history
25
Branch Prediction Flowchart
26
27
Thank You !!!
Any Questions
???

More Related Content

What's hot

Pipelining
PipeliningPipelining
PipeliningAmin Omi
 
Pipelining , structural hazards
Pipelining , structural hazardsPipelining , structural hazards
Pipelining , structural hazardsMunaam Munawar
 
Control Unit Design
Control Unit DesignControl Unit Design
Control Unit DesignVinit Raut
 
Register Reference Instructions | Computer Science
Register Reference Instructions | Computer ScienceRegister Reference Instructions | Computer Science
Register Reference Instructions | Computer ScienceTransweb Global Inc
 
8086 microprocessor-architecture
8086 microprocessor-architecture8086 microprocessor-architecture
8086 microprocessor-architectureprasadpawaskar
 
Computer instructions
Computer instructionsComputer instructions
Computer instructionsAnuj Modi
 
Input Output - Computer Architecture
Input Output - Computer ArchitectureInput Output - Computer Architecture
Input Output - Computer ArchitectureMaruf Abdullah (Rion)
 
Dma transfer
Dma transferDma transfer
Dma transfergmnithya
 
Memory Reference Instructions
Memory Reference InstructionsMemory Reference Instructions
Memory Reference InstructionsRabin BK
 
Program control instructions
Program control instructionsProgram control instructions
Program control instructionsDr. Girish GS
 
Memory organization (Computer architecture)
Memory organization (Computer architecture)Memory organization (Computer architecture)
Memory organization (Computer architecture)Sandesh Jonchhe
 
Computer organization memory
Computer organization memoryComputer organization memory
Computer organization memoryDeepak John
 
Context Switching
Context SwitchingContext Switching
Context Switchingfranksvalli
 

What's hot (20)

Pipelining
PipeliningPipelining
Pipelining
 
Pipelining , structural hazards
Pipelining , structural hazardsPipelining , structural hazards
Pipelining , structural hazards
 
Control Unit Design
Control Unit DesignControl Unit Design
Control Unit Design
 
Register Reference Instructions | Computer Science
Register Reference Instructions | Computer ScienceRegister Reference Instructions | Computer Science
Register Reference Instructions | Computer Science
 
design of accumlator
design of accumlatordesign of accumlator
design of accumlator
 
pipelining
pipeliningpipelining
pipelining
 
Instruction pipelining
Instruction pipeliningInstruction pipelining
Instruction pipelining
 
8086 microprocessor-architecture
8086 microprocessor-architecture8086 microprocessor-architecture
8086 microprocessor-architecture
 
Computer arithmetic
Computer arithmeticComputer arithmetic
Computer arithmetic
 
Computer instructions
Computer instructionsComputer instructions
Computer instructions
 
Input Output - Computer Architecture
Input Output - Computer ArchitectureInput Output - Computer Architecture
Input Output - Computer Architecture
 
Dma transfer
Dma transferDma transfer
Dma transfer
 
Instruction format
Instruction formatInstruction format
Instruction format
 
Microprogrammed Control Unit
Microprogrammed Control UnitMicroprogrammed Control Unit
Microprogrammed Control Unit
 
Memory Reference Instructions
Memory Reference InstructionsMemory Reference Instructions
Memory Reference Instructions
 
Program control instructions
Program control instructionsProgram control instructions
Program control instructions
 
Memory organization (Computer architecture)
Memory organization (Computer architecture)Memory organization (Computer architecture)
Memory organization (Computer architecture)
 
Computer organization memory
Computer organization memoryComputer organization memory
Computer organization memory
 
Pipelining
PipeliningPipelining
Pipelining
 
Context Switching
Context SwitchingContext Switching
Context Switching
 

Similar to Instruction Pipelining

Chapter 7 cpu struktur dan fungsi
Chapter 7 cpu struktur dan fungsiChapter 7 cpu struktur dan fungsi
Chapter 7 cpu struktur dan fungsirisal07
 
CPU Pipelining and Hazards - An Introduction
CPU Pipelining and Hazards - An IntroductionCPU Pipelining and Hazards - An Introduction
CPU Pipelining and Hazards - An IntroductionDilum Bandara
 
Pipeline hazard
Pipeline hazardPipeline hazard
Pipeline hazardAJAL A J
 
Control hazards MIPS pipeline.pptx
Control hazards MIPS pipeline.pptxControl hazards MIPS pipeline.pptx
Control hazards MIPS pipeline.pptxIrfan Anjum
 
Instruction Level Parallelism – Compiler Techniques
Instruction Level Parallelism – Compiler TechniquesInstruction Level Parallelism – Compiler Techniques
Instruction Level Parallelism – Compiler TechniquesDilum Bandara
 
CPU Structure and Function.pptx
CPU Structure and Function.pptxCPU Structure and Function.pptx
CPU Structure and Function.pptxnagargorv
 
Microcontroladores: introducción a la programación en lenguaje ensamblador AVR
Microcontroladores: introducción a la programación en lenguaje ensamblador AVRMicrocontroladores: introducción a la programación en lenguaje ensamblador AVR
Microcontroladores: introducción a la programación en lenguaje ensamblador AVRSANTIAGO PABLO ALBERTO
 
embedded system and computer architecure
embedded system and computer architecureembedded system and computer architecure
embedded system and computer architecuremadhulbtech23
 
multi cycle in microprocessor 8086 sy B-tech
multi cycle  in microprocessor 8086 sy B-techmulti cycle  in microprocessor 8086 sy B-tech
multi cycle in microprocessor 8086 sy B-techRushikeshThorat24
 
Advanced Pipelining in ARM Processors.pptx
Advanced Pipelining  in ARM Processors.pptxAdvanced Pipelining  in ARM Processors.pptx
Advanced Pipelining in ARM Processors.pptxJoyChowdhury30
 

Similar to Instruction Pipelining (20)

Chapter 7 cpu struktur dan fungsi
Chapter 7 cpu struktur dan fungsiChapter 7 cpu struktur dan fungsi
Chapter 7 cpu struktur dan fungsi
 
CPU Pipelining and Hazards - An Introduction
CPU Pipelining and Hazards - An IntroductionCPU Pipelining and Hazards - An Introduction
CPU Pipelining and Hazards - An Introduction
 
Pipeline hazard
Pipeline hazardPipeline hazard
Pipeline hazard
 
pipelining
pipeliningpipelining
pipelining
 
Assembly p1
Assembly p1Assembly p1
Assembly p1
 
Bc0040
Bc0040Bc0040
Bc0040
 
Conditional branches
Conditional branchesConditional branches
Conditional branches
 
Control hazards MIPS pipeline.pptx
Control hazards MIPS pipeline.pptxControl hazards MIPS pipeline.pptx
Control hazards MIPS pipeline.pptx
 
Online Architecture Assignment Help
Online Architecture Assignment HelpOnline Architecture Assignment Help
Online Architecture Assignment Help
 
Instruction Level Parallelism – Compiler Techniques
Instruction Level Parallelism – Compiler TechniquesInstruction Level Parallelism – Compiler Techniques
Instruction Level Parallelism – Compiler Techniques
 
CPU Structure and Function.pptx
CPU Structure and Function.pptxCPU Structure and Function.pptx
CPU Structure and Function.pptx
 
Chapter 4
Chapter 4Chapter 4
Chapter 4
 
Microcontroladores: introducción a la programación en lenguaje ensamblador AVR
Microcontroladores: introducción a la programación en lenguaje ensamblador AVRMicrocontroladores: introducción a la programación en lenguaje ensamblador AVR
Microcontroladores: introducción a la programación en lenguaje ensamblador AVR
 
Arm11
Arm11Arm11
Arm11
 
3.3
3.33.3
3.3
 
embedded system and computer architecure
embedded system and computer architecureembedded system and computer architecure
embedded system and computer architecure
 
multi cycle in microprocessor 8086 sy B-tech
multi cycle  in microprocessor 8086 sy B-techmulti cycle  in microprocessor 8086 sy B-tech
multi cycle in microprocessor 8086 sy B-tech
 
Processor Basics
Processor BasicsProcessor Basics
Processor Basics
 
Advanced Pipelining in ARM Processors.pptx
Advanced Pipelining  in ARM Processors.pptxAdvanced Pipelining  in ARM Processors.pptx
Advanced Pipelining in ARM Processors.pptx
 
Allen Bradley- Micrologix PLC Instructions
Allen Bradley- Micrologix PLC InstructionsAllen Bradley- Micrologix PLC Instructions
Allen Bradley- Micrologix PLC Instructions
 

Recently uploaded

Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
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
 
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
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine 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
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxsqpmdrvczh
 
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
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
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
 

Recently uploaded (20)

Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
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
 
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
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
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
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptx
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.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
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
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
 

Instruction Pipelining

  • 1. Afjal Hossain | Emran Hossain Raihan Mahmud| Rejuanul Haque Toriqul Islam Department of Software Instruction Pipelining SWE-311
  • 2. Pipelining  A technique used in advanced microprocessors where the microprocessor begins executing a second instruction before the first has been completed. 2
  • 5. Six Stage Instruction Pipeline  Fetch Instruction (FI): Read the next expected introduction into a buffer  Decode Instruction (DI): Determine the opcode and the operand specifiers  Calculate Operands (CO): Calculate the effective address of each source operand. This may involve displacement, register indirect, indirect or other forms of address calculations.  Fetch Operands (FO): Fetch each operand from memory. Operands in register need not be fetched.  Execute Instruction (EI): Perform the indicated operation and store the result, if any, in the specified destination operand location.  Write Operand (WO): Store result in memory5
  • 6. Types of hazards 6 Resource Data Control HAZARD
  • 7. Resource Hazards  Two (or more) instructions in pipeline need same resource  Executed in serial rather than parallel for part of pipeline  Also called structural hazard  E.g. Assume simplified five-stage pipeline  Each stage takes one clock cycle  Ideal case is new instruction enters pipeline each clock cycle  Assume main memory has single ports 7
  • 8. Data Hazards  Attempt to use item before it is ready  Instruction depends on result of prior instruction still in the pipeline 8
  • 9. Types of Data Hazard 9 RAW WAR WAW DATA HAZARD
  • 10. Read After Write (RAW)  It is also known as True dependency  An instruction modifies a register or memory location  Hazard if read takes place before write complete  B tries to read a register before A has written 10
  • 11. Write After Read (WAR)  It is also known as Anti dependency  An instruction reads a register or memory location  Hazard if write completes before read takes place  B tries to write a register before A has read it  In this case, A uses the new (incorrect) value 11
  • 12. Write After Write (WAW)  It is also known as Output dependency  Two instructions both write to same location  Hazard if writes take place in reverse of order intended sequence  B tries to write an operand before A has written it  After instruction B has executed, the value of the register should be B's result, but A's result12
  • 13. Control Hazard  Instructions that disrupt the sequential flow of control present problems for pipelines.  Also known as branch hazard  Control hazards occur because the PC following a control instruction is not known until control instruction computes if branch should be taken or not. 13
  • 14. 14
  • 15. Types of Control hazards o Unconditional branches o Conditional branches o Indirect branches o Procedure calls o Procedure returns 15
  • 16. Dealing with Branches  Multiple Streams  Prefetch Branch Target  Loop buffer  Branch prediction  Delayed branching 16
  • 17. Solutions for Control Hazards  Pipeline stall cycles  Branch delay slots  Branch prediction  Indirect branch prediction  Return address stack (RAS) 17
  • 18. Multiple Streams  Have two pipelines  Prefetch each branch into a separate pipeline  Use appropriate pipeline  Leads to bus & register contention  Multiple branches lead to further pipelines being needed 18
  • 19. Prefetch Branch Target  Target of branch is prefetched in addition to instructions following branch  Keep target until branch is executed  Used by IBM 360/91 19
  • 20. Loop Buffer  Very fast memory  Maintained by fetch stage of pipeline  Check buffer before fetching from memory  Very good for small loops or jumps  Used by CRAY-1 20
  • 22. Prediction  Easy to fetch multiple (consecutive) instructions per cycle  Essentially speculating on sequential flow  Jump: unconditional change of control flow  Always taken  Branch: conditional change of control flow  Taken typically ~50% of the time in applications  Backward: 30% of the Branch  80% taken = ~24%  Forward: 70% of the Branch  40% taken = ~28% 22
  • 23. What is Branch Prediction  In a computer architecture, a branch predictor is a digital circuit that tries to guess which way a branch. Will go before this is known definitively. The purpose of the branch predictor is to improve the flow in the instruction pipeline. 23
  • 24. Branch Prediction Techniques  Static Branch Prediction  Some branch instructions predicted as taken and others as not taken  End or program loop  Beginning of program loop  Hardware or compiler  Dynamic Branch Prediction  Bitmap for Lower bits of PC address  Says whether or not branch taken last time  If Instr is Branch, predict and update the table 24
  • 25.  Predict by Opcode  Some instructions are more likely to result in a jump than theirs  Can get up to 75% success  Taken/Not taken switch  Based on previous history  Good for loops  Refined by two-level or correlation-based branch history 25
  • 27. 27 Thank You !!! Any Questions ???