ELE 455/555 Computer System Engineering. Section 2 The Processor Class 4 Pipelining with Hazards

Similar documents
Outline Single Cycle Processor Design Multi cycle Processor. Pipelined Processor: Hazards and Removal. Instruction Pipeline. Time

A Single Cycle Processor. ECE4680 Computer Organization and Architecture. Designing a Pipeline Processor. Overview of a Multiple Cycle Implementation

CS3350B Computer Architecture. Lecture 6.2: Instructional Level Parallelism: Hazards and Resolutions

Pipelined Implementation

CS650 Computer Architecture. Lecture 5-1 Branch Hazards

Lecture 7: Pipelined Implementation. James C. Hoe Department of ECE Carnegie Mellon University

Data Hazards. Result does not feed back around in time for next operation Pipelining has changed behavior of system. Comb. logic A. R e g.

CPE/EE 427, CPE 527 VLSI Design I L21: Sequential Circuits. Review: The Regenerative Property

VLSI Design I; A. Milenkovic 1

MICROPROCESSOR ARCHITECTURE

Exercise 1: Control Functions

SIDRA INTERSECTION 6.1 UPDATE HISTORY

ECE 757. Homework #2

VLSI Design 14. Memories

Instruction Cache Compression for Embedded Systems by Yujia Jin and Rong Chen

IA-64: Advanced Loads Speculative Loads Software Pipelining

A 64 Bit Pipeline Based Decimal Adder Using a New High Speed BCD Adder

THE CANDU 9 DISTRffiUTED CONTROL SYSTEM DESIGN PROCESS

RM-80 respiration monitor

HW #5: Digital Logic and Flip Flops

Perfect Game Baseball - msherwood pseudo code backbone Using MVC Convention (Model/View/Controller) With Multimodal I/O

If a player has only one match at the championship then the weighting is currently 80% the Final Dynamic and 20% the rating from his one match.

Cover Page for Lab Report Group Portion. Boundary Layer Measurements

FireHawk M7 Interface Module Software Instructions OPERATION AND INSTRUCTIONS

An Efficient Code Compression Technique using Application-Aware Bitmask and Dictionary Selection Methods

Lab 4: Root Locus Based Control Design

THE PROBLEM OF ON-LINE TESTING METHODS IN APPROXIMATE DATA PROCESSING

Domino DUEMMEGI. Domino. Communication Interface DFTS User s Manual. Release September 2007

Standard League Robot Soccer EV3 Compass Training Curriculum Brian Thomas

ME 4710 Motion and Control: Integrator Wind-up Reference: Franklin, Powell, Emami-Naeini, Feedback Control of Dynamic Systems, Prentice-Hall, 2002.

Module 3 Developing Timing Plans for Efficient Intersection Operations During Moderate Traffic Volume Conditions

USER MANUAL. Intelligent Diagnostic Controller IDC24-A IDC24-AF IDC24-AFL IDC24-F IDP24-A * IDP24-AF * IDP24-AFL * IDP24-F * 1/73

SCIENTIFIC DATA SYSTEMS, INC. Depth Tension Line Speed Panel. DTLS Manual

WINNING AND SCORE PREDICTOR (WASP) TOOL

[MYLAPS INTEGRATION]

Safety Critical Systems

A handy systematic method for data hazards detection in an instruction set of a pipelined microprocessor

GOLT! RED LIGHT DISTRICT

DAV CENTENARY COLLEGE, FARIDABAD

Critical Systems Validation

Fast Software-managed Code Decompression

Spacecraft Simulation Tool. Debbie Clancy JHU/APL

Dive Computer NEMO SPORT

Reducing Code Size with Run-time Decompression

Functional safety. Functional safety of Programmable systems, devices & components: Requirements from global & national standards

Instruction Manual. BZ7002 Calibration Software BE

Front-end Realization of ASIC for Traffic Light Control with Real Time Clock Synchronization

Profile-driven Selective Code Compression

