13-Nov-15 (1) CSC2510 - Computer Organization Lecture 7: Input/Output Organization.

Slides:



Advertisements
Similar presentations
Computer Architecture
Advertisements

I/O Organization popo.
Chapter 3 Basic Input/Output
Basic Input/Output INTERRUPTS (Week 5)
Computer Architecture
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.
A look at interrupts What are interrupts and why are they needed.
I/O Unit.
Mehmet Can Vuran, Instructor University of Nebraska-Lincoln Acknowledgement: Overheads adapted from those provided by the authors of the textbook.
CSCI 4717/5717 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
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.
Chapter 7 Interupts DMA Channels Context Switching.
Basic Input/Output Operations
A look at interrupts What are interrupts and why are they needed.
Midterm Tuesday October 23 Covers Chapters 3 through 6 - Buses, Clocks, Timing, Edge Triggering, Level Triggering - Cache Memory Systems - Internal Memory.
Computer System Structures memory memory controller disk controller disk controller printer controller printer controller tape-drive controller tape-drive.
1 Interrupts INPUT/OUTPUT ORGANIZATION: Interrupts CS 147 JOKO SUTOMO.
INTERRUPTS PROGRAMMING
7. Peripherals 7.2 Peripheral handling Computer Studies (AL)
Introduction to Computing Systems from bits & gates to C & beyond Chapter 8 Input/Output Basic organization Keyboard input Monitor output Interrupts DMA.
Chapter 7 Input/Output Luisa Botero Santiago Del Portillo Ivan Vega.
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:
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.
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.
Chapter 8 I/O. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 8-2 I/O: Connecting to Outside World So far,
The Functions of Operating Systems Interrupts. Learning Objectives Explain how interrupts are used to obtain processor time. Explain how processing of.
2009 Sep 10SYSC Dept. Systems and Computer Engineering, Carleton University F09. SYSC2001-Ch7.ppt 1 Chapter 7 Input/Output 7.1 External Devices 7.2.
COMPUTER ORGANIZATIONS CSNB123 NSMS2013 Ver.1Systems and Networking1.
Microprocessors 1 MCS-51 Interrupts.
Computer Architecture Lecture 2 System Buses. Program Concept Hardwired systems are inflexible General purpose hardware can do different tasks, given.
Accessing I/O Devices Processor Memory BUS I/O Device 1 I/O Device 2.
Chapter 3 Basic Input/Output. Chapter Outline Basic I/O capabilities of computers I/O device interfaces Memory-mapped I/O registers Program-controlled.
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.
Lecture 4-1 I/O Organization I/O Accesses Interrupt in general Next Lecture   ARM Interrupt   DMA.
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.
Chapter 3 System Buses.  Hardwired systems are inflexible  General purpose hardware can do different tasks, given correct control signals  Instead.
Chapter 8 Input/Output An Hong 2015 Fall School of Computer Science and Technology Lecture on Introduction to.
Architectures of Digital Information Systems Part 1: Interrupts and DMA dr.ir. A.C. Verschueren Eindhoven University of Technology Section of Digital.
Microprocessor Systems Design I
Computer Architecture
Interrupts In 8085 and 8086.
Chapter 3 Top Level View of Computer Function and Interconnection
Chapter 8 Input/Output I/O basics Keyboard input Monitor output
Input/Output Organization
Chapter 8 I/O.
Chapter 8 I/O.
COMPUTER PERIPHERALS AND INTERFACES
Interrupts.
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
Presentation transcript:

13-Nov-15 (1) CSC Computer Organization Lecture 7: Input/Output Organization

13-Nov-15 (2) Single Bus Structure ProcessorMemory I/O device 1I/O devicen Bus

13-Nov-15 (3) Addressing Memory mapped I/O – devices and memory share the same address space IA-32 can use memory mapped I/O and/or 16-bit I/O address space

13-Nov-15 (4) I/O Interface

13-Nov-15 (5) Example

13-Nov-15 (6) Sample Program This is an example of program controlled-IO The processor polls the device

13-Nov-15 (7) Interrupts Polling does not allow for processor to do other things while it tests the device’s status register –Could be doing other things Better to be interrupted when an event takes place e.g. when printer becomes ready

