EECS 370 Discussion 1 xkcd.com. EECS 370 Discussion Topics Today: – Control Hazards – Branch Prediction – Project 3 – stackoverflow Example 2.

Slides:



Advertisements
Similar presentations
Morgan Kaufmann Publishers The Processor
Advertisements

Pipeline Summary Try to put everything together for pipelines Before going onto caches. Peer Instruction Lecture Materials for Computer Architecture by.
Pipelining and Control Hazards Oct
Lecture Objectives: 1)Define pipelining 2)Calculate the speedup achieved by pipelining for a given number of instructions. 3)Define how pipelining improves.
Pipeline Hazards Pipeline hazards These are situations that inhibit that the next instruction can be processed in the next stage of the pipeline. This.
1 A few words about the quiz Closed book, but you may bring in a page of handwritten notes. –You need to know what the “core” MIPS instructions do. –I.
MIPS Pipelined Datapath
The Light at the End of the Tunnel – Doesn’t Mean You Died ! Part 3 - Branch Hazards – Easier! – 3/24/04 This is a control hazard – as opposed to data.
Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Pipeline Hazards See: P&H Chapter 4.7.
Pipeline Control Hazards and Instruction Variations Hakim Weatherspoon CS 3410, Spring 2011 Computer Science Cornell University See P&H Appendix 4.8 &
Pipeline Hazards Hakim Weatherspoon CS 3410, Spring 2011 Computer Science Cornell University See P&H Appendix 4.7.
Pipeline Control Hazards and Instruction Variations Hakim Weatherspoon CS 3410, Spring 2011 Computer Science Cornell University See P&H Appendix 4.8 &
ENEE350 Ankur Srivastava University of Maryland, College Park Based on Slides from Mary Jane Irwin ( )
EECS 470 Pipeline Control Hazards Lecture 5 Coverage: Chapter 3 & Appendix A.
EECS 470 Pipeline Hazards Lecture 4 Coverage: Appendix A.
CIS429.S00: Lec10- 1 Control Hazards Created by branch statements BEQZLOC ADDR1,R2,R3. LOCSUBR1,R2,R3 PC needs to be computed but it happens too late in.
1  2004 Morgan Kaufmann Publishers Chapter Six. 2  2004 Morgan Kaufmann Publishers Pipelining The laundry analogy.
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.
Goal: Reduce the Penalty of Control Hazards
CIS629 Fall 2002 Pipelining 2- 1 Control Hazards Created by branch statements BEQZLOC ADDR1,R2,R3. LOCSUBR1,R2,R3 PC needs to be computed but it happens.
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?
1 Lecture 18: Pipelining Today’s topics:  Hazards and instruction scheduling  Branch prediction  Out-of-order execution Reminder:  Assignment 7 will.
Pipelined Datapath and Control (Lecture #15) ECE 445 – Computer Organization The slides included herein were taken from the materials accompanying Computer.
Memory/Storage Architecture Lab Computer Architecture Pipelining Basics.
Computer Science Education
Comp Sci pipelining 1 Ch. 13 Pipelining. Comp Sci pipelining 2 Pipelining.
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.
CS 352 : Computer Organization and Design University of Wisconsin-Eau Claire Dan Ernst Pipelining Basics.
CS 1104 Help Session IV Five Issues in Pipelining Colin Tan, S
ECE 353 Lab 2 Pipeline Simulator. Aims Further experience in C programming Handling strings Further experience in the use of assertions Reinforce concepts.
Winter 2002CSE Topic Branch Hazards in the Pipelined Processor.
EECS 370 Discussion 1 xkcd.com. EECS 370 Discussion Mid-semester Feedback Thanks! 2.
Adapted from Computer Organization and Design, Patterson & Hennessy, UCB ECE232: Hardware Organization and Design Part 13: Branch prediction (Chapter 4/6)
10/11: Lecture Topics Execution cycle Introduction to pipelining
Introduction to Computer Organization Pipelining.
PROCESSOR PIPELINING YASSER MOHAMMAD. SINGLE DATAPATH DESIGN.
EECS 370 Discussion 1 Sample Exam Questions. EECS 370 Discussion 2 Not Really… xkcd.com.
EECS 370 Discussion 1 Calvin and Hobbes by Bill Watterson.
Simulator Outline of MIPS Simulator project  Write a simulator for the MIPS five-stage pipeline that does the following: Implements a subset of.
Pipelining: Implementation CPSC 252 Computer Organization Ellen Walker, Hiram College.
EECS 370 Discussion smbc-comics.com.
Computer Organization CS224
Pipelining Chapter 6.
CSCI206 - Computer Organization & Programming
Test 2 review Lectures 5-10.
Single Clock Datapath With Control
ECE 353 Lab 3 Pipeline Simulator
Chapter 4 The Processor Part 4
CDA 3101 Spring 2016 Introduction to Computer Organization
Test 2 review Lectures 5-10.
Chapter 4 The Processor Part 3
Morgan Kaufmann Publishers The Processor
Pipelining review.
Pipelining Chapter 6.
The processor: Pipelining and Branching
Lecture 19: Branches, OOO Today’s topics: Instruction scheduling
Current Design.
Lecture 18: Pipelining Today’s topics:
Lecture 18: Pipelining Today’s topics:
Pipelining in more detail
CSCI206 - Computer Organization & Programming
Lecture 19: Branches, OOO Today’s topics: Instruction scheduling
The Processor Lecture 3.6: Control Hazards
Control unit extension for data hazards
Lecture 20: OOO, Memory Hierarchy
Lecture 18: Pipelining Today’s topics:
Control unit extension for data hazards
Control unit extension for data hazards
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,
Presentation transcript:

EECS 370 Discussion 1 xkcd.com

EECS 370 Discussion Topics Today: – Control Hazards – Branch Prediction – Project 3 – stackoverflow Example 2

EECS 370 Discussion Control Hazards Key Concept Which LC-2K instruction(s) can cause a Control Hazard? In which stage are branches resolved? 3

EECS 370 Discussion Control Hazards Key Concept Which LC-2K instruction(s) can cause a Control Hazard? BEQ & JALR In which stage are branches resolved? MEM 4

EECS 370 Discussion Control Hazards Problem: If we don’t know what the next PC should be what do we do? Options: No Branches Avoid Detect-and-stall Speculate-and-squash 5

EECS 370 Discussion Control Hazards 1)No Branches Is this a feasible solution? How could we eliminate this if statement? if (r0 == r1) { r2 = r3; } else { r2++; } 6

