1 COMP541 Interrupts, DMA, Serial I/O Montek Singh April 13, 2010.

Slides:



Advertisements
Similar presentations
Homework Reading Machine Projects Labs
Advertisements

Computer Architecture
I/O Organization popo.
Dr. Rabie A. Ramadan Al-Azhar University Lecture 3
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.
Processor System Architecture
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
Input-output and Communication Prof. Sin-Min Lee Department of Computer Science.
Architectural Support for OS March 29, 2000 Instructor: Gary Kimura Slides courtesy of Hank Levy.
Chapter 7 Interupts DMA Channels Context Switching.
Pipeline Exceptions & ControlCSCE430/830 Pipeline: Exceptions & Control CSCE430/830 Computer Architecture Lecturer: Prof. Hong Jiang Courtesy of Yifeng.
University College Cork IRELAND Hardware Concepts An understanding of computer hardware is a vital prerequisite for the study of operating systems.
Computer System Organization S H Srinivasan
Midterm Tuesday October 23 Covers Chapters 3 through 6 - Buses, Clocks, Timing, Edge Triggering, Level Triggering - Cache Memory Systems - Internal Memory.
Hardware Support for Operating Systems Sunny Gleason Vivek Uppal COM S 414
Computer System Structures memory memory controller disk controller disk controller printer controller printer controller tape-drive controller tape-drive.
1 COMP541 Interrupts, DMA, Serial I/O Montek Singh April 24, 2007.
1 COMP541 Interrupts, DMA, Serial I/O Montek Singh Nov 19, 2014.
What are Exception and Interrupts? MIPS terminology Exception: any unexpected change in the internal control flow – Invoking an operating system service.
CS-334: Computer Architecture
Input/Output. Input/Output Problems Wide variety of peripherals —Delivering different amounts of data —At different speeds —In different formats All slower.
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.
Chapter 10: Input / Output Devices Dr Mohamed Menacer Taibah University
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.
1 Input-Output Organization Computer Organization Computer Architectures Lab Peripheral Devices Input-Output Interface Asynchronous Data Transfer Modes.
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment.
CHAPTER 3 TOP LEVEL VIEW OF COMPUTER FUNCTION AND INTERCONNECTION
I/O Example: Disk Drives To access data: — seek: position head over the proper track (8 to 20 ms. avg.) — rotational latency: wait for desired sector (.5.
Top Level View of Computer Function and Interconnection.
CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University1 Input/Output CS 342 – Operating Systems Ibrahim Korpeoglu Bilkent University.
DMA Versus Polling or Interrupt Driven I/O
I/O management is a major component of operating system design and operation Important aspect of computer operation I/O devices vary greatly Various methods.
Interrupts, Buses Chapter 6.2.5, Introduction to Interrupts Interrupts are a mechanism by which other modules (e.g. I/O) may interrupt normal.
Fall EE 333 Lillevik 333f06-l21 University of Portland School of Engineering Computer Organization Lecture 21 Subroutines, stack Interrupts, service.
© 2004, D. J. Foreman 1 Computer Organization. © 2004, D. J. Foreman 2 Basic Architecture Review  Von Neumann ■ Distinct single-ALU & single-Control.
CH10 Input/Output DDDData Transfer EEEExternal Devices IIII/O Modules PPPProgrammed I/O IIIInterrupt-Driven I/O DDDDirect Memory.
1 CSE451 Architectural Supports for Operating Systems Autumn 2002 Gary Kimura Lecture #2 October 2, 2002.
1 COMP541 Interrupts, DMA, Serial I/O Montek Singh April 18, 2012.
Chapter 13 – I/O Systems (Pgs ). Devices  Two conflicting properties A. Growing uniformity in interfaces (both h/w and s/w): e.g., USB, TWAIN.
Input/Output Problems Wide variety of peripherals —Delivering different amounts of data —At different speeds —In different formats All slower than CPU.
Copyright © 2007 by Curt Hill Interrupts How the system responds.
بسم الله الرحمن الرحيم MEMORY AND I/O.
Chapter 3 System Buses.  Hardwired systems are inflexible  General purpose hardware can do different tasks, given correct control signals  Instead.
1 Device Controller I/O units typically consist of A mechanical component: the device itself An electronic component: the device controller or adapter.
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.
DIRECT MEMORY ACCESS and Computer Buses
Interrupts and exceptions
Introduction to microprocessor (Continued) Unit 1 Lecture 2
Dr. Michael Nasief Lecture 2
An Introduction to Microprocessor Architecture using intel 8085 as a classic processor
Architectural Support for OS
Architectural Support for OS
Interrupts and exceptions
Chapter 13: I/O Systems.
CMSC 611: Advanced Computer Architecture
Chapter 5 Input/Output Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved
Presentation transcript:

1 COMP541 Interrupts, DMA, Serial I/O Montek Singh April 13, 2010

2Interrupts  Two main kinds  Internal Error when executing an instruction Error when executing an instruction  Floating point exception  Virtual memory page fault  Trying to access protected memory System call System call  To request OS services  External I/O I/O

3Internal  More complicated because may abort instruction Access to protected memory not allowed Access to protected memory not allowed  Or OS could correct the situation and restart instruction E.g., virtual memory page fault E.g., virtual memory page fault  What happens for arithmetic overflow/divide-by-0?

4 When Interrupt Occurs  Interrupt enable register Sometimes levels of interrupts individually enabled/disabled Sometimes levels of interrupts individually enabled/disabled  PC is changed to new location One or more interrupt locations stored One or more interrupt locations stored  “vectored interrupts” Or a fixed location Or a fixed location  Old PC saved to register or stack Many machines have stack pointer Many machines have stack pointer

5Registers  Sometimes registers saved by hardware Some machines have one or more sets of registers Some machines have one or more sets of registers  On other architectures software must save registers  Return from interrupt Some CPUs provide a special instruction to return from interrupt Some CPUs provide a special instruction to return from interrupt  “rfi” or “iret” Others use the standard procedure return instruction Others use the standard procedure return instruction  jr, ret, etc.

6 Cause of Interrupt  Need way to determine what caused interrupt Note it can be more than one thing Note it can be more than one thing  Vectored Interrupts Different types cause branches to different locations Different types cause branches to different locations Sometimes prioritized Sometimes prioritized  Register to store cause

7 Supervisory Mode  Modern computers have user mode and one or more supervisory modes  User mode restricted Can’t write to many system registers, such as interrupt enable Can’t write to many system registers, such as interrupt enable Can’t write to some parts of memory Can’t write to some parts of memory Usually I/O restricted Usually I/O restricted  Interrupts cause switch to supervisory mode Question: Which interrupts? Question: Which interrupts?

8 Some Interrupt Hardware  Interrupts ORed  Response if IE and at end of instruction  Ack interrupt  Vector address to PC  PC to stack

9 Potential Microcode The following is a typical sequence of actions taken by the CPU upon triggering of an interrupt: SP  SP – 1 M[SP]  PC SP  SP – 1 M[SP]  PSR –PSR is processor status register EI  0 INTACK  1 PC  IVAD

10 Return Similar  Very similar to return from procedure  PSR holds IE bit  Restoring PSR turns interrupts on

Exception (from Patterson Hennessey, multicycle MIPS) 11 Just two causes PC – 4 stored Branch to fixed addr Undefined instruction and arithmetic overflow

12 Restarting Instruction?  Imagine the interrupt (exception) was a page fault  Need to get the page, and then rerun the instruction  Easy instructions help out  Otherwise may need to save some intermediate state Imagine block-move instruction such as the Pentium MOVS Imagine block-move instruction such as the Pentium MOVS  moves/copies an entire string (of variable length) in a single instruction!

Types of I/O Programmed I/O Direct Memory Access (DMA) 13

14 Direct Memory Access (DMA)  Programmed I/O is when CPU reads/writes every word Problem: overhead is high; nothing else getting done on CPU Problem: overhead is high; nothing else getting done on CPU Especially for mass-storage devices like disk Especially for mass-storage devices like disk  DMA: Let device controller read/write directly to memory Challenges? Challenges?

15Procedure  DMA device takes over main bus  Becomes bus master  Asserts addresses  Basically interfaces to memory or memory controller

16How?  DMA device requests bus (assert BR)  CPU grants request (assert BG)  CPU takes its signals to Hi-Z

17Transfers  Continuous – DMA controller transfers all data (say a disk sector) at once As many memory cycles as data As many memory cycles as data  Burst – DMA controller cycle steals, takes a cycle at end of every CPU instruction  Note that now the chip that controls memory (Northbridge), not CPU, is likely to do this

18 End of DMA  Controller needs to inform CPU  De-assert BR  Then CPU lowers BG and proceeds

19 DMA Controller  Needs typical I/O signals Interrupt request Interrupt request Status of device Status of device  Also needs controls for DMA transfer Memory address Memory address Word count Word count

20 Block Diagram

21 Typical Driver Interface  Set the memory address  Set word count  Assert GO (usually bit in control word)  DMA controller requests interrupt when transfer complete

Trends in Communications  Older bus standards, such as ISA and PCI, were parallel (conventional “bus”)  Newer (PCI Express) use serial channels (lanes) So slots for slower devices can be x1 So slots for slower devices can be x1 Slots for devices such as GPUs can be x16 (max x32 in spec) Slots for devices such as GPUs can be x16 (max x32 in spec) lane PCI-E (below) 1 lane (right)

Disk  Change from ATA/IDE to SATA IDE had 16 data channels IDE had 16 data channels SATA has 2 twisted pair (xmit and recv) SATA has 2 twisted pair (xmit and recv) 23

24RS-232  “Asynchronous”  Both sides have precise clocks  Agree on speed  Receiver syncs during start bit

25USB  One master The PC The PC  Idea was to have thin cables and plug and play  Specs include hardware and software We only cover hardware We only cover hardware

26 USB – Packet serial I/O  Four wires total  +5v and GND  Two signal wires Twisted pair Twisted pair Differential signaling Differential signaling Differential 1 is D+ > 2.8v and D- 2.8v and D- < 0.3v Differential 0 is opposite Differential 0 is opposite Also a single-ended zero when D+ & D- low (end of packet, reset, disconnect) Also a single-ended zero when D+ & D- low (end of packet, reset, disconnect)

27Speed  Three speeds High is 480 Mb/s High is 480 Mb/s Full is 12 Mb/s Full is 12 Mb/s Low is 1.5 Mb/s Low is 1.5 Mb/s New Super Speed, 5Gb/s!! New Super Speed, 5Gb/s!!  Pull-up indicates full/low  High speed starts as full, then handshakes and transitions  High and low speeds interpret zeros and ones inverted.

28Coding  NRZI Non-Return to Zero Inverted Non-Return to Zero Inverted Transition if sending 0, none if sending 1 Transition if sending 0, none if sending 1  Bit stuffing Since a string of 1s causes no transitions, synchronization may be lost Since a string of 1s causes no transitions, synchronization may be lost A zero is stuffed in after six consecutive ones A zero is stuffed in after six consecutive ones  Sync field Each packet starts with a sync Each packet starts with a sync 8 bits: bits:

29Packets  Won’t go into details