CSC 4250 Computer Architectures

Slides:



Advertisements
Similar presentations
Lecture 4: CPU Performance
Advertisements

1 Pipelining Part 2 CS Data Hazards Data hazards occur when the pipeline changes the order of read/write accesses to operands that differs from.
CMSC 611: Advanced Computer Architecture Pipelining Some material adapted from Mohamed Younis, UMBC CMSC 611 Spr 2003 course slides Some material adapted.
Pipelining: Basic and Intermediate Concepts
Lecture 6: Pipelining MIPS R4000 and More Kai Bu
Instruction-Level Parallelism (ILP)
COMP381 by M. Hamdi 1 Pipeline Hazards. COMP381 by M. Hamdi 2 Pipeline Hazards Hazards are situations in pipelining where one instruction cannot immediately.
1 Lecture 4: Advanced Pipelines Data hazards, control hazards, multi-cycle in-order pipelines (Appendix A.4-A.10)
EENG449b/Savvides Lec 4.1 1/22/04 January 22, 2004 Prof. Andreas Savvides Spring EENG 449bG/CPSC 439bG Computer.
DLX Instruction Format
1 Lecture 4: Advanced Pipelines Data hazards, control hazards, multi-cycle in-order pipelines (Appendix A.4-A.10)
1 Lecture 4: Advanced Pipelines Control hazards, multi-cycle in-order pipelines, static ILP (Appendix A.4-A.10, Sections )
Appendix A Pipelining: Basic and Intermediate Concepts
ENGS 116 Lecture 51 Pipelining and Hazards Vincent H. Berk September 30, 2005 Reading for today: Chapter A.1 – A.3, article: Patterson&Ditzel Reading for.
Pipeline Hazard CT101 – Computing Systems. Content Introduction to pipeline hazard Structural Hazard Data Hazard Control Hazard.
CSC 4250 Computer Architectures September 15, 2006 Appendix A. Pipelining.
Lecture 7: Pipelining Review Kai Bu
Pipelining. 10/19/ Outline 5 stage pipelining Structural and Data Hazards Forwarding Branch Schemes Exceptions and Interrupts Conclusion.
Memory/Storage Architecture Lab Computer Architecture Pipelining Basics.
Lecture 05: Pipelining Basics & Hazards Kai Bu
Chapter 2 Summary Classification of architectures Features that are relatively independent of instruction sets “Different” Processors –DSP and media processors.
1 Appendix A Pipeline implementation Pipeline hazards, detection and forwarding Multiple-cycle operations MIPS R4000 CDA5155 Spring, 2007, Peir / University.
CSC 4250 Computer Architectures September 26, 2006 Appendix A. Pipelining.
Pipeline Hazards. CS5513 Fall Pipeline Hazards Situations that prevent the next instructions in the instruction stream from executing during its.
CMPE 421 Parallel Computer Architecture
EECE 476: Computer Architecture Slide Set #5: Implementing Pipelining Tor Aamodt Slide background: Die photo of the MIPS R2000 (first commercial MIPS microprocessor)
Oct. 18, 2000Machine Organization1 Machine Organization (CS 570) Lecture 4: Pipelining * Jeremy R. Johnson Wed. Oct. 18, 2000 *This lecture was derived.
11 Pipelining Kosarev Nikolay MIPT Oct, Pipelining Implementation technique whereby multiple instructions are overlapped in execution Each pipeline.
CSC 4250 Computer Architectures September 22, 2006 Appendix A. Pipelining.
Stalling delays the entire pipeline
Pipelining: Hazards Ver. Jan 14, 2014
ARM Organization and Implementation
CDA 3101 Spring 2016 Introduction to Computer Organization
CSCI206 - Computer Organization & Programming
Morgan Kaufmann Publishers
Lecture 07: Pipelining Multicycle, MIPS R4000, and More
5 Steps of MIPS Datapath Figure A.2, Page A-8
Single Clock Datapath With Control
Pipeline Implementation (4.6)
Appendix C Pipeline implementation
\course\cpeg323-08F\Topic6b-323
Appendix A - Pipelining
Chapter 4 The Processor Part 3
Review: MIPS Pipeline Data and Control Paths
Morgan Kaufmann Publishers The Processor
Lecture 6: Advanced Pipelines
Pipelining Multicycle, MIPS R4000, and More
Pipelining review.
Pipelining Chapter 6.
Lecture 5: Pipelining Basics
Pipelining in more detail
CSCI206 - Computer Organization & Programming
\course\cpeg323-05F\Topic6b-323
Data Hazards Data Hazard
Pipeline control unit (highly abstracted)
The Processor Lecture 3.6: Control Hazards
Instruction Execution Cycle
Overview What are pipeline hazards? Types of hazards
Pipelining Multicycle, MIPS R4000, and More
Pipeline control unit (highly abstracted)
CS203 – Advanced Computer Architecture
Lecture 4: Advanced Pipelines
Pipeline Control unit (highly abstracted)
MIPS Pipelining: Part I
Morgan Kaufmann Publishers The Processor
Introduction to Computer Organization and Architecture
Seoul National University
Guest Lecturer: Justin Hsia
MIPS Pipelined Datapath
Pipelining Hazards.
Presentation transcript:

