1 Pipelining CDA 3101 Discussion Section 08. 2 Question 1 – 6.1 Suppose that time for an ALU operation can be shortened by 25% in the following figure.

Slides:



Advertisements
Similar presentations
Advanced Computer Architectures Laboratory on DLX Pipelining Vittorio Zaccaria.
Advertisements

Pipeline Computer Organization II 1 Hazards Situations that prevent starting the next instruction in the next cycle Structural hazards – A required resource.
Intro to Computer Org. Pipelining, Part 2 – Data hazards + Stalls.
Lecture Objectives: 1)Define pipelining 2)Calculate the speedup achieved by pipelining for a given number of instructions. 3)Define how pipelining improves.
CMPT 334 Computer Organization
Goal: Describe Pipelining
Chapter Six 1.
Instructor: Senior Lecturer SOE Dan Garcia CS 61C: Great Ideas in Computer Architecture Pipelining Hazards 1.
ECE 445 – Computer Organization
S. Barua – CPSC 440 CHAPTER 6 ENHANCING PERFORMANCE WITH PIPELINING This chapter presents pipelining.
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  2004 Morgan Kaufmann Publishers Chapter Six. 2  2004 Morgan Kaufmann Publishers Pipelining The laundry analogy.
Chapter Six Enhancing Performance with Pipelining
Pipelining Andreas Klappenecker CPSC321 Computer Architecture.
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?
King Fahd University of Petroleum and Minerals King Fahd University of Petroleum and Minerals Computer Engineering Department Computer Engineering Department.
CSCE 212 Quiz 9a – 4/1/11 For the following questions, assume the clock cycle times given above and the following set of instructions: lw $5, -16($5) sw.
Pipelined Datapath and Control (Lecture #15) ECE 445 – Computer Organization The slides included herein were taken from the materials accompanying Computer.
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.
1 Pipelining Reconsider the data path we just did Each instruction takes from 3 to 5 clock cycles However, there are parts of hardware that are idle many.
Memory/Storage Architecture Lab Computer Architecture Pipelining Basics.
Pipelined Datapath and Control
Computer Organization CS224 Fall 2012 Lesson 28. Pipelining Analogy  Pipelined laundry: overlapping execution l Parallelism improves performance §4.5.
Pipelining Enhancing Performance. Datapath as Designed in Ch. 5 Consider execution of: lw $t1,100($t0) lw $t2,200($t0) lw $t3,300($t0) Datapath segments.
Comp Sci pipelining 1 Ch. 13 Pipelining. Comp Sci pipelining 2 Pipelining.
Chapter 4 The Processor. Chapter 4 — The Processor — 2 Introduction We will examine two MIPS implementations A simplified version A more realistic pipelined.
Pipeline Hazards. CS5513 Fall Pipeline Hazards Situations that prevent the next instructions in the instruction stream from executing during its.
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.
CSIE30300 Computer Architecture Unit 04: Basic MIPS Pipelining Hsin-Chou Chi [Adapted from material by and
5/13/99 Ashish Sabharwal1 Pipelining and Hazards n Hazards occur because –Don’t have enough resources (ALU’s, memory,…) Structural Hazard –Need a value.
2/15/02CSE Data Hazzards Data Hazards in the Pipelined Implementation.
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.
1  1998 Morgan Kaufmann Publishers Chapter Six. 2  1998 Morgan Kaufmann Publishers Pipelining Improve perfomance by increasing instruction throughput.
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.
Lecture 9. MIPS Processor Design – Pipelined Processor Design #1 Prof. Taeweon Suh Computer Science Education Korea University 2010 R&E Computer System.
Pipelining Intro Computer Organization 1 Computer Science Dept Va Tech January 2006 ©2006 McQuain & Ribbens Basic Instruction Timings Making some assumptions.
EECS 370 Discussion 1 Calvin and Hobbes by Bill Watterson.
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.
Chapter Six.
CS2100 Computer Organization
CDA3101 Recitation Section 8
Pipelining Chapter 6.
CSCI206 - Computer Organization & Programming
Single Clock Datapath With Control
Pipeline Implementation (4.6)
CDA 3101 Spring 2016 Introduction to Computer Organization
Pipelining review.
Pipelining Chapter 6.
CSCI206 - Computer Organization & Programming
CSCI206 - Computer Organization & Programming
Chapter Six.
Chapter Six.
Pipelining: Basic Concepts
Pipelining Chapter 6.
Appendix C Practice Problem Set 1
Data Hazard Example (no stalls).
Pipelining Chapter 6.
Systems Architecture II
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,
Presentation transcript:

1 Pipelining CDA 3101 Discussion Section 08

2 Question 1 – 6.1 Suppose that time for an ALU operation can be shortened by 25% in the following figure a. Will it affect the speedup obtained from pipelining? If yes, by how much? If no, why? b. What if the ALU operation now takes 25% more time?

3 Question 1 Shortening time for an ALU operation by 25% The slowest stage time for pipeline still remains 200ps(IF and MEM stage) The single-cycle one will be reduced from 800ps to 750ps Original speedup = 800/200 = 4 New Speedup =750/200=3.75

4 Question 1 Lengthening time for ALU operation by 25% It will affect the speedup obtained from pipelining because the slowest stage time will be 250ps. New speedup = 850/250 = 3.4 Therefore, speedup is 15% less

5 Question 2 – 6.4 Identify all of the data dependencies in the following code. add $3, $4, $2 sub $5, $3, $1 lw $6, 200($3) add $7, $3, $6 a. Which dependencies are data hazards that will be resolved via forwarding? b. Which dependencies are data hazards that will cause a stall?

6 Question 2 Data Dependencies 1. Data dependency through $3 between the first instruction and each subsequent instructions 2. Data dependency through $6 between the last instruction and lw instruction Dependencies that will be resolved via forwarding Dependencies between the first instruction and each subsequent instruction can be resolved via forwarding Dependencies that will cause a stall Dependencies between the last instruction and lw instruction cannot be resolved via forwarding, so it will cause a stall

7 Question 2 InstructionCC1CC2CC3CC4CC5CC6CC7CC8CC9 add $3,$3,$2IFIDEXMEMWB sub $5,$3,$1IFIDEXMEMWB lw $6,200($3)IFIDEXMEMWB stall add $7,$3,$6IFIDEXMEMWB

8 Question 3 – 6.22 Consider executing the following code on the pipelined datapath of Figure 6.36 lw $4, 100($2) sub $6, $4, $3 add $2, $3, $5 a. Draw a diagram that illustrates the dependencies that need to be resolved b. Provide another diagram that illustrates how the code will actually be executed c. How many cycles will it take to execute this code?

9 Question 3 Cont. Figure 6.36

10 Question 3-1 Diagram that illustrates the dependencies that need to be resolved InstructionCC1CC2CC3CC4CC5CC6CC7 lw $4,100($2)IFIDEXMEMWB sub $6,$4,$3IFIDEXMEMWB add $2,$3,$5IFIDEXMEMWB

11 Question 3-2 Diagram that illustrates how the code will actually be executed InstructionCC1CC2CC3CC4CC5CC6CC7CC8 lw $4,100($2)IFIDEXMEMWB stall sub $6,$4,$3IFIDEXMEMWB add $2,$3,$5IFIDEXMEMWB

12 Question 3-3 Total cycles to execute the code is 8 InstructionCC1CC2CC3CC4CC5CC6CC7CC8 lw $4,100($2)IFIDEXMEMWB stall sub $6,$4,$3IFIDEXMEMWB add $2,$3,$5IFIDEXMEMWB

13 Question 4-1 Look at the following code. The pipelined datapath is given on the previous question addi $t0, $t0, 4 lw $v0, 0($t0) sw $v0, 20($t1) lw $s0, 60($t0) add $s1, $s0, $s0 sub $s1, $s1, $s0 sub $s4, $s1, $s5 a. Determine where the hazards occur and on which register and write it against each instruction above

14 Question 4-1 addi $t0, $t0, 4 lw $v0, 0($t0)data hazard on $t0 sw $v0, 20($t1)data hazard on $v0 lw $s0, 60($t0) add $s1, $s0, $s0data hazard on $s0 sub $s1, $s1, $s0data hazard on $s1 sub $s4, $s1, $s5data hazard on $s1

15 Question 4-2 b. Indicate in the chart below what stage each instruction is in what cycle, where forwarding occurs (draw an arrow from where the value is produced to where the value is used), and where stalls or flushed occur. In the chart below, you may have more/less spaces than you need. Make sure you fill in the instructions in the first column as they would execute InstructionCC1CC2CC3CC4CC5CC6CC7CC8CC9CC10CC11

16 Question 4-2 InstructionCC1CC2CC3CC4CC5CC6CC7CC8CC9CC10CC11CC12 addi $t0,$t0,4IFIDEXMEMWB lw $v0,0($t0)IFIDEXMEMWB sw $v0,20($t1)IFIDEXMEMWB lw $s0,60($t0)IFIDEXMEMWB stall Stall add $s1,$s0,$s0IFIDEXMEMWB sub $s1,$s1,$s0IFIDEXMEMWB add $s4,$s1,$s5IFIDEXMEMWB

17 Question 4-3 c. Which two registers of the register file are being read in cycle 8? $s0, $s1 InstructionCC1CC2CC3CC4CC5CC6CC7CC8CC9CC10CC11CC12 addi $t0,$t0,4IFIDEXMEMWB lw $v0,0($t0)IFIDEXMEMWB sw $v0,20($t1)IFIDEXMEMWB lw $s0,60($t0)IFIDEXMEMWB stall Stall add $s1,$s0,$s0IFIDEXMEMWB sub $s1,$s1,$s0IFIDEXMEMWB add $s4,$s1,$s5IFIDEXMEMWB

18 Question 4-4 d. How many cycles does it take to execute the above code completely? 12 InstructionCC1CC2CC3CC4CC5CC6CC7CC8CC9CC10CC11CC12 addi $t0,$t0,4IFIDEXMEMWB lw $v0,0($t0)IFIDEXMEMWB sw $v0,20($t1)IFIDEXMEMWB lw $s0,60($t0)IFIDEXMEMWB stall Stall add $s1,$s0,$s0IFIDEXMEMWB sub $s1,$s1,$s0IFIDEXMEMWB add $s4,$s1,$s5IFIDEXMEMWB

19 Question 4-5 e. Can you reorder the code to reduce the number of cycles it takes to execute this code, without changing the code result? If yes, show how. Switch the instructions: sw $v0,20($t1) with lw $s0,60($t0) InstructionCC1CC2CC3CC4CC5CC6CC7CC8CC9CC10CC11 addi $t0,$t0,4IFIDEXMEMWB lw $v0,0($t0)IFIDEXMEMWB lw $s0,60($t0)IFIDEXMEMWB sw $v0,20($t1)IFIDEXMEMWB add $s1,$s0,$s0IFIDEXMEMWB sub $s1,$s1,$s0IFIDEXMEMWB add $s4,$s1,$s5IFIDEXMEMWB

Question 4-5 Switching load and store instruction is VERY dangerous! The load and store address may be same under certain conditions. Another kind of data dependence (memory correctness). Don’t change the order of lw/sw unless you are 100% sure. 20