Chapter 7 - Input Output
Chapter 7 - Input Output
Chapter 7 Input/Output
Objectives
Why are peripherals not connected directly to the system bus?
Why IO module is needed?
How to control IO devices?
How to increase IO operations?
After studying this chapter, you should be able to:
Explain the use of I/O modules as part of a computer
organization.
Understand the difference between programmed I/O
and interrupt-driven I/O and discuss their relative
merits.
Present an overview of the operation of direct memory
access (DMA).
Explain the function and use of I/O channels.
+ 3
Contents
The data transfer rate of peripherals is often much slower than that of
the memory or processor. Thus, it is impractical to use the high-speed
system bus to communicate directly with a peripheral.
The data transfer rate of some peripherals can be faster than that of
the memory or processor. Again, the mismatch would lead to
inefficiencies if not managed properly.
Peripherals often use different data formats and word lengths than
the computer to which they are attached.
+ Generic
Model
of an I/O
Module
Why an IO module is
needed?
• Interface to the
processor and memory
via the system bus or
central switch
Three categories:
Provide a means of
exchanging data between the Human readable
external environment and the Suitable for communicating with
computer the computer user
Video display terminals (VDTs),
printers
Attach to the computer by a
link to an I/O module Machine readable
The link is used to exchange Suitable for communicating with
control, status, and data equipment
between the I/O module and Magnetic disk and tape systems,
the external device sensors and actuators (thiết bị
khởi phát)
timing
Module Functions • Coordinates the
flow of traffic
between internal
resources and
external devices
Error Processor
detection communication
• Involves command
• Detects and decoding, data,
reports The major status reporting,
transmission functions for address
errors recognition
an I/O
module fall
into the
following
categories:
Data buffering
Device
• Performs the communication
needed buffering
operation to • Involves
balance device commands, status
and memory information, and
speeds data
I/O Module Structure 10
IO Module
+ 7.3- Programmed I/O 11
Programmed I/O
Data are exchanged between the processor and the I/O module
Processor executes a program that gives it direct control of the I/O operation
When the processor issues a command it must wait until the I/O operation is
complete
If the processor is faster than the I/O module this is wasteful of processor time
Interrupt-driven I/O
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 processor
involvement
+ 12
I/O Commands
There are four types of I/O commands that an I/O module may
receive when it is addressed by a processor:
1) Control
- used to activate a peripheral and tell it what to do
2) Test
- used to test various status conditions associated with an I/O
module and its peripherals
3) Read
- causes the I/O module to obtain an item of data from the
peripheral and place it in an internal buffer
4) Write
- causes the I/O module to take an item of data from the data bus
and subsequently transmit that data item to the peripheral
13
Three
Techniques
for Input of a
Block of Data
I/O Instructions 14
The form of
the When the processor Memory-mapped I/O
instruction issues an I/O command,
the command contains
depends the address of the
on the way desired device
in which There is a single A single read line
external address space for and a single write
devices are memory locations line are needed on
Thus each I/O module and I/O devices the bus
addressed must interpret the
address lines to
determine if the
command is for itself
+ 15
Isolated I/O
Separate address spaces 2 different
system buses
Need I/O or memory select lines for Memory and
IO devices
Special commands for I/O MEM.
CPU
Limited set
Io module
16
Memory
Mapped
I/O
Isolated
I/O
Example
+
7.4- Interrupt-Driven I/O 17
Simple Interrupt
Processing
READ BY YOURSELF
PSW: Process Status Word
+
Changes
in Memory
and Registers
for an
Interrupt
Design Issues
20
Software poll
When processor detects an interrupt it branches to an interrupt-service routine whose job is
to poll each I/O module to determine which module caused the interrupt
Time consuming
READ BY YOURSELF
Intel 82C55A
+ 23
READ BY YOURSELF
+
Keyboard/
Display
Interfaces to
82C55A
READ BY YOURSELF
25
Drawbacks of Programmed and
Interrupt-Driven I/O
DMA
DMA
+ 7.12 shows where in the instruction cycle the processor may be suspended.
Figure
In each case, the processor is suspended just before it needs to use the bus.
The DMA module then transfers one word and returns control to the processor.
Note that this is not an interrupt; the processor does not save a context and do
something else. Rather, the processor pauses for one bus cycle. The overall effect
is to cause the processor to execute more slowly. Nevertheless, for a multiple-word
I/O transfer, DMA is far more efficient than interrupt-driven or programmed I/O.
+
Alternative
DMA
Configurations
8237 DMA Usage of System Bus 29
READ BY YOURSELF
E/D = enable/disable
TC = terminal count
+ 7.6- IO Channels and Processors 32
Input/Output
Chapter 7
Direct memory access
External devices Drawbacks of programmed and
interrupt-driven I/O
Keyboard/monitor
DMA function
Disk drive
Intel 8237A DMA controller
I/O modules
Module function
I/O channels and processors
I/O module structure
The evolution of the I/O function
Programmed I/O
Characteristics of I/O channels
Overview of programmed I/O
I/O commands
The external interface
I/O instructions
Types of interfaces
Interrupt-driven I/O
Point-to-point and multipoint
Interrupt processing configurations
Design issues Thunderbolt
Intel 82C59A interrupt controller InfiniBand
Intel 82C55A programmable
peripheral interface