SoundCast Design Intro

Technical Bulletin, Communicating with Gas Chromatographs

The Universal Translator

State of Nevada Department of Transportation Materials Division METHOD OF TEST FOR SAND EQUIVALENT

Specifications and information are subject to change without notice. Up-to-date address information is available on our website.

C. Mokkapati 1 A PRACTICAL RISK AND SAFETY ASSESSMENT METHODOLOGY FOR SAFETY- CRITICAL SYSTEMS

Exercise 2-2. Second-Order Interacting Processes EXERCISE OBJECTIVE DISCUSSION OUTLINE. The actual setup DISCUSSION

User s Guide. Pressure Controller for liquid delivery systems

[CROSS COUNTRY SCORING]

2. USER INSTRUCTION. Table of contents: Pg.1/14 N:\FAP-2000: LWP

82C288 BUS CONTROLLER FOR PROCESSORS (82C C C288-8)

Depth Conversion with ISMap

SUPPLEMENT MATERIALS

UNIVERSITY OF WATERLOO

Lane changing and merging under congested conditions in traffic simulation models

CS Lecture 5. Vidroha debroy. Material adapted courtesy of Prof. Xiangnan Kong and Prof. Carolina Ruiz at Worcester Polytechnic Institute

Iteration: while, for, do while, Reading Input with Sentinels and User-defined Functions

Lecture Topics. Overview ECE 486/586. Computer Architecture. Lecture # 9. Processor Organization. Basic Processor Hardware Pipelining

Adam Equipment. DENSITY DETERMINATION KIT for AAA, ADA and ADP SERIES BALANCES OPERATOR S MANUAL

SAPCON. User Manual. Capacitance Continuous Level Indicator. . Introduction. . General Description. . Principle of Operation. .

Gas Module for Series GMS800

An Architecture for Combined Test Data Compression and Abort-on-Fail Test

KAPPA KWIZ BOWL - Game Play Rules The following are the rules and format for the Kappa Kwiz Bowl

Shearwater GF Computer

A 28nm SoC with a 1.2GHz 568nJ/ Prediction Sparse Deep-Neural-Network Engine with >0.1 Timing Error Rate Tolerance for IoT Applications

Sequence of Operations

Provably Secure Camouflaging Strategy for IC Protection

CONTROL LOGIC DESCRIPTION DOCUMENT IC-410ND

Modeling of Hydraulic Hose Paths

Landsat 8's Emergency RMM

Wire Buddy Manual IOpath Software

Horse Farm Management s Report Writer. User Guide Version 1.1.xx

Control System Nur Istianah-THP-FTP-UB-2014

Using the UltraRAE. Firmware 2.35

Savannah S100 ALD at SCIF, UC Merced Standard operating Procedure

1) The loop is almost completely in the field. 2) The speed of the loop is tripled. 3) The field direction is reversed.

EMI 3a: Moving Rectangular Loops and Uniform Magnetic Fields-Current... 2

Courseware Sample F0

Software Reliability 1

Intelligent Decision Making Framework for Ship Collision Avoidance based on COLREGs

SIP 1000 OPERATION AND PROGRAMMING MANUAL

Valve Communication Solutions Axiom

Laboratory 2(a): Interfacing WiiMote. Authors: Jeff C. Jensen (National Instruments) Trung N. Tran (National Instruments)

Missing no Interaction Using STPA for Identifying Hazardous Interactions of Automated Driving Systems

Stand-Alone Bubble Detection System

Section 10 - Hydraulic Analysis

RESOLUTION MSC.137(76) (adopted on 4 December 2002) STANDARDS FOR SHIP MANOEUVRABILITY

MSD 96-Well MULTI-ARRAY and MULTI-SPOT Human Granulocyte Colony Stimulating Factor (hg-csf) Ultrasensitive Assay

STICTION: THE HIDDEN MENACE

How to use the PBM Flow Calculator Spreadsheet (V2.04)