13-Nov-15 (8) Interrupt Example Overlap printing and computing When printer ready, sends an interrupt request This causes COMPUTE execution to be suspended and the interrupt routine PRINT to gain control PRINT interrupt routine executed and returns from the interrupt COMPUTE execution continued Has similarities with subroutine execution

13-Nov-15 (9) Interrupt Routines Interrupt-service routine –Interrupt request occurs during execution of instruction i –Processor first completes execution of i –Current PC pushed –Loads program counter with address of interrupt service routine (ISR) say at a fixed address –ISR runs and finally executes a return from interrupt instruction –PC popped to return to normal execution

13-Nov-15 (10) ISR The ISR must inform device that the interrupt request has been serviced Done through the device registers –Implicitly by say reading data that is available –Or explicitly by changing some status register ISR must also save and restore any registers that it uses or program that was interrupted would not work when we return to it The ISR must be short as possible to minimize interrupt latency

13-Nov-15 (11) Interrupt Hardware Need to be able to handle an unknown number of possible interrupting devices INTR = INTR1 or INTR2 or … INTR n Processor INTR R Figure 4.6.An equivalent circuit for an open-drain bus used to implement a common interrupt-request line. INTR1INTR2INTRn V dd INTR

13-Nov-15 (12) Enable and Disable Sometimes need to ensure that interrupts cannot occur –May need to assign priorities e.g. high priority interrupts cannot be interrupted by low priority ones –Ensure that an active request doesn’t lead to an infinite loop –Interrupt routines may need to access data structures and ensure they do not get interrupted while doing so

13-Nov-15 (13) Avoiding Infinite interrupt loops Can be handled by –Ignoring interrupts until after 1 st instruction of ISR Interrupt disable instruction is first instruction No further interrupts can occur Controlled by 1 bit in the processor-status (PS) register, when 1 will process interrupts, when 0 disables them Set to 1 after the return from interrupt instruction –Processor automatically disable interrupts before starting ISR –Edge triggered interrupts. Processor receives one interrupt request per activation of the hardware interrupt line

13-Nov-15 (14) Interrupt model Device raises interrupt request Processor interrupts program currently being accessed Interrupts disabled by clearing PS bit (except in the case of edge-triggered interrupts) Device is informed that its request has been recognised by ISR. In response it deactivates its interrupt request Action requested by interrupt performed in the ISR Interrupts enabled and execution of interrupted program resumed

13-Nov-15 (15) Multiple Devices What is multiple devices can interrupt processor? –How does the processor recognize which device is causing the interrupt? –How does it know which ISR to execute? –Can interrupts interrupt ISRs? –How do we handle simultaneous interrupt requests? Simple solution –Poll every possible interrupting device and check if status bit indicates something is to be done and then service it –Advantage: simple –Disadvantage: slow

13-Nov-15 (16) Vectored Interrupts Interrupting device sends a code over the data bus to identify itself Processor jumps to a table of addresses, indexed by the interrupt-vector code

13-Nov-15 (17) Interrupt nesting Interrupts usually assigned priorities –e.g. real-time clock (RTC) interrupt must respond before the next one whereas a keyboard interrupt has no such constraint –RTC should have higher priority During execution of an ISR, interrupts only accepted from higher priority devices Special priority arbitration hardware is used for this purpose

13-Nov-15 (18) Priority Schemes Priority is determined by order of polling Daisy chain, the INTA signal only passed on if the device does not have a request –Uses fewest wires but slower than … Priority groups (most common in modern high speed processors)

13-Nov-15 (19) Interrupt Device Requests A bit in the status flag that can be set/cleared in software enables/disables interrupts

13-Nov-15 (20) Example Suppose –Processor uses vectored interrupts –Starting address of ISR stored at INTVEC in memory –Interrupts enabled by setting bit 9 (the IE bit) in the processor status word –Keyboard and display devices are connected to the processor

13-Nov-15 (21) Example To initialise the ISR –Load starting address of ISR to INTVEC –Load address LINE to PNTR (input chars will be stored here) –Enable keyboard interrupts (set bit 2 in register CONTROL) –Enable processor interrupts (set IE bit in processor status word PS) ISR –Read input character from keyboard input register (will cause the interface circuit to remove interrupt request) –Store character to location PNTR and increment PNTR –When end of the line reached, disable keyboard interrupts and inform program Main –Return from interrupt

13-Nov-15 (22) Example