CSE 141Dean Tullsen Designing a Pipelined CPU. CSE 141Dean Tullsen Quiz next Wednesday (2/20) No class on Monday 2/18 Quiz will be full hour (less time.

Slides:



Advertisements
Similar presentations
Lecture 4: CPU Performance
Advertisements

Morgan Kaufmann Publishers The Processor
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.
CML CML CS 230: Computer Organization and Assembly Language Aviral Shrivastava Department of Computer Science and Engineering School of Computing and Informatics.
Pipeline Computer Organization II 1 Hazards Situations that prevent starting the next instruction in the next cycle Structural hazards – A required resource.
CMPT 334 Computer Organization
Datorteknik Pipelining bild 1 Acceleration How to improve speed? At what costs?
Review: MIPS Pipeline Data and Control Paths
Mary Jane Irwin ( ) [Adapted from Computer Organization and Design,
ENEE350 Ankur Srivastava University of Maryland, College Park Based on Slides from Mary Jane Irwin ( )
1 Stalling  The easiest solution is to stall the pipeline  We could delay the AND instruction by introducing a one-cycle delay into the pipeline, sometimes.
ECE 232 L19.Pipeline2.1 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers ECE 232 Hardware Organization and Design Lecture 19 Pipelining,
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?
Computer ArchitectureFall 2007 © October 22nd, 2007 Majd F. Sakr CS-447– Computer Architecture.
Lec 9: Pipelining Kavita Bala CS 3410, Fall 2008 Computer Science Cornell University.
Pipelining - II Adapted from CS 152C (UC Berkeley) lectures notes of Spring 2002.
Computer ArchitectureFall 2008 © October 6th, 2008 Majd F. Sakr CS-447– Computer Architecture.
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.
Pipelining - II Rabi Mahapatra Adapted from CS 152C (UC Berkeley) lectures notes of Spring 2002.
Lecture 12: Pipeline Datapath Design Professor Mike Schulte Computer Architecture ECE 201.
Abstraction Question General purpose processors have an abstraction layer fixed at the ISA and have little control over the compilers or code run on the.
Memory/Storage Architecture Lab Computer Architecture Pipelining Basics.
Automobile Manufacturing 1. Build frame. 60 min. 2. Add engine. 50 min. 3. Build body. 80 min. 4. Paint. 40 min. 5. Finish.45 min. 275 min. Latency: Time.
Pipelined Datapath and Control
1 COMP541 Multicycle MIPS Montek Singh Apr 4, 2012.
Morgan Kaufmann Publishers
Comp Sci pipelining 1 Ch. 13 Pipelining. Comp Sci pipelining 2 Pipelining.
CSE 340 Computer Architecture Summer 2014 Basic MIPS Pipelining Review.
CS.305 Computer Architecture Enhancing Performance with Pipelining Adapted from Computer Organization and Design, Patterson & Hennessy, © 2005, and from.
CMPE 421 Parallel Computer Architecture
Pipeline Data Hazards Warning, warning, warning! Read 4.8 Peer Instruction Lecture Materials for Computer Architecture by Dr. Leo Porter is licensed under.
1 Designing a Pipelined Processor In this Chapter, we will study 1. Pipelined datapath 2. Pipelined control 3. Data Hazards 4. Forwarding 5. Branch Hazards.
Sample Code (Simple) Run the following code on a pipelined datapath: add1 2 3 ; reg 3 = reg 1 + reg 2 nand ; reg 6 = reg 4 & reg 5 lw ; reg.
CMPE 421 Parallel Computer Architecture Part 2: Hardware Solution: Forwarding.
Winter 2002CSE Topic Branch Hazards in the Pipelined Processor.
COMP541 Multicycle MIPS Montek Singh Mar 25, 2010.
Cs 152 L1 3.1 DAP Fa97,  U.CB Pipelining Lessons °Pipelining doesn’t help latency of single task, it helps throughput of entire workload °Multiple tasks.
CSIE30300 Computer Architecture Unit 04: Basic MIPS Pipelining Hsin-Chou Chi [Adapted from material by and
1 (Based on text: David A. Patterson & John L. Hennessy, Computer Organization and Design: The Hardware/Software Interface, 3 rd Ed., Morgan Kaufmann,
2/15/02CSE Data Hazzards Data Hazards in the Pipelined Implementation.
Instructor: Senior Lecturer SOE Dan Garcia CS 61C: Great Ideas in Computer Architecture Pipelining Hazards 1.
LECTURE 7 Pipelining. DATAPATH AND CONTROL We started with the single-cycle implementation, in which a single instruction is executed over a single cycle.
1. Convert the RISCEE 1 Architecture into a pipeline Architecture (like Figure 6.30) (showing the number data and control bits). 2. Build the control line.
CSE431 L06 Basic MIPS Pipelining.1Irwin, PSU, 2005 MIPS Pipeline Datapath Modifications  What do we need to add/modify in our MIPS datapath? l State registers.
10/11: Lecture Topics Execution cycle Introduction to pipelining
Introduction to Computer Organization Pipelining.
1 Pipelining CDA 3101 Discussion Section Question 1 – 6.1 Suppose that time for an ALU operation can be shortened by 25% in the following figure.
Pipelining: Implementation CPSC 252 Computer Organization Ellen Walker, Hiram College.
Computer Organization
Pipelines An overview of pipelining
Pipelining Chapter 6.
CSCI206 - Computer Organization & Programming
Basic Pipeline Datapath
Single Clock Datapath With Control
Pipeline Implementation (4.6)
CDA 3101 Spring 2016 Introduction to Computer Organization
Morgan Kaufmann Publishers The Processor
Pipelining review.
Pipelining Chapter 6.
Current Design.
Systems Architecture II
CSCI206 - Computer Organization & Programming
Pipeline control unit (highly abstracted)
Daxia Ge Friday February 9th, 2007
Instruction Execution Cycle
Pipeline control unit (highly abstracted)
Designing a Pipelined CPU
Pipelining: Basic Concepts
Pipeline Control unit (highly abstracted)
Need to stall for one cycle.
Presentation transcript:

CSE 141Dean Tullsen Designing a Pipelined CPU

CSE 141Dean Tullsen Quiz next Wednesday (2/20) No class on Monday 2/18 Quiz will be full hour (less time pressure?) How do you set control lines? What would happen if some line was stuck on (or off) How would you add such-and-such instruction Why is such-and-such needed Where do you insert no-ops or stalls to execute...

CSE 141Dean Tullsen Review -- Single Cycle CPU

CSE 141Dean Tullsen Review -- Multiple Cycle CPU

CSE 141Dean Tullsen Review -- Instruction Latencies Cycle 1Cycle 2Cycle 3Cycle 4Cycle 5 IfetchReg/DecExecMemWrLoad IfetchReg/DecExecMemWrLoad Single-Cycle CPU Multiple Cycle CPU IfetchReg/DecExecWrAdd

CSE 141Dean Tullsen A Pipelined Datapath IF: Instruction fetch ID: Instruction decode and register fetch EX: Execution and effective address calculation MEM: Memory access WB: Write back

Pipelined Datapath Warning – “write register” line is incorrect in this figure!

CSE 141Dean Tullsen Execution in a Pipelined Datapath CC1CC2CC3CC4CC5CC6CC7CC8CC9 lwlw lwlw lwlw lwlw lwlw steady state steady state IFIDEXMEMWB IMReg ALU DMReg IFIDEXMEMWB IMReg ALU DMReg IFIDEXMEMWB IMReg ALU DMReg IFIDEXMEMWB IMReg ALU DMReg IFIDEXMEMWB IMReg ALU DMReg

CSE 141Dean Tullsen Instruction Latencies and Throughput Single-Cycle CPU Multiple Cycle CPU Pipelined CPU Cycle 1Cycle 2Cycle 3Cycle 4Cycle 5Cycle 6Cycle 7Cycle 8 IFDecEXMemWBLoad IFDecEXMemWBLoad IFDecEXMemWBLoad IFDecEXMemWBLoad Cycle 1Cycle 2Cycle 3Cycle 4Cycle 5 IFDecEXMemWBLoad IFDecEXMemWB Load

CSE 141Dean Tullsen Pipelining Advantages Higher maximum throughput Higher utilization of CPU resources But, more hardware needed, perhaps complex control

CSE 141Dean Tullsen Mixed Instructions in the Pipeline IMReg ALU Reg IMReg ALU DMReg CC1CC2CC3CC4CC5CC6 lwlw add

CSE 141Dean Tullsen Pipeline Principles All instructions that share a pipeline must have the same stages in the same order. –therefore, add does nothing during Mem stage –sw does nothing during WB stage All intermediate values must be latched each cycle. There is no functional block reuse – example: we need 2 adders and ALU (like in single-cycle) IMReg ALU DMReg IF IDEXMEM WB

CSE 141Dean Tullsen Pipelined Datapath Instruction FetchInstruction Decode/ Register Fetch Execute/ Address Calculation Memory AccessWrite Back registers!

CSE 141Dean Tullsen The Pipeline in Execution add $10, $1, $2 Instruction Decode/ Register Fetch Execute/ Address Calculation Memory AccessWrite Back

CSE 141Dean Tullsen The Pipeline in Execution lw $12, 1000($4)add $10, $1, $2 Execute/ Address Calculation Memory AccessWrite Back

CSE 141Dean Tullsen The Pipeline in Execution sub $15, $4, $1lw $12, 1000($4)add $10, $1, $2 Memory AccessWrite Back

CSE 141Dean Tullsen The Pipeline in Execution Instruction Fetch sub $15, $4, $1lw $12, 1000($4)add $10, $1, $2 Write Back

CSE 141Dean Tullsen The Pipeline in Execution Instruction FetchInstruction Decode/ Register Fetch sub $15, $4, $1lw $12, 1000($4)add $10, $1, $2

CSE 141Dean Tullsen The Pipeline in Execution Instruction FetchInstruction Decode/ Register Fetch Execute/ Address Calculation sub $15, $4, $1lw $12, 1000($4)

The Pipeline in Execution, with controls (This figure has correct Write register bus)

CSE 141Dean Tullsen Pipelined Control FSM isn’t really appropriate Combinational Logic (like single-cycle design)! –signals generated once in ID stage –follow instruction through the pipeline –get used in whatever stage they are needed IF/IDID/EXEX/MEMMEM/WB control instruction

CSE 141Dean Tullsen Pipelined Control Signals

CSE 141Dean Tullsen The Pipeline with Control Logic

CSE 141Dean Tullsen Is it really that easy? Suppose initially, register i holds the number 2i What happens when... add $3, $10, $11 - this should add , putting result 42 into r3 lw $8, 50($3) - this should load r8 from memory location = 92 sub $11, $8, $7 - this should subtract 14 from that just-loaded value

CSE 141Dean Tullsen The Pipeline in Execution lw $8, 50($3) add $3, $10, $11Execute/ Address Calculation Memory AccessWrite Back 20 22

CSE 141Dean Tullsen The Pipeline in Execution sub $11, $8, $7lw $8, 50($3)add $3, $10, $11Memory AccessWrite Back Ooops! This should have been “42”! But register 3 didn’t get updated yet.

CSE 141Dean Tullsen The Pipeline in Execution add $10, $1, $2sub $11, $8, $7lw $8, 50($3)add $3, $10, $11Write Back And this should be value from memory (which hasn’t even been loaded yet). Recall: this should have been “92” 42

CSE 141Dean Tullsen Data Hazards When a result is needed in the pipeline before it is available, a “data hazard” occurs. IMReg ALU DMReg IMReg ALU DM IMReg ALU DMRegIMReg ALU DMRegIMReg ALU DMReg CC1CC2CC3CC4CC5CC6CC7CC8 sub $2, $1, $3 and $12, $2, $5 or $13, $6, $2 add $14, $2, $2 sw $15, 100($2) R2 Available R2 Needed