The computer systems Input/output (I/O) architecture is to interface to the outside world.
Till now we have discussed the two important module of computer system – the
processor and the memory module.
The third key component of computer system is a set of I/O modules.
Each I/O module interfaces to the system bus and controls one or more peripheral devices.
There are several reasons why an I/O device or peripheral device is not directly connected to the system bus. Some of them are as follows:
; There are a wide variety of peripherals with various methods of operation. It would be impractical to include the necessary logic within the processor include the several 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.
; Peripherals often use different data format and word length than the computer to which they are attached.
Thus, an I/O module is required.
The major functions of an I/O module are categorized as follows:
; Control and
; Device communication
; Data buffering
; Error Detection
During any period of time, the processor may communicate with one or more external devices in unpredictable manner, depending on the programs 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.
Therefore, the I/O function includes a control and timing requirements 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:
a) The processor interacts with the I/O module to check the status of the attached
b) The I/O module returns the device status.
c) If the device is operational and ready to transmit, the processor requests the
transfer of data, by mean of a command to the I/O module.
d) The I/O module obtains a unit data from external device.
e) The data are transferred from the I/O module to the processor.
If the system employs a bus, then each of the interactions between the processor and the I/O module involves one or more bus arbitrations.
During the I/O operation, the I/O module must communicate with the processor and with the external device.
Processor communication involves the following:
1. Command decoding: The I/O module accepts command from the processor,
typically sent as signals on control bus.
2. Data: Data are exchanged between the processor and the I/O module over the data
3. Status reporting: Because peripherals are so slow, it is important to know the
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. Common status signals are BUSY and READY.
4. Address recognition: Just as each word of memory has an address, so thus each
I/O device. Thus an I/O module must recognize are unique address for each
peripheral it controls.
On the other side, the I/O module must be able to perform device communication. This communication involves commands, status information, and data.
An essential task of an I/O module is data buffering. The data buffering is required due to the mismatch of the speed of CPU, memory and other peripheral devices. In general the speed of CPU is higher than the speed of the other peripheral devices. So the I/O module stores the data in a data buffer and regulates the transfer of data as per the speed of the devices.
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 speed.
Another task of I/O module error detection and for subsequently reporting error to the processor. One class of error includes mechanical and electrical malfunctions reported by
the device (e.g. paper jam). Another class consists of unintentional changes to the bit
pattern as it is transmitted from device to I/O module.
Block diagram of I/O module is shown in the figure.
There are three basic from of input and output systems
; Programmed I/O
; I/O mapped input/output
; Memory-mapped Input/Output
; Direct Memory Access (DMA)
I/O mapped input/output uses special instruction to transfer data between the computer system and the outside world.
Memory-mapped I/O uses special memory locations in the normal address space of the CPU to communicate with real world devices.
DMA is a special form of memory mapped I/O where the peripheral device reads and writes memory with out going through the CPU.
To send data to an input device, the CPU simply moves that data to a special memory location in the I/O address space if I/O mapped input/output is used or to an address in the memory address space if memory mapped I/O is used.
To read data from an input device the CPU simply moves data from the address (I/O or memory) of that device into the CPU.
The input and output operation looks very similar to a memory read or write operation except it usually takes move time since peripheral devices are slow in speed than main memory module.
An I/O port is a device that looks like a memory cell to the computer but contains connection to the outside world.
An I/O port typically uses a catch. When the CPU writes to the address associated with the Catch, the catch device captures the data and makes it available on a set of wires external to the CPU and memory system.
The I/O ports can be read only, write only or read/write.
The write only port is shown in the figure:
The device is identified by putting the appropriate address in the I/O address lines. The address decoder with generate the signal for address decode line. According to the operation
First the CPU will place the address of the device on the I/O address bus and with the help of address decoder a signal is generated which will enable the latch.
Next CPU will indicate the operation is a write operation by putting the appropriate signal in CPU write control line.
Then the data to be transferred will be placed in the CPU bus which will be stored in the latch for the onward transmission to the device.
Both the address decodes and writes control lines must be active for the latch to operate.
The read/write or input/output port is shown in the figure.
The device is identified by putting the appropriate address in the I/O address lines. The address decoder with generate the signal for address decode line. According to the operation, read or write it will select either of the latches.
If it is a write operation, then data will be placed in the latch from CPU for onward transmission to the output device.
If it is a read operation, the data that are already stored in the latch with be transferred to CPU.
A read only (input) port is simply the lower half of this figure.
In case of I/O mapped I/O, a different address space is used for I/O devices. The address space for memory in different.
In case of memory-mapped I/O, same address space is used for both memory and I/O devices. Some of the memory address spaces are kept reserved for I/O devices.
To the programmer, the difference between I/O-mapped and memory mapped
input/output operation is the instruction to use. For memory-mapped I/O, any instruction that accesses memory can access a memory mapped I/O past.
I/O mapped input/output uses special instruction to access I/O port.
Generally, a given peripheral device will use more than a single I/O port. A typical PC parallel printer interface, for example, uses three ports: a read (write port, an input port and an output port.
The read/write port is the data port (it is read/write to allow the CPU to read the last ASCII character it wrote to the printer port).
The input port returns control signals from the printer, these signals indicate whether the printer is ready to accept another character, is off-line, is out of paper, etc.
The output port transmits control information to the printer such as whether data is available to print.
Memory-mapped I/O subsystems and I/O mapped subsystem both require the CPU to move data between the peripheral device and main memory.
For example, to input a sequence of 20 bytes from an input port and store these bytes into memory, the CPU must read each value and store it into memory.
For very high-speed I/O devices thus may not be an effective approach to transfer one byte at a time. Such devices generally contain an interface to the CPU’s bus so it directly read and write memory.
This is known as direct memory access since the peripheral device accesses memory directly, without using the CPU as an intermediate device.
This often allows the I/O operation to proceed in parallel with other CPU operations, thus increasing the overall speed of the system.
Note, however, that the CPU and DMA device cannot both use the address data buses at the same time.
Therefore, concurrent processing only occurs if the CPU has a cache and is, executing code and accessing data found in the cache (so the bus is free).
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 will receive when it is addressed by a processor.
; Control: Used to activate peripheral devices and instruct it what to do. For
example, a magnetic tape unit may be instructed to rewind or to move forward
one record. These commands are specific to a 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 if the most recent I/O operation is
completed or any errors occurred.
; Read: Causes the I/O module to obtain an item of data from the peripheral and
place it in the internal buffer.
; 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.