Professional Documents
Culture Documents
Comp Arch Chapter6v2010Sum
Comp Arch Chapter6v2010Sum
INPUT/OUTPUT UNIT
1
OUTLINE
Introduction
Input/output Modules
I/O Module Function
I/O Module Structure
Input/output Techniques
Programmed I/O
I/O Commands
I/O Instructions
2
INTRODUCTION
I/O modules
Third key element of a computer system, next to
processor and memory
Interfaces to a system bus and controls one or more
peripheral devices
Contains logic/intelligence
To perform communication function b/n the peripherals and
the bus
3
INTRODUCTION…
Why peripheral devices not connected directly to the system
bus ?
Reasons
Wide variety of peripherals with different method of operation
Impractical to incorporate the necessary logic within the processor to
control a range of devices
Delivering different amounts of data
At different speeds
In different formats
All slower than CPU and RAM
5
INTRODUCTION…
External devices
Used to accomplish I/O operations
Provides a means of exchanging data between
External environment
Computer
6
INTRODUCTION…
External devices broadly classified into three
categories:
Human readable devices
Suitable for communicating with the computer user
E.g., Screen, printer, keyboard
Communication devices
Allow the computer to exchange data with a remote device
E.g., Modem, Network Interface Card (NIC)
7
I/O MODULE FUNCTION
The major functions performed by I/O module fall into
the following categories
Control & Timing
Processor Communication
Device Communication
Data Buffering
Error Detection
8
I/O MODULE STRUCTURE
A block diagram of an I/O module
9
I/O MODULE STRUCTURE…
Module connects to the rest of the computer through a set of signal lines –
system bus
Data transferred to and from the module are buffered in one or more data
registers
Module logic interacts with processor via a set of control signal lines
Processor uses control signal lines to issue commands to the I/O module
Some of the control lines may be used by the I/O module, for arbitration and status
signals
The I/O module contains logic specific to the interface with each device that it 10
controls
INPUT OUTPUT TECHNIQUES
Three techniques exist for I/O operations:
Programmed I/O
The processor issues an I/O command to the I/O module and
waits until the I/O operation is complete
If the processor is faster than the I/O module, it wastes
processor time
Interrupt driven I/O
The processor issues an I/O command, continues to execute
other instructions and is interrupted by the I/O module
when the latter has completed its work
Direct Memory Access (DMA)
The I/O module and main memory exchange data directly,
without the processor involvement
11
PROGRAMMED I/O…
Overview of Programmed I/O
CPU issues an I/O command to the appropriate I/O module
I/O module performs the requested operation
I/O module sets status bits in the I/O status register
CPU checks status bits periodically
I/O module does not inform/interrupt CPU directly
CPU waits for I/O module to complete operation
Wastes CPU time
There are four types of I/O commands that an I/O module may
receive, when it is addressed by a processor:
Control
Used to activate a peripheral and tell it what to do
Test
Used to test various status condition associated with an I/O module and
its peripherals
Read
Causes the I/O module to obtain an item of data from the peripheral
and place it in an internal buffer
The processor can then obtain the data item by requesting that the I/O
module place it on the data bus
Write
Causes the I/O module to take an item of data (byte or word) from the 13
data bus and subsequently transmit that data item to the peripheral.
PROGRAMMED I/O…
I/O INSTRUCTIONS
With programmed I/O, there is a close correspondence between
The l/O related instructions that the processor fetches from
memory and
The I/O commands that the processor issues to an I/O module
to execute the instructions
17
INTERRUPT DRIVEN I/O…
CPU Viewpoint (for input)
Issue read command
Do other work
Check for interrupt at end of each instruction cycle
If interrupted:
Save context (registers) of the current program
Process the interrupt
Read a data from the I/O module and store it in memory
Software poll
CPU asks each module in turn when an interrupt
occurs by running a generic interrupt service routine
Once the correct module is identified
The CPU branches to a device service routine specific to
that device
20
Time consuming, slow
INTERRUPT DRIVEN I/O…
Daisy chain /Hardware poll
All modules share a common interrupt request line
Interrupt ack line is daisy chained through modules
Ack signal propagates through a series of I/O modules until
it gets to a requesting module
The module responsible places (data) vector on bus
CPU uses vector to identify handler routine
Bus master
Module must claim the bus before it can raise
interrupt
Only one module can raise the line at a time 21
INTERRUPT DRIVEN I/O…
Which interrupt to process when multiple
interrupts occur at the same time
With multiple lines
Each interrupt line has a priority
CPU picks the interrupt line with high priority
23
DIRECT MEMORY ACCESS…
The need for Direct Memory Access
Interrupt driven I/O efficient than programmed I/O
But both, interrupt driven and programmed I/O,
require active CPU intervention
Any data transfer traverses a path through the processor
Both forms of I/O suffer from two inherent drawbacks
I/O transfer rate is limited by speed of the processor to test
and service a device
CPU is tied up in managing an I/O transfer
25
DIRECT MEMORY ACCESS…
Typical DMA Module Diagram
26
DIRECT MEMORY ACCESS…
DMA Operation
When the processor wants to read/write a block of data. It tells the
DMA controller the following information:
Whether Read/Write is requested
Using the read/write control line b/n the processor and the DMA module
The address of the I/O device involved
Communicated over data bus
29