CDA3101 Recitation Section 8

Slides:



Advertisements
Similar presentations
1 ECE369 ECE369 Pipelining. 2 ECE369 addm (rs), rt # Memory[R[rs]] = R[rt] + Memory[R[rs]]; Assume that we can read and write the memory in the same cycle.
Advertisements

Pipeline Exceptions & ControlCSCE430/830 Pipelining in MIPS MIPS architecture was designed to be pipelined –Simple instruction format (makes IF, ID easy)
COMP381 by M. Hamdi 1 (Recap) Pipeline Hazards. COMP381 by M. Hamdi 2 I n s t r. O r d e r add r1,r2,r3 sub r4,r1,r3 and r6,r1,r7 or r8,r1,r9 xor r10,r1,r11.
COMP25212 Further Pipeline Issues. Cray 1 COMP25212 Designed in 1976 Cost $8,800,000 8MB Main Memory Max performance 160 MFLOPS Weight 5.5 Tons Power.
Pipeline Computer Organization II 1 Hazards Situations that prevent starting the next instruction in the next cycle Structural hazards – A required resource.
Lecture Objectives: 1)Define pipelining 2)Calculate the speedup achieved by pipelining for a given number of instructions. 3)Define how pipelining improves.
Forwarding and Hazards MemberRole William ElliottTeam Leader Jessica Tyler ShulerWiki Specialist Tyler KimseyLead Engineer Cameron CarrollEngineer Danielle.
Lecture 6: Pipelining MIPS R4000 and More Kai Bu
Instruction-Level Parallelism (ILP)
1 IF IDEX MEM L.D F4,0(R2) MUL.D F0, F4, F6 ADD.D F2, F0, F8 L.D F2, 0(R2) WB IF IDM1 MEM WBM2M3M4M5M6M7 stall.
COMP381 by M. Hamdi 1 Pipeline Hazards. COMP381 by M. Hamdi 2 Pipeline Hazards Hazards are situations in pipelining where one instruction cannot immediately.
Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Pipeline Hazards See: P&H Chapter 4.7.
1 Lecture 17: Basic Pipelining Today’s topics:  5-stage pipeline  Hazards and instruction scheduling Mid-term exam stats:  Highest: 90, Mean: 58.
1 Lecture 4: Advanced Pipelines Data hazards, control hazards, multi-cycle in-order pipelines (Appendix A.4-A.10)
EECS 470 Pipeline Hazards Lecture 4 Coverage: Appendix A.
CSCE 212 Quiz 9 – 3/30/11 1.What is the clock cycle time based on for single-cycle and for pipelining? 2.What two actions can be done to resolve data hazards?
DLX Instruction Format
Computer ArchitectureFall 2007 © October 31, CS-447– Computer Architecture M,W 10-11:20am Lecture 17 Review.
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 )
7/2/ _23 1 Pipelining ECE-445 Computer Organization Dr. Ron Hayne Electrical and Computer Engineering.
Pipelining By Toan Nguyen.
Instruction Sets and Pipelining Cover basics of instruction set types and fundamental ideas of pipelining Later in the course we will go into more depth.
Pipeline Hazard CT101 – Computing Systems. Content Introduction to pipeline hazard Structural Hazard Data Hazard Control Hazard.
Memory/Storage Architecture Lab Computer Architecture Pipelining Basics.
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.
CMPE 421 Parallel Computer Architecture
1 COMP541 Pipelined MIPS Montek Singh Mar 30, 2010.
11 Pipelining Kosarev Nikolay MIPT Oct, Pipelining Implementation technique whereby multiple instructions are overlapped in execution Each pipeline.
Introduction to Computer Organization Pipelining.
Lecture 9. MIPS Processor Design – Pipelined Processor Design #1 Prof. Taeweon Suh Computer Science Education Korea University 2010 R&E Computer System.
CSCE 212 Chapter 6 Enhancing Performance with Pipelining Instructor: Jason D. Bakos.
Lecture 18: Pipelining I.
Computer Organization
CSCI206 - Computer Organization & Programming
Lecture 07: Pipelining Multicycle, MIPS R4000, and More
Lecture: Pipelining Extensions
Single Clock Datapath With Control
Pipeline Implementation (4.6)
CDA 3101 Spring 2016 Introduction to Computer Organization
\course\cpeg323-08F\Topic6b-323
Morgan Kaufmann Publishers The Processor
CS 5513 Computer Architecture Pipelining Examples
Lecture 6: Advanced Pipelines
Pipelining Multicycle, MIPS R4000, and More
Pipelining review.
Pipelining in more detail
CSCI206 - Computer Organization & Programming
CSC 4250 Computer Architectures
CSCI206 - Computer Organization & Programming
\course\cpeg323-05F\Topic6b-323
How to improve (decrease) CPI
Pipeline control unit (highly abstracted)
Lecture: Pipelining Extensions
Lecture: Pipelining Extensions
Instruction Execution Cycle
Pipeline control unit (highly abstracted)
CS203 – Advanced Computer Architecture
Pipelining: Basic Concepts
Lecture 4: Advanced Pipelines
pipelining: data hazards Prof. Eric Rotenberg
Pipeline Control unit (highly abstracted)
Pipelining.
Introduction to Computer Organization and Architecture
Throughput = #instructions per unit time (seconds/cycles etc.)
CS 3853 Computer Architecture Pipelining Examples
MIPS Pipelined Datapath
Problem ??: (?? marks) Consider executing the following code on the MIPS pipelined datapath: add $t5, $t6, $t8 add $t9, $t5, $t4 lw $t3, 100($t9) sub $t2,
Pipelining Hazards.
Presentation transcript:

