CBP 2005Comp 3070 Computer Architecture1 Last Time … All instructions the same length We learned to program MIPS And a bit about Intel’s x86 Instructions.

Slides:



Advertisements
Similar presentations
PipelineCSCE430/830 Pipeline: Introduction CSCE430/830 Computer Architecture Lecturer: Prof. Hong Jiang Courtesy of Prof. Yifeng Zhu, U of Maine Fall,
Advertisements

Lecture 4: CPU Performance
CBP 2009Comp 3014 The Nature of Computing 1 Laundry Model Washer Drier Store Basket Wardrobe.
CMPT 334 Computer Organization
1 IKI20210 Pengantar Organisasi Komputer Kuliah no. 25: Pipeline 10 Januari 2003 Bobby Nazief Johny Moningka
Chapter 8. Pipelining.
Review: Pipelining. Pipelining Laundry Example Ann, Brian, Cathy, Dave each have one load of clothes to wash, dry, and fold Washer takes 30 minutes Dryer.
Pipelining I (1) Fall 2005 Lecture 18: Pipelining I.
Pipelining Hwanmo Sung CS147 Presentation Professor Sin-Min Lee.
Goal: Describe Pipelining
Computer Architecture
CS252/Patterson Lec 1.1 1/17/01 Pipelining: Its Natural! Laundry Example Ann, Brian, Cathy, Dave each have one load of clothes to wash, dry, and fold Washer.
Chapter Six 1.
1  1998 Morgan Kaufmann Publishers Chapter Six Enhancing Performance with Pipelining.
ENEE350 Ankur Srivastava University of Maryland, College Park Based on Slides from Mary Jane Irwin ( )
Pipelining III Andreas Klappenecker CPSC321 Computer Architecture.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania Computer Organization Pipelined Processor Design 1.
Pipelining Andreas Klappenecker CPSC321 Computer Architecture.
Computer ArchitectureFall 2007 © October 24nd, 2007 Majd F. Sakr CS-447– Computer Architecture.
Computer ArchitectureFall 2007 © October 22nd, 2007 Majd F. Sakr CS-447– Computer Architecture.
King Fahd University of Petroleum and Minerals King Fahd University of Petroleum and Minerals Computer Engineering Department Computer Engineering Department.
RISC. Rational Behind RISC Few of the complex instructions were used –data movement – 45% –ALU ops – 25% –branching – 30% Cheaper memory VLSI technology.
1 Atanasoff–Berry Computer, built by Professor John Vincent Atanasoff and grad student Clifford Berry in the basement of the physics building at Iowa State.
Computer ArchitectureFall 2008 © October 6th, 2008 Majd F. Sakr CS-447– Computer Architecture.
1  1998 Morgan Kaufmann Publishers Chapter Six Enhancing Performance with Pipelining.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Computer Organization Lecture 17 - Pipelined.
Introduction to Pipelining Rabi Mahapatra Adapted from the lecture notes of Dr. John Kubiatowicz (UC Berkeley)
Enhancing Performance with Pipelining Slides developed by Rami Abielmona and modified by Miodrag Bolic High-Level Computer Systems Design.
CS3350B Computer Architecture Winter 2015 Lecture 6.2: Instructional Level Parallelism: Hazards and Resolutions Marc Moreno Maza
9.2 Pipelining Suppose we want to perform the combined multiply and add operations with a stream of numbers: A i * B i + C i for i =1,2,3,…,7.
CS1104: Computer Organisation School of Computing National University of Singapore.
Computer Science Education
Pipelining (I). Pipelining Example  Laundry Example  Four students have one load of clothes each to wash, dry, fold, and put away  Washer takes 30.
Comp Sci pipelining 1 Ch. 13 Pipelining. Comp Sci pipelining 2 Pipelining.
Analogy: Gotta Do Laundry
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
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.
ECE 232 L18.Pipeline.1 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers ECE 232 Hardware Organization and Design Lecture 18 Pipelining.

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.
Chap 6.1 Computer Architecture Chapter 6 Enhancing Performance with Pipelining.
CSIE30300 Computer Architecture Unit 04: Basic MIPS Pipelining Hsin-Chou Chi [Adapted from material by and
1/24/ :00 PM 1 of 86 Pipelining Chapter 6. 1/24/ :00 PM 2 of 86 Overview of Pipelining Pipelining is an implementation technique in which.
Pipelining Example Laundry Example: Three Stages
Computer = ALU + Memory Registers ALU Let’s try to compute = 5 32 Go to jail and do not collect £200.
Computer Organization and Design Pipelining Montek Singh Mon, Dec 2, 2013 Lecture 16.
Computer Organization and Design Pipelining Montek Singh Dec 2, 2015 Lecture 16 (SELF STUDY – not covered on the final exam)
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.
Lecture 9. MIPS Processor Design – Pipelined Processor Design #1 Prof. Taeweon Suh Computer Science Education Korea University 2010 R&E Computer System.
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
EECS 322 April 10, 2000 EECS 322 Computer Architecture Pipeline Control, Data Hazards and Branch Hazards.
Lecture 5. MIPS Processor Design Pipelined MIPS #1 Prof. Taeweon Suh Computer Science & Engineering Korea University COSE222, COMP212 Computer Architecture.
Lecture 18: Pipelining I.
CDA3101 Recitation Section 8
Pipelining Chapter 6.
ELEN 468 Advanced Logic Design
CMSC 611: Advanced Computer Architecture
Pipelining Lessons 6 PM T a s k O r d e B C D A 30
CS 5513 Computer Architecture Pipelining Examples
Pipelining Chapter 6.
Pipelining Lessons 6 PM T a s k O r d e B C D A 30
Data Dependence Distances
Chapter 8. Pipelining.
CS 3853 Computer Architecture Pipelining Examples
Pipelining.
Presentation transcript:

CBP 2005Comp 3070 Computer Architecture1 Last Time … All instructions the same length We learned to program MIPS And a bit about Intel’s x86 Instructions of variable length

CBP 2005Comp 3070 Computer Architecture2 Today the consequences of … Intel (CISC) MIPS (RISC)

CBP 2005Comp 3070 Computer Architecture3 Laundry Model Washer Drier Store Basket Wardrobe

CBP 2005Comp 3070 Computer Architecture4 Process Steps A. Wash then Dry idle running time Load the washer at Done at 10, load the drier 3.Drier Done at 11

CBP 2005Comp 3070 Computer Architecture5 Sequential Process 3 loads takes 6 hours time Load washer at Done at 10, load drier 3.Drier Done at 11 4.Reload washer at 11 5.Done at 12, load drier 6.Drier done at 13 7.Reload washer at 13 8.Done at 14, load drier 9.Done at

CBP 2005Comp 3070 Computer Architecture6 Overlapping Process 3 loads takes 4 hours time Load washer at Done at 10, load drier reload washer 3.Both Done at 11. Reload drier reload washer 4.Both done at 12. Reload drier 5.Drier done at From till both washer and dryer running concurrently

CBP 2005Comp 3070 Computer Architecture7 Washing Pipeline Filling time loads in 9 hours 5 Cycles !!! 1.Get washing 2.Wash 3.Dry 4.Store 5.Put away

CBP 2005Comp 3070 Computer Architecture8 Washing Pipeline Full time Pipe Full gives 1 load per hour

CBP 2005Comp 3070 Computer Architecture9 Pipelining : Comments time Potential speedup = number of stages Time to ‘fill’ and ‘drain’ reduces speedup Rate limited by slowest step

CBP 2005Comp 3070 Computer Architecture10 Can we Pipeline SAM ? Data Memory Instruction reg Code Memory ALU r1 r2 r0 X Y W XY W mar mdr 1.Fetch 2.Dec/ Reg 3.ALU 4.Mem 5.RW

CBP 2005Comp 3070 Computer Architecture11 Pipelined Sam4 Data Memory X Y W Y W r1 r2 r0 X Code Memory 1.Fetch2.Dec/ Reg 3.ALU4.Mem5.RW Buffer time

CBP 2005Comp 3070 Computer Architecture12 5 Stages in Pipeline ALU Mem Reg MemReg add r3,r1,r2 r1,r2 r3 add Let’s take the instruction add r3,r1,r2 and show which stage is needed for each part of the instruction. 1.Fetch 2.Dec/ Reg 3.ALU4.Mem5.RW time

CBP 2005Comp 3070 Computer Architecture13 ld r0 Memr3 Two Instructions ld r3,[r0+2] Two instructions into the pipeline add r4,r1,r2 ALU add r1,r2 r4 r0 2 time

CBP 2005Comp 3070 Computer Architecture14 Structural Hazard ALU Mem Reg MemReg ALU Mem Reg MemReg ALU Mem Reg MemReg ALU Mem Reg MemReg ALU Mem Reg MemReg Here we are being asked to read from memory and write to it simultaneously. Impossible! Write (store) Read (fetch) Solution – Use separate code and data memories add r4,r1,r2 st r0,[5]

CBP 2005Comp 3070 Computer Architecture15 Hazardous Washing time Washing basket containes both clean and dirty washing!

CBP 2005Comp 3070 Computer Architecture16 Code and Data Memories ALU Mem Reg MemReg ALU Mem Reg MemReg ALU Mem Reg MemReg ALU Mem Reg MemReg ALU Mem Reg MemReg

CBP 2005Comp 3070 Computer Architecture17 add r1,r2 r3 Data Hazard add r3,r1,r2 but need r3 here EARLIER ! add r4,r1,r3 add r1,r3 r4 r3 set here time

CBP 2005Comp 3070 Computer Architecture18 Data Hazard ALU Mem Reg MemReg ALU Mem Reg MemReg ALU Mem Reg MemReg ALU Mem Reg MemReg ALU Mem Reg MemReg add r3,r1,r2 add r4,r1,r3 Need value of r3 for second instruction before the first is complete.

CBP 2005Comp 3070 Computer Architecture19 Pipeline Stalls ALU Mem Reg MemReg ALU Mem Reg MemReg ALU Mem Reg MemReg Mem ALU Reg MemReg Stall ALU Mem Reg MemReg add r3,r1,r2 add r4,r1,r3 Resolve Hazard – Insert delay into second instruction stream. ‘Stall’ Cycles. But this needs extra electronics on the chip. Complex and Costly.

CBP 2005Comp 3070 Computer Architecture20 Forwarding ALU Mem Reg MemReg ALU Mem Reg MemReg ALU Mem Reg MemReg ALU Mem Reg MemReg ALU Mem Reg MemReg add r3,r1,r2 add r4,r1,r3 Need value of r3 for second instruction before the first is complete. So build in extra circuits to get the data as soon as it is available from the ALU

CBP 2005Comp 3070 Computer Architecture21 Compiler resolves Hazard ALU Mem Reg MemReg ALU Mem Reg MemReg ALU Mem Reg MemReg ALU Mem Reg MemReg add r3,r1,r2 add r4,r1,r3 Compile can detect possible hazard and insert 2 nops (‘no ops’) ALU Mem Reg MemReg ALU Mem Reg MemReg nop

CBP 2005Comp 3070 Computer Architecture22 Example op code regs alu mem reg write ld r1,[7] ld r2,[8] add r3,r1,r2 ld r1 [7] ld r2 [8] add r1, r2 r3

CBP 2005Comp 3070 Computer Architecture23 Exercise op code regs alu mem reg write ld r1,[7] add r1,r2,r0 add r3,r1,r2

CBP 2005Comp 3070 Computer Architecture24 Control (branch) Hazard ? beq r1,r2 Test done add r1,r2 r3 st r3 [64] st r2 [68] ld 124 [124]r1 4 beq r1,r2,20 8 add r3,r1,r2 12 st r3,[64] 16 st r2,[68] 20 ld r1,[124] Program may branch to 20 If r1 = r2 branch to 20 Test if r1 = r2 done by ALU. Result known only in stage 4 Run from here now Must FLUSH these

CBP 2005Comp 3070 Computer Architecture25 Branch Hazard Resolution Let’s just assume the branch will NOT be taken So the following instruction needs to be executed And this is already in the pipeline So we make no changes to our CPU hardware design We will be wrong 50% of the time, at a guess. Then we have to flush the pipeline The above assumption is a crude form of Branch Prediction Could keep a branch prediction table storing the results of previous branches. Use this to make a statistics based decision