Part 4 - Exception Hazards – one last kicker 3/24/04 Similar problem as the conditional branch An exception is an involuntary branch from a non-branching.

Slides:



Advertisements
Similar presentations
CML CML CS 230: Computer Organization and Assembly Language Aviral Shrivastava Department of Computer Science and Engineering School of Computing and Informatics.
Advertisements

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.
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.
Pipeline Hazards CS365 Lecture 10. D. Barbara Pipeline Hazards CS465 2 Review  Pipelined CPU  Overlapped execution of multiple instructions  Each on.
Part 2 - Data Hazards and Forwarding 3/24/04++
ENEE350 Ankur Srivastava University of Maryland, College Park Based on Slides from Mary Jane Irwin ( )
Pipeline Exceptions & ControlCSCE430/830 Pipeline: Exceptions & Control CSCE430/830 Computer Architecture Lecturer: Prof. Hong Jiang Courtesy of Yifeng.
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?
Lecture 28: Chapter 4 Today’s topic –Data Hazards –Forwarding 1.
Control Hazards.1 Review: Datapath with Data Hazard Control Read Address Instruction Memory Add PC 4 Write Data Read Addr 1 Read Addr 2 Write Addr Register.
The Processor Data Path & Control Chapter 5 Part 4 – Exception Handling N. Guydosh 3/1/04+
What are Exception and Interrupts? MIPS terminology Exception: any unexpected change in the internal control flow – Invoking an operating system service.
Pipelined Datapath and Control
Comp Sci pipelining 1 Ch. 13 Pipelining. Comp Sci pipelining 2 Pipelining.
Chapter 6 Pipelined CPU Design. Spring 2005 ELEC 5200/6200 From Patterson/Hennessey Slides Pipelined operation – laundry analogy Text Fig. 6.1.
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.
University of Texas at Austin CS352H - Computer Systems Architecture Fall 2009 Don Fussell CS352H: Computer Systems Architecture Topic 9: MIPS Pipeline.
CSIE30300 Computer Architecture Unit 05: Overcoming Data Hazards Hsin-Chou Chi [Adapted from material by and
1 CS/COE0447 Computer Organization & Assembly Language Chapter 5 Part 2.
PROCESSOR PIPELINING YASSER MOHAMMAD. SINGLE DATAPATH DESIGN.
ECE/CS 552: Pipeline Hazards © Prof. Mikko Lipasti Lecture notes based in part on slides created by Mark Hill, David Wood, Guri Sohi, John Shen and Jim.
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.
Spr 2016, Mar 9... ELEC / Lecture 7 1 ELEC / Computer Architecture and Design Spring 2016 Pipeline Control and Performance.
Exceptions and Interrupts “Unexpected” events requiring change in flow of control – Different ISAs use the terms differently Exception – Arises within.
Computer Organization
Exceptions Another form of control hazard Could be caused by…
Computer Organization CS224
Handling Exceptions In MIPS, exceptions managed by a System Control Coprocessor (CP0) Save PC of offending (or interrupted) instruction In MIPS: Exception.
CDA 3101 Spring 2016 Introduction to Computer Organization
Pipelining Chapter 6.
CSCI206 - Computer Organization & Programming
Test 2 review Lectures 5-10.
Morgan Kaufmann Publishers The Processor
ECS 154B Computer Architecture II Spring 2009
Morgan Kaufmann Publishers The Processor
Pipelining: Advanced ILP
Morgan Kaufmann Publishers The Processor
The processor: Exceptions and Interrupts
Pipelining review.
Pipelining Chapter 6.
The processor: Pipelining and Branching
Lecture 9. MIPS Processor Design – Pipelined Processor Design #2
CS/COE0447 Computer Organization & Assembly Language
CS/COE0447 Computer Organization & Assembly Language
Computer Architecture
CSCI206 - Computer Organization & Programming
CSCI206 - Computer Organization & Programming
Data Hazards Data Hazard
Lecture 5. MIPS Processor Design
Pipeline control unit (highly abstracted)
The Processor Lecture 3.6: Control Hazards
Control unit extension for data hazards
Pipeline control unit (highly abstracted)
CS 286 Computer Architecture & Organization
Pipeline Control unit (highly abstracted)
ECE 445 – Computer Organization
Pipelining (II).
Control unit extension for data hazards
Introduction to Computer Organization and Architecture
Pipelining Chapter 6.
Control unit extension for data hazards
Pipelined Datapath Lecture notes from MKP, H. H. Lee and S. Yalamanchili.
CS/COE0447 Computer Organization & Assembly Language
Control Unit (single cycle implementation)
Pipelining - 1.
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,
Need to stall for one cycle.
ELEC / Computer Architecture and Design Spring 2015 Pipeline Control and Performance (Chapter 6) Vishwani D. Agrawal James J. Danaher.
Presentation transcript:

Part 4 - Exception Hazards – one last kicker 3/24/04 Similar problem as the conditional branch An exception is an involuntary branch from a non-branching instruction that caused the exception Example: add $1, $2, $1 # assume the add overflows –We need to immediately branch to the exception handler at entry point address: 0x –Must flush the instructions following the “add” & start fetching from the new address in the exception handler. –Overflow is detected in the EX stage – this is where the “add” will be Must kill the “add” instruction dead in its tracks and not allow it to complete - so it will not clobber $1 – a valuable diagnostic for the programmer. –Do not allow this instruction to write results in WB stage. –Contrast this to the conditional jump, in which the beq instruction (that caused the jump) was allowed to complete.

Exception Hazards: Data Path Changes Insert a nop in the IF stage –Must be done directly – no control signals in IF/ID register –Need new control line, IF.Flush, from main controller Flush instruction in ID stage –Zero out control signals –Need new control line, ID.Flush, from main controller ORed with the stall signal from Hazard Detection Unit for beq Flush instruction in EX stage – the add instruction itself –Zero out control signals –Need new control line, EX.Flush, from main controller –beq did not flush this stage Add additional input to PC MUX providing 0x jump address to the exception handler. Save PC+4 in EPC register – exception handler will have to subtract 4 to get the address of the offending instruction.

Data Path with Exception Hazard Support Fig The selector for the PC MUX must now be 2 bits: a line indicating the exception and the compare output – Not mentioned in book?

An Example Scenario Given the main program: 0x40 sub $11, $2, $4 0x44 and $12, $2, $5 0x48 or $13, $2, $6 0x4C add $1, $2, $1 # overflow happens here 0x50 slt $15, $6, $7 0x54 lw $16, 50($7) Assume the exception handler starts with: 0x sw $25, 1000($0) 0x sw $26, 1004($0) See fig 6.56 for response of data path. –Overflow detected during EX phase –0x forced into PC –Cycle 6 shows the add and following instructions are flushed First instruction of exception handler is fetched address following add is saved in EPC: 0x4C+4 = 0x50

Data Paths for Exception Scenario Fig 6.56