CDA3101 Recitation Section 8 MIPS Pipeline and Hazards

MIPS Single Cycle Data Path Problem: all instructions take the same length of time, only one piece of hardware in use at any time Clock rate determined by critical path.

Motivation for Multicycle Data Path Design a minimal piece of hardware that can handle every step of the path, but only one at a time. Each instruction passes through this hardware multiple times. Clock rate determined by slowest functional unit. Advantage: less wasted hardware – each unit can be re-used by an instruction Advantage: not all instructions take same number of cycles

MIPS Multi Cycle Data Path

Motivation for Pipelining Goal is to have every block of hardware working as much as possible. Multi-cycle approach involves complex control unit, and jack-of-all-trades hardware. An “assembly-line” approach is more efficient. Solution: break instruction execution into stages, then “pipe” the output of each stage into the next stage. Clock rate determined by slowest stage.

Pipeline Stages MIPS Pipeline Stages IF – Instruction Fetch ID – Instruction Decode / Data Fetch EX – Execute MEM – Memory Access WB – Writeback to registers Buffers at the start of each stage.

Pipeline Stages

Pipeline Stages

Pipeline Stages Instructions passing through the pipeline

What could go wrong? (Hazards) Data Hazard: an instruction depends on a result computed by a previous instruction that is not ready Control Hazard: the result of a branch is not known until after subsequent instructions enter the pipeline Structural Hazards: different instructions try to access the same piece of hardware

Dealing with Structural Hazards Structural Hazards: different instructions try to access the same piece of hardware Solutions: Duplicating Hardware: example – branch instruction requires a compare and subtract in same clock cycle, so we have two add units. Hardware Concurrency: example - register file writes at first half of the clock cycle, and reads on second half to support ID and WB; memory also supports two reads for IF and MEM Reordering: instructions can be reordered to eliminate conflicts (examples coming later)

Data Hazards Data Hazard: an instruction depends on a result computed by a previous instruction that is not ready RAR - read after read WAR - write after read WAW - write after write RAW - read after write (problem)

Dealing with Data Hazards Solutions Stall Insertion: send dummy instructions (stalls) into the pipeline Code Reordering: send an instruction from another dependency chain into the pipeline Forwarding: add hardware to send the dependency information to the instruction that needs it

Problem 1: Data Hazards Resolve the data hazards in the MIPS code above using (i) stalls, (ii) code-reordering (iii) forwarding add $1 $2 $3 add $4 $1 $1 add $11 $12 $13 Add $14 $11 $11 *Note: do not assume the existence of a register file that can read/write at half clock cycles

Problem 1: Data Hazards $1 needed $1 ready $11 needed $11 ready CC1 add $1 $2 $3 add $4 $1 $1 add $11 $12 $13 add $14 $11 $11 IF ID ALU MEM WB IF ID ALU MEM WB IF ID ALU MEM WB IF ID ALU MEM WB $11 needed $11 ready CC1 CC2 CC3 CC4 CC5 CC6 CC7 CC8 CC9 CCA CCB CCC CCD

Problem 1: Data Hazards i. stalls CC1 CC2 CC3 CC4 CC5 CC6 CC7 CC8 CC9 CCA CCB CCC CCD add $1 $2 $3 stall add $4 $1 $1 add $11 $12 $13 add $14 $11 $11 IF ID ALU MEM WB IF ID ALU MEM WB IF ID ALU MEM WB IF ID ALU MEM WB

Problem 1: Data Hazards ii. reordering CC1 CC2 CC3 CC4 CC5 CC6 CC7 CC8 CCA CCB CCC CCD add $1 $2 $3 add $11 $12 $13 stall add $4 $1 $1 add $14 $11 $11 IF ID ALU MEM WB IF ID ALU MEM WB IF ID ALU MEM WB IF ID ALU MEM WB

Problem 1: Data Hazards iii. forwarding CC1 CC2 CC3 CC4 CC5 CC6 CC7 CCA CCB CCC CCD add $1 $2 $3 add $4 $1 $1 add $11 $12 $13 add $14 $11 $11 IF ID ALU MEM WB IF ID ALU MEM WB IF ID ALU MEM WB IF ID ALU MEM WB