Interrupts and exceptions

Slides:



Advertisements
Similar presentations
COMP 4211 Seminar Presentation Based On: Computer Architecture A Quantitative Approach by Hennessey and Patterson Presenter : Feri Danes.
Advertisements

Computer Organization and Architecture
CIS429/529 Winter 2007 Pipelining II- 1 Additional pipelining topics Why pipelining is so hard: exception handling ILP techniques: loop unrolling.
Architectural Support for OS March 29, 2000 Instructor: Gary Kimura Slides courtesy of Hank Levy.
1 COMP 206: Computer Architecture and Implementation Montek Singh Wed., Sep 24, 2003 Topic: Pipelining -- Intermediate Concepts (Multicycle Operations;
Review CSE 4711 Computer Design and Organization Architecture = Design + Organization + Performance Topics in this class: –Central processing unit: deeply.
Pipeline Exceptions & ControlCSCE430/830 Pipeline: Exceptions & Control CSCE430/830 Computer Architecture Lecturer: Prof. Hong Jiang Courtesy of Yifeng.
Computer System Organization S H Srinivasan
EENG449b/Savvides Lec 4.1 1/22/04 January 22, 2004 Prof. Andreas Savvides Spring EENG 449bG/CPSC 439bG Computer.
ENGS 116 Lecture 61 Pipelining Difficulties and MIPS R4000 Vincent H. Berk October 6, 2008 Reading for today: A.3 – A.4, article: Yeager Reading for Wednesday:
CIS429.S00: Lec12- 1 Miscellaneous pipelining topics Why pipelining is so hard: exception handling Advanced pipelining techniques: loop unrolling.
EECC551 - Shaaban #1 Lec # 4 winter Data Hazards Requiring Stall Cycles In some code sequence cases, potential data hazards cannot be handled.
The Processor Data Path & Control Chapter 5 Part 4 – Exception Handling N. Guydosh 3/1/04+
1 Manchester Mark I, This was the second (the first was a small- scale prototype) machine built at Cambridge. A production version of this computer.
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.
Interrupts / Exceptions / Faults Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology April 30, 2012L21-1
Lecture 5: Pipelining Implementation Kai Bu
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.
1 CSE451 Architectural Supports for Operating Systems Autumn 2002 Gary Kimura Lecture #2 October 2, 2002.
Operating Systems 1 K. Salah Module 1.2: Fundamental Concepts Interrupts System Calls.
Microprogramming and Exceptions Spring 2005 Ilam University.
Constructive Computer Architecture Interrupts/Exceptions/Faults Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology.
Spring 2003CSE P5481 Precise Interrupts Precise interrupts preserve the model that instructions execute in program-generated order, one at a time If an.
Appendix A. Pipelining: Basic and Intermediate Concept
PROCESSOR PIPELINING YASSER MOHAMMAD. SINGLE DATAPATH DESIGN.
LECTURE 10 Pipelining: Advanced ILP. EXCEPTIONS An exception, or interrupt, is an event other than regular transfers of control (branches, jumps, calls,
CSC 4250 Computer Architectures September 22, 2006 Appendix A. Pipelining.
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.
Introduction to Exceptions 1 Introduction to Exceptions ARM Advanced RISC Machines.
Exceptions and Interrupts “Unexpected” events requiring change in flow of control – Different ISAs use the terms differently Exception – Arises within.
Data Hazards Dependent instructions add %g1, %g2, %g3 sub %l1, %g3, %o0 Forwarding helps, but not all hazards can be avoided.
CMSC 611: Advanced Computer Architecture
Instruction-Level Parallelism
Interrupts and exceptions
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.
Lecture 15: Pipelining: Branching & Complications
Interrupts and signals
Basic Processor Structure/design
Overview Introduction General Register Organization Stack Organization
Pipelining Wrapup Brief overview of the rest of chapter 3
Exceptions & Multi-cycle Operations
Chapter 10 The Stack.
Pipelining: Advanced ILP
The processor: Exceptions and Interrupts
Computer Architecture
The processor: Pipelining and Branching
Interrupts/Exceptions
Control unit extension for data hazards
Architectural Support for OS
Chapter 10 And, Finally... The Stack
Instruction Execution Cycle
Project Instruction Scheduler Assembler for DLX
Computer Architecture
CSE 451: Operating Systems Autumn 2003 Lecture 2 Architectural Support for Operating Systems Hank Levy 596 Allen Center 1.
Overview What are pipeline hazards? Types of hazards
CSE 451: Operating Systems Autumn 2001 Lecture 2 Architectural Support for Operating Systems Brian Bershad 310 Sieg Hall 1.
ECE 445 – Computer Organization
Control Hazards Branches (conditional, unconditional, call-return)
Control unit extension for data hazards
CSE 451: Operating Systems Winter 2003 Lecture 2 Architectural Support for Operating Systems Hank Levy 412 Sieg Hall 1.
Architectural Support for OS
ECE/CS 552: Pipelining and Exceptions
Control unit extension for data hazards
Lecture 06: Pipelining Implementation
Chapter 11 Processor Structure and function
CMSC 611: Advanced Computer Architecture
Presentation transcript:

Interrupts and exceptions Interrupt: “asynchronous” event (e.g., I/O) Checked before IF. Exceptions (e.g., arithmetic overflow, page fault, O.S. call from user program, undefined instruction etc.) Program and data dependent (repeatable), hence “synchronous” Occur “within” an instruction (e.g., in EXE or MEM stage) Handling exceptions A pipeline is restartable if the exception can be handled and the program restarted w/o affecting execution 5/30/2019 CSE 471 Exceptions

Precise exceptions If exception at instruction I then Basic idea Instructions I-1, I-2 etc complete normally Instructions I+1, I+2 etc. are restarted from scratch Basic idea Force a trap instruction on the next IF Turn off writes for all instructions I and following When the target of the trap instruction receives control, the PC of the instruction having the exception is saved (MIPS uses an EPC and the saving is done by the hardware) After the exception has been handled, an instruction “return from trap” will restore the PC (jump to the contents of EPC). 5/30/2019 CSE 471 Exceptions

Precise exceptions (cont’d) Relatively simple for integer pipeline All current machines have precise exceptions for integer and load-store operations Can lead to loss of performance for pipes with multiple cycles execution stage (f-p see later) 5/30/2019 CSE 471 Exceptions

Integer pipeline (RISC) precise exception Exceptions can occur in all stages but WB IF: memory related (page fault, protection violation, misalignment) ID: illegal opcode EXE: arithmetic exception (overflow, underflow) MEM: memory related Exceptions must be treated in instruction order Instruction I starts at time t Exception in MEM stage at time t + 3 (treat it first) Instruction I + 1 starts at time t +1 Exception in IF stage at time t + 1 (occurs earlier but treat in 2nd) 5/30/2019 CSE 471 Exceptions

Treating exceptions in order Use pipeline registers Status vector of possible exceptions carried on with the instruction. Once an exception is posted, no writing (no change of state; easy in integer pipeline -- just prevent store in memory) When an instruction leaves MEM stage, check for exception. 5/30/2019 CSE 471 Exceptions

What to do on an exception? O.S. must know the reason for the exception and transfer control to the routine that will handle it Two methods; Cause register: a register encodes the cause of the exception and O.S. will decode it and transfer to the appropriate routine Vectored interrupt: the O.S. knows the reason of the interrupt by the address of the routine where control is transferred 5/30/2019 CSE 471 Exceptions

Difficulties Due to instruction set (“long” instructions) String instructions (but use of general registers to keep state) Instructions that change state before last stage (e.g., autoincrement mode in Vax and update addressing in Power PC) and these changes are needed to complete inst. (require ability to back up) Condition codes Must remember when last changed Multiple cycle stages (see later) 5/30/2019 CSE 471 Exceptions