04 - 01 Input-Output Organization
04 - 01 Input-Output Organization
Organization
Topics to be Covered
Peripheral Devices
Input-Output Interface
Asynchronous Data Transfer
Modes of Transfer
Priority Interrupt
Direct Memory Access (DMA)
Peripheral Devices
Devices that are under the direct control of the computer are
said to be connected on-line.
Input or output devices attached to the computer are also
called peripherals.
Peripherals are electromechanical and electromagnetic devices
Each interface:
- Decodes the address and control received from the I/O bus
- Interprets them for the peripheral
- Provides signals for the peripheral controller
- Synchronizes the data flow
- Supervises the transfer between peripheral and processor
Each peripheral has its own controller, operates that particular
electromechanical device.
There are four types of commands that an interface may
receive:
- Control: Activates the peripheral and to inform it what to
do.
- Status: Test various status conditions in the interface and
the peripheral.
- Data Output: Causes the interface to respond by
transferring data from the bus into one of its buffer registers.
- Data Input: Causes the interface to respond by transferring
data from one of its registers into the bus.
I/O versus Memory Bus
The processor along with I/O communication, also
communicates with the memory unit.
The memory bus also contains data, address, and read/write
control lines.
There are three ways that computer buses can be used to
communicate with memory and I/O:
1. Use two separate buses, one for memory and the other for
I/O.
2. Use one common bus for both memory and I/O but have
separate control lines for each.
3. Use one common bus for memory and I/O with common
control lines.
The computer has independent sets of data, address, and
control buses, one for accessing memory and the other for I/O,
with a separate I/O processor (IOP) along with CPU.
The memory communicates with both the CPU and the IOP
through a memory bus.
The IOP communicates also with the input and output devices
through a separate I/O bus with its own address, data and
control lines.
The purpose of the IOP is to provide an independent pathway
for the transfer of information between external devices and
internal memory.
Isolated versus Memory-Mapped I/O
Many computers use one common bus to transfer information
between memory or I/O and the CPU.
The I/O read and I/O write control lines are enabled during an
I/O transfer.
The memory read and memory write control lines are enabled
during a memory transfer.
The other alternative is to use the same address space for both
memory and I/O, referred to as memory-mapped I/O
Here, the computers:
- Employ only one set of read and write signals
- Do not distinguish between memory and I/O addresses
- Treats an interface register as being part of the memory
system.
- Addresses assigned for interface registers cannot be used for
memory words, reducing the memory address range
Asynchronous Data Transfer
In the interface, if the registers share a common clock with the
CPU registers, the transfer between the two units is said to be
synchronous.
But, in most cases, the internal timing in each unit is
independent as it uses its own private clock for internal
registers.
Hence, the two units are said to be asynchronous to each other.
In asynchronous data transfer, the control signals have to be
transmitted between two independent units to indicate the time
data transmission. There are two methods:
- Strobe Control
- Handshaking
Strobe Control
The strobe control method employs a single control line to
time each transfer.
The strobe may be activated by either the source or the
destination unit. Hence, there are:
- Source-initiated data transfer / strobe
- Destination-initiated data transfer / strobe
Handshaking
The disadvantages of the strobe method:
- The source unit that initiates the transfer has no way of
knowing whether the destination unit has actually received
the data item, placed in the bus.
- The destination unit that initiates the transfer has no way of
knowing whether the source unit has actually placed the
data on the bus.
These problems can be solved using the handshake method,
using a second control signal that provides a reply to the unit
that initiates the transfer.
Asynchronous Serial Transfer
The transfer of data between two units, may be:
- Parallel
- Serial
The CPU can read the status register at any time to check for
the occurrence of any errors.
There are three possible errors:
- Parity error: Occurs if the number of l's in the received data
is not the correct parity.
- Framing error: Occurs if the right number of stop bits is not
detected at the end of the received character.
- Overrun error: Occurs if the CPU does not read the
character from the receiver register before the next one
becomes available in the shift register.
If the source unit is slower than the destination unit, the buffer
can be filled with data at a slow rate and later emptied at the
higher rate.
If the source is faster than the destination, the FIFO buffer fills
out the source data arriving in bursts.
But the time between bursts is long enough for the destination
unit to empty some or all the information from the buffer.
It consists:
- Four 4-bit registers RI, I = 1, 2, 3, 4, i.e., for four words
- A control register with flip-flops Fi, i = 1, 2, 3, 4, one for
each register.
The number of bits per word can be increased by increasing
the number of bits in each register.
The number of words can be increased by increasing the
number of registers.
In Programmed I/O:
- Operations are the result of I/O instructions written in the
computer program.
- Each data item transfer is initiated by an instruction.
- The transfer is to and from a CPU register and peripheral.
- Other instructions are needed to transfer the data to and
from CPU and memory.
- Transferring of data requires constant monitoring of the
peripheral by the CPU, thereby wasting the time.
In Interrupt-initiated I/O:
- The interface keeps monitoring the device and generates an
interrupt request to the CPU, as soon as the device is ready
for data transfer.
- Upon detecting the external interrupt signal:
The CPU momentarily stops the task it is processing
Branches to a service program to process the I/O transfer
Returns to the task it was originally performing
In Direct Memory Access (DMA):
- The CPU
Initiates the transfer by supplying the interface with the
starting address
The number of words needed to be transferred
Then proceeds to execute other tasks
The interface transfers data into and out of the memory unit
through the memory bus using DMA.
Example of Programmed I/O
Interrupt-Initiated I/O
Instead of the CPU constantly monitoring the flag, the
interface inform the computer when it is ready to transfer data,
using an interrupt.
Now, the CPU deviates from what it is doing to take care of
the input or output transfer.
After the transfer is completed, the CPU resumes the task it
was doing before the interrupt.
Each device has its own service program and can be reached
through a jump (JMP) instruction at the assigned vector
address
The symbolic name of each routine represents the starting
address of the service program.
The stack is used for storing the return address after each
interrupt.
Initial and Final Operations
Each ISR must have an initial and final set of operations for
controlling the registers in the hardware interrupt system.