Lecture 2 Interrupts.

Slides:



Advertisements
Similar presentations
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.
Advertisements

I/O Unit.
1 中斷 Interrupt. 2 謂何需要 Interrupt I/O  Busy/wait I/O is very inefficient. CPU can ’ t do other work while testing device. Hard to do simultaneous I/O.
ECE 372 – Microcontroller Design Parallel IO Ports - Interrupts
Interfacing. This Week In DIG II  Basic communications terminology  Communications protocols  Microprocessor interfacing: I/O addressing  Port and.
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.
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.
© 2008 Wayne Wolf Overheads for Computers as Components 2nd ed. CPUs Input and output. Supervisor mode, exceptions, traps. Co-processors. 1.
INPUT-OUTPUT ORGANIZATION
ECE 265 – LECTURE 12 The Hardware Interface 8/22/ ECE265.
Interrupts. What Are Interrupts? Interrupts alter a program’s flow of control  Behavior is similar to a procedure call »Some significant differences.
CPUs Input and output. Supervisor mode, exceptions, traps. Co-processors.
MICROPROCESSOR INPUT/OUTPUT
© 2000 Morgan Kaufman Overheads for Computers as Components CPUs zInput and output mechanisms zInterrupts zMemory management unit (MMU) zCache mechanism.
1 CS/COE0447 Computer Organization & Assembly Language Chapter 5 part 4 Exceptions.
Interrupts, Buses Chapter 6.2.5, Introduction to Interrupts Interrupts are a mechanism by which other modules (e.g. I/O) may interrupt normal.
Computer Architecture Lecture 2 System Buses. Program Concept Hardwired systems are inflexible General purpose hardware can do different tasks, given.
© 2000 Morgan Kaufman Overheads for Computers as Components CPUs zInput and output. zSupervisor mode, exceptions, traps. zCo-processors.
Chapter 6: Computer Components Dr Mohamed Menacer Taibah University
© 2000 Morgan Kaufman Overheads for Computers as Components CPUs zInput and output. zSupervisor mode, exceptions, traps. zCo-processors.
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.
INTERRUPTS. Topics to be discussed  8088/86 Hardware Interrupts pins 8088/86 Hardware Interrupts pins   Pin description Pin description.
Lab 2 Microprocessor MPC430F2274 MSP-430 Architecture.
Introduction to Exceptions 1 Introduction to Exceptions ARM Advanced RISC Machines.
8085 Interrupts LAKSHMI.B.E..
CS501 Advanced Computer Architecture
Microprocessor Systems Design I
Mon. Oct 2 Announcements Quiz Postponed to Wednesday – still only on 2.a + 2.b Video lecture for 2.a posted Lab 6 experiment extension You must come to.
The process starts from the I/O device
Input/Output and Communication
Operating Systems (CS 340 D)
Computer Architecture
Interrupts In 8085 and 8086.
Interrupts.
1 Input-Output Organization Computer Organization Computer Architectures Lab Peripheral Devices Input-Output Interface Asynchronous Data Transfer Modes.
I/O Interface and Interrupt Systems
Chapter 3 Top Level View of Computer Function and Interconnection
E3165 DIGITAL ELECTRONIC SYSTEM
Interrupt.
* * * * * * * 8051 Interrupts Programming.
Computer Organization and Design
CSCI 315 Operating Systems Design
Interrupt Driven I/O References Text: Tanenbaum ch.1.4.3, ch Receiver Interrupt Program Example:
8255.
Serial Communication Interface: Using 8251
Subject Name: Microprocessors Subject Code:10EC46 Department: Electronics and Communication Date: /20/2018.
Computer System Overview
Interrupts Interrupt is a process where an external device can get the attention of the microprocessor. The process starts from the I/O device The process.
I/O Systems I/O Hardware Application I/O Interface
Overheads for Computers as Components 2nd ed.
X1 & X2 These are also called Crystal Input Pins.
COMPUTER PERIPHERALS AND INTERFACES
Interrupts.
Md. Mojahidul Islam Lecturer Dept. of Computer Science & Engineering
Md. Mojahidul Islam Lecturer Dept. of Computer Science & Engineering
Interrupts 1/18/2019.
CNET 315 Microprocessor & Assembly Language
Interrupt handling Explain how interrupts are used to obtain processor time and how processing of interrupted jobs may later be resumed, (typical.
Computer System Overview
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Programmable Interrupt Controller (PIC)
COMP3221: Microprocessors and Embedded Systems
William Stallings Computer Organization and Architecture 7th Edition
Chapter 13: I/O Systems.
The Programmable Peripheral Interface (8255A)
Presentation transcript:

Lecture 2 Interrupts

I/O devices Usually includes some non-digital component. Typical digital interface to CPU: status reg CPU mechanism data reg Data reg - holds values that are treated as data by the device, such as the data read or written by a disc. Status reg – provides information about the device’s operation, such as whether the current transaction has completed.

Application: 8251 UART Universal asynchronous receiver transmitter (UART) : provides serial communication. 8251 functions are integrated into standard PC interface chip. Allows many communication parameters to be programmed.

Serial communication Characters are transmitted separately: no char bit 0 bit 1 bit n-1 ... start stop time One character

Serial communication parameters Baud (bit) rate (=1/period of one bit) Number of bits per character (5-8) parity/no parity (whether parity to be included) Even/odd parity (if parity included, its value) Length of stop bit (1, 2 bits).

8251 CPU interface status (8 bit) 8251 CPU xmit/ rcv data serial port

Interrupt I/O Busy/wait is very inefficient. CPU can’t do other work while testing device. Hard to do simultaneous I/O. Interrupts allow a device to change the flow of control in the CPU – allow parallelism. Causes subroutine call to handle device.

Interrupt interface intr request status reg CPU intr ack mechanism IR PC data/address data reg

Interrupt behavior Based on subroutine call mechanism. Interrupt forces next instruction to be a subroutine call to a predetermined location. Return address is saved to resume executing foreground program.

Interrupt physical interface CPU and device are connected by CPU bus. CPU and device handshake: device asserts interrupt request; CPU asserts interrupt acknowledge when it can handle the interrupt.

Debugging interrupt code What if you forget to change registers? Foreground program can exhibit mysterious bugs. Bugs will be hard to repeat---depend on interrupt timing. Interrupt never occurs in the middle of instruction execution, but before it or after it.

Priorities and vectors Two mechanisms allow us to make interrupts more specific: Priorities determine what interrupt gets CPU first. Vectors determine what code is called for each type of interrupt. Mechanisms are orthogonal: most CPUs provide both.

Prioritized interrupts device 1 device 2 device n interrupt acknowledge L1 L2 .. Ln CPU If all devices ask interrupt simultaneously, only the highest priority receives it

Interrupt prioritization Masking: interrupt with priority lower than current priority is not recognized until pending interrupt is complete. Non-maskable interrupt (NMI): highest-priority, never masked. Often used for power-down.

Example: Prioritized I/O :interrupts :foreground :A :B :C B C A A,B

Interrupt vectors Allow different devices to be handled by different code. Interrupt vector table: Interrupt vector table head handler 0 handler 1 handler 2 handler 3 © 2000 Morgan Kaufman

Interrupt vector acquisition Activity on the bus :CPU :device Receive interrupt request Receive ack receive vector

Generic interrupt mechanism continue execution intr? Assume priority selection is handled before this point. N Y intr priority > current priority? N ignore Y ack Y bus error Y N timeout? vector? Y call table[vector]

Interrupt sequence CPU acknowledges request. Device sends vector. CPU calls handler. Software processes request. CPU restores state to foreground program.

Sources of interrupt overhead Handler execution time. Interrupt mechanism overhead. Register save/restore. Pipeline-related penalties (branch penalty) Cache-related penalties.

Interrupts on MSP-430

Maskable interrupts Caused by peripherals with interrupt capability including watchdog. Each interrupt source can be enabled/disabled by the correspondent bit in the status register.

Non-Maskable Interrupt There is no need to mask the interrupt. The interrupt is reseted automatically and then set again.

Interrupt vector table

Watchdog timer Watchdog timer is periodically reset by system timer. If watchdog is not reset, it generates an interrupt to reset the host. host CPU interrupt watchdog timer reset

Preprocessor directives In C and C++, the language supports a simple macro preprocessor. Source lines that should be handled by the preprocessor, such as #define and #include are referred to as preprocessor directives. Another C construct, the #pragma directive, is used to instruct the compiler to use pragmatic or implementation-dependent features