Valve Communication Solutions. Safety instrumented systems

CT PET-2018 Part - B Phd COMPUTER APPLICATION Sample Question Paper

Transcription:

ELE 455/555 Computer System Engineering Section 2 The Processor Class 4 Pipelining with Hazards

Overview Simple Datapath 2 tj

Overview Pipeline Control 3 tj

Data Hazards Data Hazards sub $2,$1,$3 $2 =? sub $2, $1,$3 and $12,$2,$5 or $13,$6,$2 add $14,$2,$2 sw $15,100($2) 4 tj

Data Hazards Data Hazards sub $2,$1,$3 and $12,$2,$5 $2 =? sub $2, $1,$3 and $12,$2,$5 or $13,$6,$2 add $14,$2,$2 sw $15,100($2) 5 tj

Data Hazards Data Hazards or $13,$6,$2 and $12,$2,$5 sub $2,$1,$3 sub $2, $1,$3 and $12,$2,$5 or $13,$6,$2 add $14,$2,$2 sw $15,100($2) $2 =? 6 tj

Data Hazards Data Hazards or $13,$6,$2 and $12,$2,$5 sub $2,$1,$3 add $14,$2,$2 $2 =? sub $2, $1,$3 and $12,$2,$5 or $13,$6,$2 add $14,$2,$2 sw $15,100($2) 7 tj

Data Hazards Data Hazards add $14,$2,$2 or $13,$6,$2 and $12,$2,$5 sub $2,$1,$3 sw $15,100($2) $2 = val sub $2, $1,$3 and $12,$2,$5 or $13,$6,$2 add $14,$2,$2 sw $15,100($2) 8 tj

Data Hazards Data Hazards 9 tj

Data Hazards Forwarding 10 tj

Data Hazards Detecting the need for Forwarding Terminology: ID/EX.RegisterRs = register # whose value is found in register ID/EX from read data 1 in the register file ID/EX.RegisterRt = register # whose value is found in register ID/EX from read data 2 in the register file Eg. sub $2, $1, $3 // in execute stage ID/EX.RegisterRs = $1 ID/EX.RegisterRt = $3 EX/MEM.RegisterRd= destination register # whose value is found in register EX/MEM MEM/WB.RegisterRd= destination register # whose value is found in register MEM/WB 11 tj

Data Hazards Detecting the need for Forwarding Conditions: 1a) EX/MEM.RegisterRd = ID/EX.RegisterRs EX/MEM currently holds a value needed by an instruction about to enter EX 1b) ) EX/MEM.RegisterRd = ID/EX.RegisterRt EX/MEM currently holds a value needed by an instruction about to enter EX 2a) MEM/WB.RegisterRd = ID/EX.RegisterRs MEM/WB currently holds a value needed by an instruction about to enter EX 2b) MEM/WB.RegisterRd = ID/EX.RegisterRt MEM/WB currently holds a value needed by an instruction about to enter EX 12 tj

Data Hazards Detecting the need for Forwarding sub $2, $1,$3 and $12,$2,$5 or $13,$6,$2 add $14,$2,$2 sw $15,100($2) sub-and is a type 1a hazard and Rs ($2) needs result of sub (Rd in EX/MEM) sub-or is a type 2b hazard or Rt ($2) needs result from sub (Rd in MEM/WB) sub-add is not a hazard due to write/read policy 13 tj

Data Hazards Implementing Forwarding Need Rd in EX/MEM and MEM/WB registers We are already doing this to support proper WB Need to multiplex the ALU output from EX/MEM and the WB output from MEM/WB into the ALU inputs Need control to manage the decision process Inputs: Rs, Rt, Rd from EX/MEM, Rd from MEM/WB aka: ID/EX.RegisterRs, ID/EX.RegisterRt, EX/MEM.RegisterRd, MEM/WB.RegisterRd) Outputs: ALU input mux control A, ALU input mux control B 14 tj

