Professional Documents
Culture Documents
Arc Chap5
Arc Chap5
Arc Chap5
23-Oct-16
Input Output 2
In this chapter:
Peripheral Devices
I/O techniques
DMA
23-Oct-16
I/O Issues 3
23-Oct-16
I/O Issues 4
I/O modules
Interface to CPU and Memory
Interface to one or more peripherals
Device
Interface External
sensors
Processor Bus I/O Device and
Module Interface controls
Device
Interface
23-Oct-16
Peripheral Devices 5
23-Oct-16
Peripheral Devices 7
Control logic
Is the I/O module's interface to the device
Data channel
Passes the data from/to the device
On the opposite end is the I/O module, but eventually it is the
processor.
Transducer
Acts as a converter between the digital data of the I/O module
and the signals of the outside world.
Keyboard converts motion of key into data representing key
pressed or released
Temperature sensor converts amount of heat into a digital value
Disk drive converts magnetic patterns on disk to bits in the
device buffer
23-Oct-16
I/O Modules 8
Functions
Control & Timing
CPU Communication
Device Communication
Data Buffering
Error Detection
23-Oct-16
I/O Modules 9
23-Oct-16
I/O Modules 10
CPU Communication
Commands from processor
Examples: READ SECTOR, WRITE SECTOR,
SEEK track number
Data
Passed back and forth over the data bus
Status reporting
Request from the processor for the I/O Module's
status
May be as simple as BUSY and READY
Address recognition
The I/O module must recognize one unique
23-Oct-16
address for each device it controls
I/O Modules 11
Device Communication
Specific to each device (commands, status, data)
Data Buffering
Due to the differences in speed (device is usually
orders of magnitude slower) the I/O module needs to
buffer data to keep from tying up the CPU's bus with
slow reads or writes
Error Detection
Distribute the error handling to the module
Malfunctions by device (paper jam)
Data errors (parity checking at the device level)
Internal errors to the I/O module such as buffer
23-Oct-16
overruns
I/O Module Structure 12
23-Oct-16
I/O Module Operation 13
23-Oct-16
I/O Module Operation 14
23-Oct-16
I/O Techniques 15
Programmed I/O
poll and response
Interrupt Driven I/O
module calls for CPU when needed
Direct Memory Access (DMA)
I/O module has direct access to specified
block of memory
23-Oct-16
I/O Techniques 16
23-Oct-16
Programmed I/O 17
Operation
CPU fetches I/O instruction from memory
CPU issues I/O command
I/O module performs operation
I/O module sets status bits
CPU checks status bits periodically
I/O module does not inform CPU directly
I/O module does not interrupt CPU
CPU may wait or come back later
Wastes CPU time because typically the
processor is much faster than I/O
23-Oct-16
Programmed I/O 18
23-Oct-16
Programmed I/O 20
Memory-mapped I/O
Devices and memory share an address space
I/O read/write looks just like memory read/write
No special commands for I/O
Large selection of memory access commands
available
Isolated I/O
Same address lines, but separate address spaces
Need extra lines to select I/O or memory
Special commands for I/O
Limited set
23-Oct-16
Programmed I/O 21
Memory-mapped I/O
vs. Isolated I/O
23-Oct-16
Interrupt Driven I/O 22
23-Oct-16
Interrupt Driven I/O 23
23-Oct-16
Interrupt Driven I/O 24
23-Oct-16
Design Issues 26
23-Oct-16
Identifying Interrupting Module 27
23-Oct-16
Identifying Interrupting Module 28
Software poll
Single interrupt line
CPU asks each module to see who needs
attention
Slow
Priority
set by the order in which CPU polls the
devices
23-Oct-16
Example – Interrupt Controller 29
82C59A Interrupt
Controller
Used with 80386
processor
CPU has one
interrupt line
8259A has 8
interrupt lines
23-Oct-16
Example – Interrupt Controller 30
Sequence of events
82C59A accepts interrupts
82C59A determines priority
Fully nested
o IR0 (highest) through IR7 (lowest)
Rotating
o after interrupt is serviced, it goes to bottom of priority list
Special mask
o allows individual interrupts to be disabled
82C59A signals CPU (raises INTR line)
CPU acknowledges (with INTA line)
82C59A puts correct vector on data bus
CPU processes interrupt
23-Oct-16
Direct Memory Access 31
Motivation
Both programmed I/O and interrupt driven I/O
require active CPU intervention
Transfer rate is limited by CPU's ability to service the
device
CPU is tied up managing I/O transfer
Direct memory access (DMA)
Additional module (hardware) on bus
DMA controller takes over bus from CPU for I/O
Waiting for a time when the processor doesn't need
the bus
Cycle stealing – seizing bus from CPU (more
23-Oct-16
common)
Direct Memory Access 32
DMA module
23-Oct-16
Direct Memory Access 33
Operation
CPU tells DMA controller:
Read/Write
Device address
Starting address of memory block for data
Amount of data to be transferred
CPU performs other work
DMA controller performs transfer
DMA controller sends interrupt when finished
23-Oct-16
Direct Memory Access 34
Cycle stealing
DMA controller takes over bus for a cycle
Transfer of one word of data
Not an interrupt
CPU does not switch context
CPU suspended just before it accesses bus
i.e. before an operand or data fetch or a data
write
Slows down CPU but not as much as CPU
doing transfer
23-Oct-16
DMA Configurations 35
23-Oct-16
DMA Configurations 36
23-Oct-16
DMA Configurations 37
23-Oct-16
38
THANK YOU!!!!
23-Oct-16