Introduction to Exceptions 1 Introduction to Exceptions ARM Advanced RISC Machines.

Slides:



Advertisements
Similar presentations
Exceptions. Exception Types Exception Handling Vectoring Interrupts Interrupt Handlers Interrupt Priorities Interrupt applications 6-2.
Advertisements

Interrupts Chapter 8 – pp Chapter 10 – pp Appendix A – pp 537 &
1/1/ / faculty of Electrical Engineering eindhoven university of technology Architectures of Digital Information Systems Part 1: Interrupts and DMA dr.ir.
Interrupts Disclaimer: All diagrams and figures in this presentation are scanned from the book “Microprocessors and Programmed Logic” authored by Kenneth.
I/O Unit.
1/1/ / faculty of Electrical Engineering eindhoven university of technology Introduction Part 3: Input/output and co-processors dr.ir. A.C. Verschueren.
EET 2261 Unit 9 Interrupts  Read Almy, Chapters 17 – 19.  Homework #9 and Lab #9 due next week.  Quiz next week.
ECE 372 – Microcontroller Design Parallel IO Ports - Interrupts
COMP3221: Microprocessors and Embedded Systems Lecture 15: Interrupts I Lecturer: Hui Wu Session 1, 2005.
6-1 I/O Methods I/O – Transfer of data between memory of the system and the I/O device Most devices operate asynchronously from the CPU Most methods involve.
Introduction To The ARM Microprocessor
Basic Input/Output Operations
1 Interrupts INPUT/OUTPUT ORGANIZATION: Interrupts CS 147 JOKO SUTOMO.
ARM 7 Datapath. Has “BIGEND” input bit, which defines whether the memory is big or little endian Modes: ARM7 supports six modes of operation: (1) User.
Introduction to Interrupts
COMP3221 lec28-exception-II.1 Saeid Nooshabadi COMP 3221 Microprocessors and Embedded Systems Lectures 28: Exceptions & Interrupts - II
CIS429.S00: Lec12- 1 Miscellaneous pipelining topics Why pipelining is so hard: exception handling Advanced pipelining techniques: loop unrolling.
The ARM Programmer’s Model
What are Exception and Interrupts? MIPS terminology Exception: any unexpected change in the internal control flow – Invoking an operating system service.
Exception and Interrupt Handling
Embedded Systems 7763B Mt Druitt College of TAFE
Introduction to Embedded Systems
Interrupts. What Are Interrupts? Interrupts alter a program’s flow of control  Behavior is similar to a procedure call »Some significant differences.
MICROPROCESSOR INPUT/OUTPUT
CHAPTER 3 TOP LEVEL VIEW OF COMPUTER FUNCTION AND INTERCONNECTION
Khaled A. Al-Utaibi  Interrupt-Driven I/O  Hardware Interrupts  Responding to Hardware Interrupts  INTR and NMI  Computing the.
1 CS/COE0447 Computer Organization & Assembly Language Chapter 5 part 4 Exceptions.
The Functions of Operating Systems Interrupts. Learning Objectives Explain how interrupts are used to obtain processor time. Explain how processing of.
Interrupt.
I/O Interfacing A lot of handshaking is required between the CPU and most I/O devices. All I/O devices operate asynchronously with respect to the CPU.
Microprocessors 1 MCS-51 Interrupts.
Accessing I/O Devices Processor Memory BUS I/O Device 1 I/O Device 2.
13-Nov-15 (1) CSC Computer Organization Lecture 7: Input/Output Organization.
1 © Unitec New Zealand Interrupt Lecture 6 Date: - 20 Sept, 2011 Embedded Hardware ETEC 6416.
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 Interrupts, Resets Today: First Hour: Interrupts –Section 5.2 of Huang’s Textbook –In-class Activity #1 Second Hour: More Interrupts Section 5.2 of Huang’s.
AT91 Interrupt Handling. 2 Stops the execution of main software Redirects the program flow, based on an event, to execute a different software subroutine.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Embedded Systems Design 1 Lecture Set 8 MCS-51 Interrupts.
Interrupt driven I/O Computer Organization and Assembly Language: Module 12.
بسم الله الرحمن الرحيم MEMORY AND I/O.
9/20/6Lecture 3 - Instruction Set - Al1 Exception Handling.
CS-280 Dr. Mark L. Hornick 1 Sequential Execution Normally, CPU sequentially executes instructions in a program Subroutine calls are synchronous to the.
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.
Computer System Structures Interrupts
Architectures of Digital Information Systems Part 1: Interrupts and DMA dr.ir. A.C. Verschueren Eindhoven University of Technology Section of Digital.
Interrupts and exceptions
68HC11 Interrupts & Resets.
Microprocessor Systems Design I
Timer and Interrupts.
Interrupts In 8085 and 8086.
* * * * * * * 8051 Interrupts Programming.
Computer System Overview
Interrupts.
Interrupts 1/18/2019.
Project Instruction Scheduler Assembler for DLX
Interrupts and Exception Handling
Interrupt handling Explain how interrupts are used to obtain processor time and how processing of interrupted jobs may later be resumed, (typical.
ARM Introduction.
Control Hazards Branches (conditional, unconditional, call-return)
Computer System Overview
COMP3221: Microprocessors and Embedded Systems
Interrupts and exceptions
Interrupts and Exception Handling
CMSC 611: Advanced Computer Architecture
Presentation transcript:

Introduction to Exceptions 1 Introduction to Exceptions ARM Advanced RISC Machines

Introduction to Exceptions 2 Interrupts or Exceptions *Naming conventions vary a lot. *IBM and Intel call them Interrupts *Motorola calls them Exceptions *Sometimes also called Traps *Often the terms are used interchangeably

Introduction to Exceptions 3 Programmed Input/Output *Controlling or accessing an external device can tie-up the processor. *With “Programmed I/O” the CPU repeatedly reviews the device status. e.g. start the device, and poll for completion processor 100% tied up, waiting for device ready. Program initiated Start Device Poll status Wait until device ready CPU Device Code

Introduction to Exceptions 4 Exception Input / Output Program initiated Start Device Interrupt Interrupt Service Routine Return *Interrupts or exceptions are events that change the program flow *Hardware interrupts only concern the processor when necessary.

Introduction to Exceptions 5 Exception Class (1) *Synchronous or asynchronous Synchronous occurs in the same place in the program every time Asynchronous can occur anywhere *User Requested or Coerced An interrupt caused by the program flow Interrupt caused by external event not under control of the program

Introduction to Exceptions 6 Exception Class (2) *Between or within instructions Does the event prevent the execution of the instruction Will it be recognised between instructions? *Resume or Terminate If the event ceases execution of the program it is classed as terminate *Maskable or Non-Maskable If the interrupt can be prevented from affecting program flow by the user then it is classed as maskable.

Introduction to Exceptions 7 Exception Types *Some examples of events which will cause exceptions I/O Device Request –Eg: Ethernet controller requires attention Operating System Service –Task can only be executed in a priveliged mode Page Fault –Program or data not in memory Integer arithmetic overflow Power failure

Introduction to Exceptions 8 Exception Classification *The exceptions could be classified according to the class I/O Request –Asynchronous, Coerced, Nonmaskable, Between, Resume Operating System Service –Synchronous, User Request, Nonmaskable, Between, Resume Page Fault –Synchronous, Coerced, Nonmaskable, Within, Resume Integer Arithmetic Overflow –Synchronous, Coerced, Maskable, Within, Terminate Power Failure –Asynchronous, Coerced, Nonmaskable, Within, Terminate

Introduction to Exceptions 9 Exception Response *Two basic methods *Force PC to an exception vector Interrupt vector contains an instruction to branch to the Interrupt Service Routine ISR must then poll for the cause of the interrupt *External Hardware provides address Jump directly to the correct ISR No polling required therefore faster

Introduction to Exceptions 10 Exception Flow *Interrupt Flow from taking interrupt to re-starting program. Reset Undefined Inst FIQ IRQ Reserved Data Abort Prefetch Abort Software Interrupt ARM Program Interrupt Service Routine Branch PC loaded with Interrupt Vector Back to executing from next instrcution after interrupt ocurred Restore PC and Processor State

Introduction to Exceptions 11 Basic ISR Sequence *The basic sequence of handling an exception Save program counter Save processor registers Disable Exceptions –Those that can be masked or lower priority Clear the source of the Exception Execute the Handler Program ( Eg: read serial port ) Enable Exceptions Restore processor registers Restore program counter Continue execution

Introduction to Exceptions 12 ARM Specific Features *ARM has features aimed at speeding up exception handling Automatic saving of the program counter and current program status register No need to save all registers to memory –Some are saved automatically within the processor Fast instructions for loading and storing to/from memory *No “return from interrupt” instruction Other processors have RETI instruction ARM does not, ARM relies on the programmer to handle this. Eg: using a MOV instruction

Introduction to Exceptions 13 Exception Priority *Some events are more important than others Eg: Power failure *Exceptions need to be prioritised *ARM has fixed priority for Exceptions (1) Reset ( Highest priority ) (2) Data Abort (3) FIQ - fast interrupt (4) IRQ - normal interrupt (5) Prefetch Abort (6) Undefined Instruction, Software Interrupt ( Lowest Priority )

Introduction to Exceptions 14 Exception Control *An exception mechanism requires: a “MASK” flag to enable/disable the recognition of the request a mechanism for synchronising asynchronousor clock and instruction flow a defined protocol for clearing the source of interrupts CPSR Condition Code Flags Mode N ZCV I F I = 1, disables the IRQ. F = 1, disables the FIQ. Interrupt Disable bits. Mode Bits M[4:0] define the processor mode. Six modes are valid.

Introduction to Exceptions 15 Interrupt reentrancy *Interrupts (e.g. FIQs) are normally handled serially as the mask flag is disabled during the interrupt service routine. *However, if the service routine clears the mask bit: other similar priority interrupts will be serviced before the current interrupt is processed the service routine is said to be reentrant Process Interrupt Service Routine Return Interrupt Service Routine Return

Introduction to Exceptions 16 Interrupt Latency External Interrupts are not recognised immediately. Clock cycles are required for synchronisation and recognition of the interrupt. Multiple cycle instructions prevent the interrupt from being recognised. –Eg: Multiply instruction on ARM MCLK Interrupt Latency FIQ (or IRQ)

Introduction to Exceptions 17 Interrupt latency - continued *A synchronised (and enabled) interrupt will generate an interrupt at the end of the current instruction. *The worst case instruction is a Load Multiple (LDM): –of sixteen registers –which changes the PC –and causes a Data Abort this LDM takes 20 cycles. *The data Abort handler must be entered (3 cycles) before the FIQ is entered *Entering the abort and interrupt vectors adds an overhead of two clock cycles to fill the pipeline. *Thus the worst case latency for FIQ is = Tsync + Tldm + Tdabt + Tfiq = = 28 cycles or 1.4usec at 20MHz. *IRQ has a latency extended by the longest FIQ service routine.