I/O Organizations and Peripherals
I/O Organizations and Peripherals
I/O Organizations and Peripherals
INPUT-OUTPUT MODULES
The computer will be of no use if it is not communicating with the external world.
A computer must have a system to receive information from outside world and must
be able to communicate results to external world.
Thus, a computer consists of an I/O (input-output) system.
This system includes two basic components:
(i) the I/O devices and
(ii) I/O module, which not only connects an I/O device with the system bus, but plays a
very crucial role in between.
A device which is connected to an I/O module of computer is called a peripheral
device.
Thus,
(i) An I/O module is a mediator between the processor and an I/O
device/devices.
(ii) It controls the data exchange between the external devices and main memory
or CPU registers.
(iii)An I/O module provide an interface internal to the computer which connects it
to CPU and main memory and an interface external to the computer connecting it
to external device or peripheral.
(iv)The I/O module should not only communicate the information from CPU to I/O
device, but it should also coordinate these two.
(v)In addition since there are speed differences between CPU and I/O devices,
the I/O module should have facilities like buffer (storage area) and error detection
mechanism.
PROGRAMMED I/O
Overview of Programmed I/O
When the processor is executing a program and encounters
an instruction relating to I/O, it executes that instruction by
issuing a command to the appropriate I/O module.
With programmed I/O, the I/O module will perform the
requested action and then set the appropriate bits in the I/O
status register (Figure 7.3).
The I/O module takes no further action to alert the
processor.
In particular, it does not interrupt the processor.
Thus, it is the responsibility of the processor periodically to
check the status of the I/O module until it finds that the
operation is complete.
To explain the programmed I/O technique, we view it first
from the point of view of the I/O commands issued by the
processor to the I/O module, and then from the point of
view of the I/O instructions executed by the processor.
I/O Commands
To execute an I/O-related instruction, the processor issues an
address, specifying the particular I/O module and external
device, and an I/O command.
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. For
example, a magnetic-tape unit may be instructed to rewind or
to move forward one record. These commands are tailored to
the particular type of peripheral device.
Test: Used to test various status conditions associated with an
I/O module and its peripherals. The processor will want to know
that the peripheral of interest is powered on and available for
use. It will also want to know if the most recent I/O operation is
completed and if any errors occurred.
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 data bus and subsequently transmit that data
item to the peripheral.
I/O Instructions
With programmed I/O, there is a close correspondence
between the I/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.
That is, the instructions are easily mapped into I/O
commands, and there is often a simple one-to-one
relationship.
The form of the instruction depends on the way in which
external devices are addressed.
Typically, there will be many I/O devices connected through
I/O modules to the system.
Each device is given a unique identifier or address.
When the processor issues an I/O command, the command
contains the address of the desired device.
Thus, each I/O module must interpret the address lines to
determine if the command is for itself
INTERRUPT-DRIVEN I/O
DMA Function
DMA involves an additional module on the system bus.
The DMA module (Figure 7.11) is capable of mimicking the
processor and, indeed, of taking over control of the system
from the processor.
It needs to do this to transfer data to and from memory over
the system bus.
For this purpose, the DMA module must use the bus only when
the processor does not need it, or it must force the processor
to suspend operation temporarily.
The latter technique is more common and is referred to as
cycle stealing, because the DMA module in effect steals a bus
cycle.
When the processor wishes to read or write a block of data, it
issues a command to the DMA module, by sending to the DMA
module the following information:
Whether a read or write is requested, using the read or write
control line between the processor and the DMA module
The address of the I/O device involved, communicated on the
data lines
The starting location in memory to read from or write to,
communicated on the data lines and stored by the DMA