INPUT/OUTPUT
In addition to the processor and a set of memory modules, the third key element of a computer
system is a set of I/O modules. Each module interfaces to the system bus or central switch and
controls one or more peripheral devices. An I/O module is not simply a set of mechanical
connectors that wire a device into the system bus. Rather, the I/O module contains logic for
performing a communication function between the peripheral and the bus. The reader may
wonder why one does not connect peripherals directly to the system bus. The reasons are as
follows:
There are a wide variety of peripherals with various methods of operation. It would be
impractical to incorporate the necessary logic within the processor to control a range of
devices.
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.
On the other hand, the data transfer rate of some peripherals is 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.
Thus, an I/O module is required. This module has two major functions
Interface to the processor and memory via the system bus or central switch
Interface to one or more peripheral devices by tailored data links
EXTERNAL DEVICES
I/O operations are accomplished through a wide assortment of external devices that provide a
means of exchanging data between the external environment and the computer. An external
device attaches to the computer by a link to an I/O module. The link is used to exchange control,
status, and data between the I/O module and the external device. An external device connected to
an I/O module is often referred to as a peripheral device or, simply, a peripheral.
We can broadly classify external devices into three categories:
Human readable: Suitable for communicating with the computer user
Machine readable: Suitable for communicating with equipment
Communication: Suitable for communicating with remote devices
Examples of human-readable devices are video display terminals (VDTs) and printers. Examples
of machine-readable devices are magnetic disk and tape systems, and sensors and actuators, such
as are used in a robotics application. Note that we are viewing disk and tape systems as I/O
devices in this chapter, whereas earlier we viewed them as memory devices. From a functional
point of view, these devices are part of the memory hierarchy. From a structural point of view,
these devices are controlled by I/O modules and are hence to be considered in this chapter.
Communication devices allow a computer to exchange data with a remote device,
which may be a human-readable device, such as a terminal, a machine-readable device, or even
another computer.
In very general terms, the nature of an external device is indicated in Figure 7.2. The interface to
the I/O module is in the form of control, data, and status signals.
Control signals determine the function that the device will perform such as
send data to the I/O module (INPUT or READ)
accept data from the I/O module (OUTPUT or WRITE),
report status,
or perform some control function particular to the device (e.g., position a disk head).
Data are in the form of a set of bits to be sent to or received from the I/O module.
Status signals indicate the state of the device.
Examples are READY/NOT-READY to show whether the device is ready for data transfer.
Control logic associated with the device controls the device’s operation in response to direction
from the I/O module. The transducer converts data from electrical to other forms of energy
during output and from other forms to electrical during input. Typically, a buffer is associated
with the transducer to temporarily hold data being transferred between the I/O module and the
external environment; a buffer size of 8 to 16 bits is common.
Keyboard/Monitor
The most common means of computer/user interaction is a keyboard/monitor arrangement. The
user provides input through the keyboard. This input is then transmitted to the computer and may
also be displayed on the monitor. In addition, the monitor displays data provided by the
computer. The basic unit of exchange is the character.
Associated with each character is a code, typically 7 or 8 bits in [Link] most commonly used
text code is the International Reference Alphabet (IRA).1 Each character in this code is
represented by a unique 7-bit binary code; thus, 128 different characters can be represented.
Characters are of two types: printable and control. Printable characters are the alphabetic,
numeric, and special characters that can be printed on paper or displayed on a screen. Some of
the control characters have to do with controlling the printing or displaying of characters; an
example is carriage return.
For keyboard input, when the user depresses a key, this generates an electronic signal that is
interpreted by the transducer in the keyboard and translated into the bit pattern of the
corresponding IRA code. This bit pattern is then transmitted to the I/O module in the computer.
At the computer, the text can be stored in the same IRA code. On output, IRA code characters
are transmitted to an external device from the I/O [Link] transducer at the device interprets
this code and sends the required electronic signals to the output device either to display the
indicated character or perform the requested control function.`
I/O MODULES
Module Function
The major functions or requirements for an I/O module fall into the following
categories:
Control and timing
Processor communication
Device communication
Data buffering
Error detection
During any period of time, the processor may communicate with one or more external devices in
unpredictable patterns, depending on the program’s need for I/O. The internal resources, such as
main memory and the system bus, must be shared among a number of activities, including data
I/O. Thus, the I/O function includes a control and timing requirement, to coordinate the flow of
traffic between internal resources and external devices. For example, the control of the transfer
of data from an external device to the processor might involve the following sequence of steps:
1. The processor interrogates the I/O module to check the status of the attached device.
2. The I/O module returns the device status.
3. If the device is operational and ready to transmit, the processor requests the transfer of
data, by means of a command to the I/O module.
4. The I/O module obtains a unit of data (e.g., 8 or 16 bits) from the external device.
5. The data are transferred from the I/O module to the processor.
Processor communication involves the following:
Command decoding: The I/O module accepts commands from the processor, typically sent as
signals on the control bus. For example, an I/O module for a disk drive might accept the
following commands: READ SECTOR, WRITE SECTOR, SEEK track number, and SCAN
record ID. The latter two commands each include a parameter that is sent on the data bus.
Data: Data are exchanged between the processor and the I/O module over the data bus.
Status reporting: Because peripherals are so slow, it is important to know the status of the I/O
module. For example, if an I/O module is asked to send data to the processor (read), it may not
be ready to do so because it is still working on the previous I/O command. This fact can be
reported with a status signal.
Address recognition: Just as each word of memory has an address, so does each I/O device.
Thus, an I/O module must recognize one unique address for each peripheral it controls.
I/O module must be able to perform device communication. This communication involves
commands, status information, and data (Figure 7.2). An essential task of an I/O module is data
buffering. Whereas the transfer rate into and out of main memory or the processor is quite high,
the rate is orders of magnitude lower for many peripheral devices and covers a wide range. Data
coming from main memory are sent to an I/O module in a rapid [Link] data are buffered in
the I/O module and then sent to the peripheral device at its data rate. In the opposite direction,
data are buffered so as not to tie up the memory in a slow transfer operation. Thus, the I/O
module must be able to operate at both device and memory speeds. Similarly, if the I/O device
operates at a rate higher than the memory access rate, then the I/O module performs the needed
buffering operation.
Finally, an I/O module is often responsible for error detection and for subsequently reporting
errors to the processor. One class of errors includes mechanical and electrical malfunctions
reported by the device (e.g., paper jam, bad disk track). Another class consists of unintentional
changes to the bit pattern as it is transmitted from device to I/O module. Some form of error-
detecting code is often used to detect transmission errors. A simple example is the use of a parity
bit on each character of data. For example, the IRA character code occupies 7 bits of a [Link]
eighth bit is set so that the total number of 1s in the byte is even (even parity) or odd (odd
parity).When a byte is received, the I/O module checks the parity to determine whether an error
has occurred.
I/O TECHNIQUES
Three techniques are possible for I/O operations. With programmed I/O, data are exchanged
between the processor and the I/O module. The processor executes a program that gives it direct
control of the I/O operation, including sensing device status, sending a read or write command,
and transferring the data. When the processor issues a command to the I/O module, 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.
With 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. With
both programmed and interrupt I/O, the processor is responsible for extracting data from main
memory for output and storing data in main memory for input.
The alternative is known as direct memory access (DMA). In this mode, the I/O module and
main memory exchange data directly, without processor involvement.
THE EXTERNAL INTERFACE: FIREWIRE AND INFINIBAND
Types of Interfaces
The interface to a peripheral from an I/O module must be tailored to the nature and operation of
the peripheral. One major characteristic of the interface is whether it is serial or parallel (Figure
7.16). In a parallel interface, there are multiple lines connecting the I/O module and the
peripheral, and multiple bits are transferred simultaneously, just as all of the bits of a word are
transferred simultaneously over the data bus. In a serial interface, there is only one line used to
transmit data, and bits must be transmitted one at a time. A parallel interface has traditionally
been used for higher-speed peripherals, such as tape and disk, while the serial interface has
traditionally been used for printers and terminals