CSC 4250 Computer Architectures September 19, 2006 Appendix A. Pipelining

Three Classes of Pipeline Hazards Structural Hazards: Arise from resource conflicts when hardware cannot support the overlapped execution of all possible combinations of instructions Data Hazards: Arise when an instruction depends on results of a previous instruction exposed by the pipeline Control Hazards: Arise from pipelining of branches and other instructions that change PC (what is PC?)

Structural Hazards Functional unit is not pipelined, e.g., FP divide One register write port ─ two writes in a cycle; when can this happen? Single memory pipeline for data and instructions ─ instruction contains data memory reference

Figure A.4. Load with One Memory Port

Why Allow Structural Hazards? Reduce cost Pipelining (or duplicating) all functional units is expensive (e.g., fully pipeline FP multiply) Processors that support both instruction and data cache accesses every cycle require twice as much bandwidth

Data Hazards Pipelining changes order of read/write accesses: DADD R1,R2,R3 DSUB R4,R1,R5 AND R6,R1,R7 OR R8,R1,R9 XOR R10, R1, R11 Add writes R1 in WB stage (5th cycle) Sub reads R1 in ID (3rd cycle) → data hazard Same problem for And instruction What about Or? Or reads R1 in the 5th cycle, while Add writes R1

Fig. A.6. Use of DADD Result Causes Data Hazard

Minimize Data Hazard Stalls by Forwarding ALU result from both EX/MEM and MEM/WB pipeline registers always fed back to ALU inputs If forwarding hardware detects that previous ALU operation writes the register corresponding to current source for ALU operation, then control logic selects forwarded result as input

Fig. A.7. Use Forwarding Paths to Avoid Data Hazard

Fig. A.23. Extra Hardware for Forwarding to ALU

Forwarding Generalized Forwarding Forwarding Fails Pipeline Interlock Result forwarded from pipeline register corresponding to output of one unit to input of another unit Forwarding Fails Load causes delay that forwarding cannot handle Pipeline Interlock Hardware detects a hazard and stalls pipeline until hazard is cleared MIPS Microprocessor without Interlocking Pipeline Stages

Fig. A.8. Forwarding of Operand Required by Stores

Figure A.9. Load Instruction Causes Stall

Figure A.17. Implementation of MIPS Data Path

Figure A.18. Pipeline Data Path by Adding Pipeline Registers

Control Hazard Branch may change value of PC Branch is taken or untaken Three cycles of delay on MIPS

MIPS Branch Delay Clock Number Instr. # 1 2 3 4 5 6 7 8 9 Branch instr. IF ID EX ME WB Instr. i+1 IF stall stall stall stall Branch target IF ID EX ME WB Branch target+1 IF ID EX ME Branch target+2 IF ID EX

How MIPS Reduces Branch Delay Consider only BEQZ and BNEZ Move zero test into ID stage (from EX stage) Compute both PCs (taken and untaken) early Additional adder in ID stage (old: use ALU) Only one cycle stall on branches Branch on result of immediately preceding ALU instruction causes data hazard

Figure A.24. Branch Hazard Stall Reduced to One Cycle

Data Hazard in ALU Instr. followed by Branch Clock Number Instruction # 1 2 3 4 5 6 7 ALU instruction IF ID EX ME WB Branch instruction IF ID ID EX ME WB Example. ADD R1,R2,R3 BEQZ R1,name

Delayed Branch Heavily used in early RISC processors Works well with branch delay of one cycle Sequential successor is in branch delay slot. This instruction is executed whether or not branch is taken: Branch instruction Sequential successor Branch target if taken

Figure A.14. Schedule Branch Delay Slot