Data Hazards Implementing Forwarding 15 tj

Data Hazards Implementing Forwarding 2 additional conditions for forwarding Only forward when a register write is part of the instruction Only forward when the register write is not to register $0 16 tj

Data Hazards Implementing Forwarding EX hazard if (EX/MEM.RegWrite and (EX/MEM.RegisterRd 0) and (EX/MEM.RegisterRd = ID/EX.RegisterRs)) ForwardA = 10 if (EX/MEM.RegWrite and (EX/MEM.RegisterRd 0) and (EX/MEM.RegisterRd = ID/EX.RegisterRt)) ForwardB = 10 MEM hazard if (MEM/WB.RegWrite and (MEM/WB.RegisterRd 0) and (MEM/WB.RegisterRd = ID/EX.RegisterRs)) ForwardA = 01 if (MEM/WB.RegWrite and (MEM/WB.RegisterRd 0) and (MEM/WB.RegisterRd = ID/EX.RegisterRt)) ForwardB = 01 17 tj

Data Hazards Implementing Forwarding 1 more condition Double Data Hazard add $1,$1,$2 add $1,$1,$3 add $1,$1,$4 Both hazards occur Want to use the most recent Revise MEM hazard condition Only forward if EX hazard condition isn t true 18 tj

Data Hazards Implementing Forwarding EX hazard if (EX/MEM.RegWrite and (EX/MEM.RegisterRd 0) and (EX/MEM.RegisterRd = ID/EX.RegisterRs)) ForwardA = 10 if (EX/MEM.RegWrite and (EX/MEM.RegisterRd 0) and (EX/MEM.RegisterRd = ID/EX.RegisterRt)) ForwardB = 10 MEM hazard if (MEM/WB.RegWrite and (MEM/WB.RegisterRd 0) and not (EX/MEM.RegWrite and (EX/MEM.RegisterRd 0) and (EX/MEM.RegisterRd = ID/EX.RegisterRs)) and (MEM/WB.RegisterRd = ID/EX.RegisterRs)) ForwardA = 01 if (MEM/WB.RegWrite and (MEM/WB.RegisterRd 0) and not (EX/MEM.RegWrite and (EX/MEM.RegisterRd 0) and (EX/MEM.RegisterRd = ID/EX.RegisterRt)) and (MEM/WB.RegisterRd = ID/EX.RegisterRt)) ForwardB = 01 19 tj

Data Hazards Implementing Forwarding 20 tj

Stall Stalling the pipeline and inserting a bubble Consider a load-use hazard 21 tj

Stall Stalling the pipeline and inserting a bubble Load-use hazard Cannot be resolved with forwarding stall Check for a memory read value in an instruction in the execute stage Do this in the ID stage Load-use hazard: ID/EX.MemRead and ((ID/EX.RegisterRt = IF/ID.RegisterRs) or (ID/EX.RegisterRt = IF/ID.RegisterRt)) When true stall the pipeline 22 tj

Stall Stalling the pipeline and inserting a bubble Force the control values (for EX, MEM, and WB) to 0 in the ID/EX stage 0 for the control signals causes nothing to happen Prevent the PC from updating Prevent the IF/ID register from updating On next clock will reload the same value into IF/ID At the same time the LW instruction progresses to the MEM stage and the value is available to be forwarded 23 tj

Stall Stalling the pipeline and inserting a bubble 24 tj

Stall Stalling the pipeline and inserting a bubble 25 tj

Stall Stalling the pipeline and inserting a bubble 26 tj

Control Hazards Branch Hazard Consider the following code snippit beq $1, $3, skip and $13, $6, $2 add $14, $2, $2 skip lw $4, 50($7) The branch decision is known after the calculation of the branch address and the comparison (subtract and check for zero), and is available in the MEM stage If the branch is ignored we will have the and, add and lw instructions in the pipeline all is well If the branch is taken we will have the and, add and lw instructions in the pipeline but we do not want them to execute 27 tj

