Upload
shahadfais
View
3
Download
0
Embed Size (px)
Citation preview
1
Input/Output
I/O Modules and Peripheral Devices
I/O modulesWide variety of peripherals
Delivering different amounts of dataAt different speedsIn different formatsPerformance mismatch with processor/memory
InterfaceBetween processor/memory and peripheral devices
Generic Model of I/O Module
2
I/O Modules and Peripheral Devices
I/O modulesPeripheral devices
Provide a means of exchanging data betweenProvide a means of exchanging data between external environment and computerDifferent categories
Human readable, machine readable, communication
InterfaceControl, data, and status
External Device Block Diagram
Typical I/O Steps
CPU checks I/O module device statusI/O module returns statusIf ready, CPU requests data transferI/O module gets data from deviceI/O module transfers data to CPU
3
I/O Module Diagram
Three Types of I/O
Programmed I/OInterrupt-Driven I/ODirect Memory AccessDirect Memory Access
Programmed I/O
CPU has direct control over I/OSensing statusRead/write commandsRead/write commandsTransferring data
Memory mapped and Isolated I/O
4
Memory Mapped I/O vsIsolated I/O
Memory-mapped I/OControlling devices just like reading/writing memoryRequires no special instructions
l d (S l ) /OIsolated (Special-purpose) I/ONo loss of memory addresses to peripheralsSimpler address decoding logicCan be fasterSpecial I/O instructions needed
Interrupt Driven I/O
Overcomes CPU waitingNo repeated CPU checking of devicep gI/O module interrupts when ready
Interrupt Driven I/O Basic Operation
Interrupt request signal (device processor)Finishes execution of the current instructionAcknowledgement of interruptSave PC and program state informationTransfer control to interrupt service handlerRestore PC and program state informationExecute next instruction
5
Direct Memory Access
Why DMA? Interrupt driven and programmed I/O require active CPU intervention
T f t i li it dTransfer rate is limitedCPU is tied up
DMA is the answerWhat is DMA (direct memory access)
An efficient technique to move large volume of data
How DMA ?
Additional I/O module on system busDMA controller takes over bus from CPU
CPU is suspended if requiring buses
DMA Operation
CPU tells DMA controller:Read/WriteDevice addressDevice addressStarting address of memory block for dataAmount of data to be transferred
CPU carries on with other workDMA controller deals with transferDMA controller sends interrupt when finished
6
Data Transfer Using DMA
Cycle StealThe DMA controller generates read or write signals at cycles when the processor is not g y pusing the bus
Burst TransferTransfer a block of data within certain consecutive cyclesCPU may be halted completely.
ExampleConsider a device that can transfer data at rate of 8KB/s. Assume the device is driven by interrupt and the interrupt takes total 100 us for transferring one byte
If the processor has to be interrupted for every byte, what fraction of processor time is consumed by this device?
Now assume that the device has two 16-byte buffers and interrupts the processor when one of the buffers is full. The interrupt will take 8us more for each additional byte. How much processor time is consumed by this device?
Summary
I/O interface and devicesThree types of I/O
Program I/OProgram I/OInterrupt I/ODMA