EECS 370 Discussion Control Hazards 1)No Branches Is this a feasible solution? How could we eliminate this if statement? Conditional Assembly! if (r0 == r1) { r2 = r3; } else { r2++; } 7 cmp r0, r1 moveq r2, r3 addne r2, r2, #1

EECS 370 Discussion Control Hazards 2)Avoid ADD NAND BEQ 3 0 jump ADD NAND jump ADD NAND

EECS 370 Discussion Control Hazards 3)Detect-and-stall Any better than avoid? 9

EECS 370 Discussion Control Hazards 4)Speculate-and-squash Guess! What do you have to do if you’re correct? What do you have to do if you’re wrong? 10

EECS 370 Discussion Control Hazards 4)Speculate-and-squash Guess! What do you have to do if you’re correct? Nothing at all What do you have to do if you’re wrong? Turn IF, ID, & EX into Noops 11

EECS 370 Discussion Branch Prediction Based on the PC What did this branch do last time? 1-bit predictor 12 Not Taken Taken Not Taken

EECS 370 Discussion Branch Prediction 2-bit predictor 13 Weakly Taken Strongly Taken Taken Not Taken Strongly Not Taken Weakly Not Taken Taken Not Taken Taken Not Taken

EECS 370 Discussion Branch Prediction What does the PC become if we predict Not Taken? What does the PC become if we predict Taken? 14

EECS 370 Discussion Branch Prediction What does the PC become if we predict Not Taken? PC+1 What does the PC become if we predict Taken? ??? 15

EECS 370 Discussion Branch Prediction Branch Target Buffer Maps PC values to Addresses 16 PCAddress 0x12340x x45230x xA3420x xFF760x0000A342

EECS 370 Discussion Branch Prediction Do we branch? Where? 17 PCAddress 0x12340x x45230x xA3420x xFF760x0000A342 PCAddress 0x1234 0x4523 0xA342 0xFF76 PC

EECS 370 Discussion Project 3 Make your own pipelined processor Need to use code for the file input from Project 1 Write non-hazard code first Design good test code!! 18

EECS 370 Discussion WBEND Register and Forwarding 19 WBEND

EECS 370 Discussion 20 stackoverflow example Real-world example. Why this stuff matters. processing-a-sorted-array-faster-than-an-unsorted-array

EECS 370 Discussion 21

EECS 370 Discussion 22 With this line: 6.54 seconds Without: seconds

EECS 370 Discussion 23 With this line: 1.93 seconds Without: seconds

EECS 370 Discussion 24 Why is this happening? What is causing the time differences?

EECS 370 Discussion 25 Branch Prediction!