Interrupts. 2 Definition: An electrical signal sent to the CPU (at any time) to alert it to the occurrence of some event that needs its attention Purpose:

Slides:



Advertisements
Similar presentations
Computer Architecture
Advertisements

Computer Architecture
Lecture 12 Z80 Interrupt 동국대학교 홍유표 1. Y. Hong & E. Lee Polling vs. Interrupt Polling : Periodically check if an event occurs Interrupt : Event sends a.
Chapter 10 Input/Output Organization. Connections between a CPU and an I/O device Types of bus (Figure 10.1) –Address bus –Data bus –Control bus.
1/1/ / faculty of Electrical Engineering eindhoven university of technology Architectures of Digital Information Systems Part 1: Interrupts and DMA dr.ir.
I/O Unit.
CS-334: Computer Architecture
1/1/ / faculty of Electrical Engineering eindhoven university of technology Introduction Part 3: Input/output and co-processors dr.ir. A.C. Verschueren.
FIU Chapter 7: Input/Output Jerome Crooks Panyawat Chiamprasert
Set 20 Interrupts. INTERRUPTS The Pentium has a mechanism whereby external devices can interrupt it. Devices such as the keyboard, the monitor, hard disks.
ECE 372 – Microcontroller Design Parallel IO Ports - Interrupts
Interrupts What is an interrupt? What does an interrupt do to the “flow of control” Interrupts used to overlap computation & I/O – Examples would be console.
Interrupts (contd..) Multiple I/O devices may be connected to the processor and the memory via a bus. Some or all of these devices may be capable of generating.
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.
© Copyright 2004 Dr. Phillip A. Laplante 1 Memory  Memory access  Memory technologies  Memory organization.
Chapter 7 Interupts DMA Channels Context Switching.
Basic Input/Output Operations
Midterm Tuesday October 23 Covers Chapters 3 through 6 - Buses, Clocks, Timing, Edge Triggering, Level Triggering - Cache Memory Systems - Internal Memory.
1 Interrupts INPUT/OUTPUT ORGANIZATION: Interrupts CS 147 JOKO SUTOMO.
INPUT/OUTPUT ORGANIZATION INTERRUPTS CS147 Summer 2001 Professor: Sin-Min Lee Presented by: Jing Chen.
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
2. Methods for I/O Operations
Chapter 2 The OS, the Computer, and User Programs Copyright © 2008.
7. Peripherals 7.2 Peripheral handling Computer Studies (AL)
Input/Output. Input/Output Problems Wide variety of peripherals —Delivering different amounts of data —At different speeds —In different formats All slower.
Micro-operations Are the functional, or atomic, operations of a processor. A single micro-operation generally involves a transfer between registers, transfer.
COMP201 Computer Systems Exceptions and Interrupts.
Interrupts. What Are Interrupts? Interrupts alter a program’s flow of control  Behavior is similar to a procedure call »Some significant differences.
created by :Gaurav Shrivastava
MICROPROCESSOR INPUT/OUTPUT
Interrupts and DMA CSCI The Role of the Operating System in Performing I/O Two main jobs of a computer are: –Processing –Performing I/O manage and.
CHAPTER 3 TOP LEVEL VIEW OF COMPUTER FUNCTION AND INTERCONNECTION
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Overview of Hardware.
Khaled A. Al-Utaibi  Interrupt-Driven I/O  Hardware Interrupts  Responding to Hardware Interrupts  INTR and NMI  Computing the.
The Functions of Operating Systems Interrupts. Learning Objectives Explain how interrupts are used to obtain processor time. Explain how processing of.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Microprocessors 1 MCS-51 Interrupts.
Lecture 14 Today’s topics MARIE Architecture Registers Buses
13-Nov-15 (1) CSC Computer Organization Lecture 7: Input/Output Organization.
CSNB374: Microprocessor Systems Chapter 5: Procedures and Interrupts.
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.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Operating Systems 1 K. Salah Module 1.2: Fundamental Concepts Interrupts System Calls.
6-1 Infineon 167 Interrupts The C167CS provides 56 separate interrupt sources that may be assigned to 16 priority levels. The C167CS uses a vectored interrupt.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Input/Output Problems Wide variety of peripherals —Delivering different amounts of data —At different speeds —In different formats All slower than CPU.
Embedded Systems Design 1 Lecture Set 8 MCS-51 Interrupts.
Interrupt driven I/O Computer Organization and Assembly Language: Module 12.
Copyright © 2007 by Curt Hill Interrupts How the system responds.
Input Output Techniques Programmed Interrupt driven Direct Memory Access (DMA)
I/O Organization Competency – C6. Important facts to remember when I/O devices are to be connected to CPU There is a vast variety of I/O devices. Some.
Structure and Role of a Processor
9/20/6Lecture 3 - Instruction Set - Al1 Exception Handling.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edit9on Lecture 3 Chapter 1: Introduction Provided & Updated by Sameer Akram.
Introduction to Exceptions 1 Introduction to Exceptions ARM Advanced RISC Machines.
68HC11 Interrupts & Resets.
Microprocessor Systems Design I
Lesson Objectives Aims Key Words Interrupt, Buffer, Priority, Stack
Processor Fundamentals
COMPUTER PERIPHERALS AND INTERFACES
Interrupt handling Explain how interrupts are used to obtain processor time and how processing of interrupted jobs may later be resumed, (typical.
COMP3221: Microprocessors and Embedded Systems
Chapter 13: I/O Systems “The two main jobs of a computer are I/O and [CPU] processing. In many cases, the main job is I/O, and the [CPU] processing is.
Presentation transcript:

Interrupts

2 Definition: An electrical signal sent to the CPU (at any time) to alert it to the occurrence of some event that needs its attention Purpose: To free the CPU from having to constantly check for the occurrence of these events

3 Interrupts Significance: all event-driven software, such as GUIs, window managers and operating systems, depend on interrupts to supply their events What might an event be?

4 Events Keyboard state change (key pressed or released) Mouse movement System clock tick Data received Output buffer empty (or output complete) Communication error (e.g. data corrupted or lost contact)

5 CPU’s Response to an Interrupt The CPU responds to an interrupt at the end of the current instruction, but only if the interrupt is important enough The response consists of: 1.Saving the current CPU state on the stack 2.Jumping to a special routine, called an interrupt handler or interrupt service routine

6 CPU’s Response to an Interrupt The CPU resumes execution of the interrupted program when the interrupt handler executes a Return from Interrupt (RTI) instruction The RTI instruction uses the state data that was stored on the stack to restore the state to what it was when the interrupt occurred

7 The Interrupt Service Routine This is the special piece of code that will run in response to an interrupt request Specially written for each interrupting device Typically, it will perform actions such as transferring data to or from the device that has requested the interrupt

8 Fetch-Execute cycle

9 Interrupt Masks and Priorities How does the processor decide if an interrupt is important enough to service? There are two possible methods: Prioritised Interrupts Interrupt Masks

10 Prioritised Interrupts The CPU has a number of interrupt lines Each interrupt line is given a numeric priority The CPU itself also has a priority, which is a number stored in the status register. This number represents the priority of the current program, and can be changed by the program If the priority of the interrupt is greater than the priority of the current program then the CPU responds to the interrupt

11 Interrupt Masks Interrupt masks are bits in the CPU’s status register that control which interrupts the CPU will respond to – if the appropriate bits are set, the interrupt will not get served

12 Interrupts (typical of many microcontrollers) Many microcontrollers support two types of interrupt: Ordinary interrupts Non-maskable interrupts Ordinary interrupts can be “masked” (i.e. prevented from interrupting the CPU) by setting the interrupt mask bit in the CPU’s status register

13 68HC11 Interrupts 68HC11 IRQ (interrupt request) NMI (non-maskable interrupt) XINZCV Status register Interrupt mask bit NMI mask bit

14 State Save on Interrupt The CPU must save enough state data to be able to resume execution of the interrupted program from the exact point where it was interrupted There are two strategies for doing this: 1.Complete state save 2.Minimum state save

15 Complete State Save All of the registers accessible to the programmer; i.e. –Program Counter (PC) –Status register –General-purpose registers, data registers (accumulators), address and index registers

16 Minimum State Save Program Counter Status Register Q: why save the status register?

17 Physical Implementation Simplest method: CPUI/O port 2I/O port 1 Control bus IRQIRQ1IRQ2 CPU interrupt- request input Interrupt-request outputs from each I/O port

18 Implications 1.The CPU is told only that an interrupt has occurred. It does not know where it came from. 2.The interrupt handler has to poll the I/O ports – that is, interrogate each one in turn to see which one has caused the interrupt. 3.I/O ports must make it known to the CPU that they have requested an interrupt, e.g. by setting a bit in an I/O status register

19 Vectored Interrupts IACK: CPU’s Interrupt Acknowledge output. Each I/O port has an IACK input and an IACK output; these are connected together in a daisy chain.

20 Vectored Interrupt Response 1.The CPU puts an interrupt acknowledge signal on its IACK output 2.Any I/O port that receives an interrupt acknowledge signal on its IACK input, and is not currently issuing an interrupt, copies the signal to its IACK output 3.Any I/O port that receives an interrupt acknowledge signal on its IACK input, and is currently issuing an interrupt, intercepts the signal and writes a pre-arranged identification number onto the data bus 4.The CPU reads the interrupter’s ID from the data bus

21 Where is the Interrupt Handler? The address of an Interrupt Handler is stored in a special location in memory In a simple system, this address is hard-wired into the CPU In a system supporting vectored interrupts, the addresses of all the interrupt handlers are stored in a table in memory. The ID supplied by the I/O port is used as an index into this table In both cases, the locations containing the interrupt handler addresses are known as interrupt vectors