Control Hazards Branch Hazard 28 tj

Control Hazards Branch Hazard In our current implementation We assume branches are not taken We would need to flush the pipeline for taken branches Branch decision is available in the MEM stage Assuming the branch target is not already in the pipeline inserting 3 bubbles into the pipeline? How far can we move the decision forward to reduce the impact of taken branches 29 tj

Overview Pipeline Control 30 tj

Control Hazards Branch Hazard Most branches are simple comparisons equal all bits the same negative/positive look at msb We can move most of the branch prediction logic forward to the ID stage We have register values (some may be forwarded!) Need to modify the forwarding logic to account for branches We can move the branch address calculation forward to the ID stage Still have a single cycle stall IF of the next instruction is occurring in parallel with ID detection of the taken branch 31 tj

Control Hazards Branch Hazard Consider this code snippit sub $10, $4, $8 beq $1, $3, skip and $12, $2, $5 or $13, $2, $6 add $14, $4, $2 skip lw $4, 50($7) 32 tj

Control Hazards Branch Hazard skip 33 tj

Control Hazards Branch Hazard skip 34 tj

Control Hazards Branch Hazard This approach reduces the impact of branch hazards There may still be data hazards that cannot be avoided Branch dependent on ALU output from previous instruction add $4, $5, $6 beq $1, $4, skip during the beq ID stage, the add is in EX stage and $4 is not available 1 stall cycle 35 tj

Control Hazards Branch Hazard This approach reduces the impact of branch hazards There may still be data hazards that cannot be avoided Branch dependent on previous lw instruction lw $1, 50($7) beq $1, $4, skip the lw result will not be available until the MEM cycle is complete 2 stall cycles 36 tj

Control Hazards Branch Prediction For deeper pipelines the cost of missing a branch decision can be significant many clock cycles lost Leads to dynamic branch prediction Keep track if branch was previously taken or not Load either the next instruction or the target instruction based on prediction value 37 tj

Control Hazards Dynamic Branch Prediction 1 bit Use a small branch prediction buffer n words deep 1 bit of prediction value (1 bit word) n is derived from the PC value last 8 bits of PC 256 words deep The PC value references one of n predictions values Assuming a branch instruction Take the branch if the prediction value is set to 1 Don t take the branch if the prediction value is set to 0 If the prediction was wrong invert the prediction value 38 tj

Control Hazards Dynamic Branch Prediction 1 bit PC Branch Table ADDR B 0x00000000 0 0x00000001 0 0x00000010 1 0x11111110 1 0x11111111 1 39 tj

Control Hazards Dynamic Branch Prediction 1 bit Issues Multiple PC values point to the same branch table location over write each other wrong guesses Each incorrect guess can lead to 2 wrong guesses eg. Assume mostly loop back bit set to 1 when you do not loop back you stall and set bit to 0 next cycle you want to loop back but bit is 0 stall and set bit to 1 2 stalls 40 tj

Control Hazards Dynamic Branch Prediction 2 bit Use 2 bits to make prediction decisions Only change the prediction on 2 successive mispredictions Resolves the 2 stall issue of 1 bit prediction PC Branch Table ADDR B1 B0 0x00000000 0 0 0x00000001 0 0 0x00000010 1 0 0x11111110 0 1 0x11111111 1 1 41 tj

Control Hazards Dynamic Branch Prediction 2 bit 42 tj

Control Hazards Dynamic Branch Prediction n bit Use n bits to make prediction decisions Use a saturated up/down counter for each table entry Only change prediction when MSB toggles PC Branch Table ADDR B7 B6 B5 B4 B3 B2 B1 B0 0x00000000 0 0 0 1 0 0 1 0 0x00000001 0 1 1 0 0 0 0 0 0x00000010 1 0 1 0 1 0 1 0 0x11111110 0 1 0 1 0 1 0 1 0x11111111 1 1 0 1 0 1 1 0 43 tj