L25 - Input/Output CPU memory = = ICACHE DCACHE How do we interface to other devices • keyboard mouse disk network graphics cards Šoppy disk

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Input/Output CPU memory =? =? ICACHE DCACHE How do we interface to other devices? • keyboard, mouse, disk, network, graphics cards, Šoppy disk, printer, ... Operating System/Device Communication Standard techniques for OS->device communication: • Special instructions for I/O – – – • – – – CPU has additional output signals Instruction speci‰es device Instructions are privileged Memory-mapped I/O Part of physical address space reserved for I/O Read/writes interpreted as I/O commands Protected by address translation Operating System/Device Communication Standard techniques for device->OS communication: • • Polling – – – – OS periodically checks I/O status Interrupts Device sends interrupt OS responds by communicating with device Uses exception handling hardware I/O Controllers We could do the following: CPU memory =? =? ICACHE DCACHE I/O Controllers Or: CPU memory =? =? ICACHE DCACHE I/O Controller I/O Buses What's a bus? • • • • A shared collection of wires with multiple senders/receivers Protocol, obeyed by senders and receivers Simple, broadcast mechanism, serializes accesses Can be slow, serializes accesses Standards to ensure compatibility of devices PCI, USB, SCSI, ISA, EISA, VESA, NuBUS The nice thing about standards is that there are so many to choose from  Andrew Tanenbaum Bus Parameters Standard parameters: • • • • • • Bus width: number of wires used, separate control/data? Data width: number of bits per transfer Transfer size: number of words per bus transaction Bus masters: single, multiple Split transaction Synchronous/asynchronous Buses General protocol sequence: • • • Arbitrate for bus mastership Winner sends address to slave Data transferred between master and slave Different schemes for arbitration (usually with priorities) Standard bus in desktops: • PCI (peripheral component interconnect) PCI Characteristics • • • • 33/66 MHz clock ( CLK) REQ#, GNT#) AD) Central arbitration ( overlapped with previous transaction Multiplexed address/data (32/64 lines) ( General protocol – – – – bus command ( C/BE#) FRAME#, TRDY#) IRDY#, TRDY#) C/BE#) addr handshake and duration ( data width (byte enable) ( variable-length data handshake ( Max BW: 132MB/s base §  © ¡§£ ¡£ ¡ ¢¨¥¦¥¤¢ 4 672 $4 8 " 5 4 3 &% 2 1 % " 0"& 84 72 $4 6 " 5 4 3 &% 2 ) "% " 0& '(& "% " 84 672 $4 " 5 4 3 &% 2 !  8 $2 9 # $"   X c £ ¡ ¡¢¢H¡¥¤¢ £PIb£P¢W¢U ¡  I c a A £bG¨b @ A F ¡ §  £¡ @£ U @ ¢© @ §¢¥¤¡ @ @£ © @ A£ ¢WW¢`YH¨¢¢ ¡ © ¡ a a A U © ¡  §   U  V § ¡   X U £ ¡I £  Q § ¡ ¢¢A¢¨Y¢H¢PR¤¢¨¥£ FRAME# AD, C/BE# FRAME# PCI Read DEVSEL# TRDY# IRDY# C/BE# GNT# CLK AD 1 2 3 4 5 6 7 8 9 I © ¡¢YQ @  ©¢A @ ¤PbU YC ¢ £ U I    @   §    £  Q§ £&¡R¤¢¨¡¥£ ¢©¢Yp¡i¢¨§¢gf¨¢¥G g A§ h © £  U§ A © A£e¥£T¢¡¢YQ @   §    ¡ I © F ¡ § c   £  Q§ G¨b¢dR¤¢¨¡¥£   E ¡ ©  £ F PI¢¢H¥GE   CD@ §¢B§¢¥¤¡ @ @£ © @ A£ ¥¤¡¢ ¡£   DC@ §¢R¤¢¨¡¥£ £ Q§ ¥¤W¢¡ £ © Q¢© @ T§¢©¢A @ ¤¢¨§¥£ £    ¡ V £ U ¡ © ¡ £§ ¡£  A£ T¥¤B§¢¥¤¡ @ @£ PS © Disk Organization sector Platters track cylinder Sizes are growing (a 9GB disk is 109 bytes) • • IBM: 35.3 billion bits/sq. inch (Oct 1999) Production: >10 billion bits/sq. inch Disk Performance Disks rotate at 7200-15000rpm (6-8ms per revolution) Rotational latency: • Average latency to a sector: 3-4ms Transfer time: • • Transfer size is about a sector (512B to 1KB) Typical values: 40-160MB/s Read time = seek time + rotation latency + transfer time + controller overhead I/O Transfers Normal mode: • • • • Operating system requests transfer from disk Disk wants to write to memory As described, needs OS intervention to write each word to memory! Observation: I/O controller is on the memory bus... What if we allow the device to write directly to memory? (Notify the CPU when the transfer is complete) DMA DMA: direct memory access • • OS asks device to read data into memory Device transfers data directly to memory – – – Might interfere with cache miss requests! What if the address is cached? What happens if the address is not mapped?! - Can use kernel addresses (requires copy) - Notify OS: pages are - TLB shootdown? pinned • Device sends interrupt when done ...
View Full Document

This note was uploaded on 06/25/2008 for the course ECE 3140 taught by Professor Mckee/long during the Spring '07 term at Cornell University (Engineering School).

Ask a homework question - tutors are online