William Stallings Computer Organization and Architecture
William Stallings Computer Organization and Architecture
Computer Organization
and Architecture
Chapter 6
Input/Output
Input/Output Problems
• Wide variety of peripherals
—Delivering different amounts of data
—At different speeds
—In different formats
• All slower than CPU and RAM
• Need I/O modules
—Contains logic for performing a communication
function
Input/Output Module
• Interface to CPU and Memory
• Interface to one or more peripherals
Generic Model of I/O Module
External Devices
• Human readable
—Communicating with computer user
—Screen, printer, keyboard
• Machine readable
—Communicating with equipment
—Monitoring and control
• Communication
—Communicating with remote devices
—Modem
—Network Interface Card (NIC)
External Device Block Diagram
I/O Module Function
• Control & Timing
—To control flow of traffic between internal resources
and external devices
• CPU Communication
—Command decoding, data, status reporting, address
recognition
• Device Communication
—Commands, status information and data
• Data Buffering
—To operate at both device and memory speeds
• Error Detection
—Reporting errors to the processor
I/O Steps
• CPU checks I/O module device status
• I/O module returns status
• If ready, CPU requests data transfer
• I/O module gets data from device
• I/O module transfers data to CPU
• Variations for output, DMA, etc.
I/O Module Diagram
I/O Module Decisions
• Hide or reveal device properties to CPU
• Support multiple or single device
• Control device functions or leave for CPU
Input Output Techniques
• Programmed
• Interrupt driven
• Direct Memory Access (DMA)
Programmed I/O
• CPU has direct control over I/O
—Sensing status
—Read/write commands
—Transferring data
• CPU waits for I/O module to complete operation
• Wastes CPU time
Programmed I/O - detail
• CPU requests I/O operation
• 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
I/O Commands
• CPU issues address
—Identifies module (& device if >1 per module)
• CPU issues command
—Control - telling module what to do
– e.g. spin up disk
—Test - check status
– e.g. power? Error?
—Read/Write
– Module transfers data via buffer from/to device
Addressing I/O Devices