Exceptions and Interrupts “Unexpected” events requiring change in flow of control – Different ISAs use the terms differently Exception – Arises within.

Slides:



Advertisements
Similar presentations
Chapter 4 The Processor. Chapter 4 — The Processor — 2 The Main Control Unit Control signals derived from instruction 0rsrtrdshamtfunct 31:265:025:2120:1615:1110:6.
Advertisements

COMP 4211 Seminar Presentation Based On: Computer Architecture A Quantitative Approach by Hennessey and Patterson Presenter : Feri Danes.
Lecture Objectives: 1)Define pipelining 2)Calculate the speedup achieved by pipelining for a given number of instructions. 3)Define how pipelining improves.
Chapter 4 The Processor CprE 381 Computer Organization and Assembly Level Programming, Fall 2013 Zhao Zhang Iowa State University Revised from original.
Computer Organization and Architecture
Computer Organization and Architecture
Computer Organization and Architecture
CS 61C: Great Ideas in Computer Architecture (Machine Structures) Lecture 36: IO Basics Instructor: Dan Garcia
CIS429/529 Winter 2007 Pipelining II- 1 Additional pipelining topics Why pipelining is so hard: exception handling ILP techniques: loop unrolling.
1 COMP 206: Computer Architecture and Implementation Montek Singh Wed., Sep 24, 2003 Topic: Pipelining -- Intermediate Concepts (Multicycle Operations;
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.
1 Chapter Six - 2nd Half Pipelined Processor Forwarding, Hazards, Branching EE3055 Web:
CSCE 212 Chapter 5 The Processor: Datapath and Control Instructor: Jason D. Bakos.
Pipeline Exceptions & ControlCSCE430/830 Pipeline: Exceptions & Control CSCE430/830 Computer Architecture Lecturer: Prof. Hong Jiang Courtesy of Yifeng.
CIS429.S00: Lec12- 1 Miscellaneous pipelining topics Why pipelining is so hard: exception handling Advanced pipelining techniques: loop unrolling.
The Processor Data Path & Control Chapter 5 Part 4 – Exception Handling N. Guydosh 3/1/04+
CH12 CPU Structure and Function
What are Exception and Interrupts? MIPS terminology Exception: any unexpected change in the internal control flow – Invoking an operating system service.
CS 61C: Great Ideas in Computer Architecture (Machine Structures) Lecture 38: IO and Networking Instructor: Dan Garcia
Presented by: Sergio Ospina Qing Gao. Contents ♦ 12.1 Processor Organization ♦ 12.2 Register Organization ♦ 12.3 Instruction Cycle ♦ 12.4 Instruction.
1 CS/COE0447 Computer Organization & Assembly Language Chapter 5 part 4 Exceptions.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Computer Organization Multi-Cycle Processor.
Interrupt driven I/O. MIPS RISC Exception Mechanism The processor operates in The processor operates in user mode user mode kernel mode kernel mode Access.
CA406 Computer Architecture Pipelines... continued.
Chapter 6 Pipelined CPU Design. Spring 2005 ELEC 5200/6200 From Patterson/Hennessey Slides Pipelined operation – laundry analogy Text Fig. 6.1.
Microprogramming and Exceptions Spring 2005 Ilam University.
Spring 2003CSE P5481 Precise Interrupts Precise interrupts preserve the model that instructions execute in program-generated order, one at a time If an.
Exceptions and Interrputs CS 321 – Introduction to Computer Architecture and Machine-Level Programming Barry Britt, Systems Analyst II Department of Computer.
Chapter 6: Computer Components Dr Mohamed Menacer Taibah University
CS152 Lec12.1 CS 152 Computer Architecture and Engineering Lecture 12 Multicycle Controller Design Exceptions.
University of Texas at Austin CS352H - Computer Systems Architecture Fall 2009 Don Fussell CS352H: Computer Systems Architecture Topic 9: MIPS Pipeline.
Interrupt driven I/O Computer Organization and Assembly Language: Module 12.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Computer Organization Lecture 16 - Multi-Cycle.
LECTURE 10 Pipelining: Advanced ILP. EXCEPTIONS An exception, or interrupt, is an event other than regular transfers of control (branches, jumps, calls,
Interrupts and Exception Handling. Execution We are quite aware of the Fetch, Execute process of the control unit of the CPU –Fetch and instruction as.
CDA 3101 Spring 2016 Introduction to Computer Organization Microprogramming and Exceptions 08 March 2016.
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.
Introduction to Exceptions 1 Introduction to Exceptions ARM Advanced RISC Machines.
Interrupts and exceptions
Digital Logic Design Alex Bronstein
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.
William Stallings Computer Organization and Architecture 8th Edition
Extensions to the Multicycle CPU
Morgan Kaufmann Publishers The Processor
Morgan Kaufmann Publishers The Processor
Exceptions & Multi-cycle Operations
Pipelining: Advanced ILP
Peng Liu Lecture 9 Pipeline Peng Liu
The processor: Exceptions and Interrupts
CSCE 212 Chapter 5 The Processor: Datapath and Control
Processor: Finite State Machine & Microprogramming
The processor: Pipelining and Branching
Computer Organization and ASSEMBLY LANGUAGE
Lecture 9. MIPS Processor Design – Pipelined Processor Design #2
Lecture 5. MIPS Processor Design
Project Instruction Scheduler Assembler for DLX
Interrupts and Exception Handling
CSC3050 – Computer Architecture
ECE 445 – Computer Organization
Control Hazards Branches (conditional, unconditional, call-return)
ECE/CS 552: Pipelining and Exceptions
Pipelined Datapath Lecture notes from MKP, H. H. Lee and S. Yalamanchili.
Interrupts and exceptions
CMSC 611: Advanced Computer Architecture
Presentation transcript:

Exceptions and Interrupts “Unexpected” events requiring change in flow of control – Different ISAs use the terms differently Exception – Arises within the CPU e.g., undefined opcode, overflow, syscall, … Interrupt – From an external I/O controller Dealing with them without sacrificing performance is hard

Handling Exceptions In MIPS, exceptions managed by a System Control Coprocessor (CP0) Save PC of offending (or interrupted) instruction – In MIPS: Exception Program Counter (EPC) Save indication of the problem – In MIPS: Cause register – We’ll assume 1-bit 0 for undefined opcode, 1 for overflow Jump to handler at

An Alternate Mechanism Vectored Interrupts – Handler address determined by the cause Example: – Undefined opcode:C – Overflow:C – …:C Instructions either – Deal with the interrupt, or – Jump to real handler

Handler Actions Read cause, and transfer to relevant handler Determine action required If restartable – Take corrective action – use EPC to return to program Otherwise – Terminate program – Report error using EPC, cause, …

Exceptions in a Pipeline Another form of control hazard Consider overflow on add in EX stage add $1, $2, $1 – Prevent $1 from being clobbered – Complete previous instructions – Flush add and subsequent instructions – Set Cause and EPC register values – Transfer control to handler Similar to mispredicted branch – Use much of the same hardware

Pipeline with Exceptions

Exception Properties Restartable exceptions – Pipeline can flush the instruction – Handler executes, then returns to the instruction Refetched and executed from scratch PC saved in EPC register – Identifies causing instruction – Actually PC + 4 is saved Handler must adjust

Exception Example Exception on add in 40sub $11, $2, $4 44and $12, $2, $5 48or $13, $2, $6 4Cadd $1, $2, $1 50slt $15, $6, $7 54lw $16, 50($7) … Handler sw $25, 1000($0) sw $26, 1004($0) …

Exception Example

Multiple Exceptions Pipelining overlaps multiple instructions – Could have multiple exceptions at once Simple approach: deal with exception from earliest instruction – Flush subsequent instructions – “Precise” exceptions In complex pipelines – Multiple instructions issued per cycle – Out-of-order completion – Maintaining precise exceptions is difficult!

Imprecise Exceptions Just stop pipeline and save state – Including exception cause(s) Let the handler work out – Which instruction(s) had exceptions – Which to complete or flush May require “manual” completion Simplifies hardware, but more complex handler software Not feasible for complex multiple-issue out-of-order pipelines