Chapter 7
Input/Output
Input/Output Module
Interface to CPU and Memory
Interface to one or more peripherals
Input/output Module
External devices are not generally
connected directly into the bus structure of
the computer.
I/O module is an interface for the
external devices (peripherals) to CPU and
Memory.
General Structure of I/O Module
(Internal)
Figure: General model of Internal I/O module
External Devices
Human readable
- Screen, printer, keyboard
Machine readable
- Monitoring and control
Communication
- Modem
- Network Interface Card (NIC)
I/O Module Function
Control & Timing
CPU Communication
Device Communication
Data Buffering
Error Detection
I/O Steps
CPU checks I/O module device status
I/O module returns status
If ready, CPU requests data transfer
I/O module gets data from device
I/O module transfers data to CPU
System Bus
A system bus is a single computer bus that
connects the major components of a computer
system. It combines the functions of a data bus
to carry information, an address bus to determine
where it should be sent, and a control bus to
determine its operation.
Peripheral Devices
A computer peripheral is a device that is
connected to a computer but is not part of the
core computer architecture. Peripheral devices
can be external or internal. For example: Mouse,
Keyboard, Monitor, Printer, Hard-Disk etc..
External Device Interface
It is divided into Control module, Status signal &
Data module.
Control signal decide which function will execute
by device. For example:
READ, WRITE operations.
Status signals indicates the state (READY,
NOT-READY) of the device.
Data module controls set of data bits need
sending & receiving.
Control logic perform device operation control
by getting command from I/O.
Input/output Techniques
There are Three principle I/O techniques.
They are …
o Programmed I/O.
o Interrupt Driven I/O.
o DMA (Direct Memory Access) technique.
Programmed I/O
CPU controls I/O directly by doing following
three things ……
Sending Status.
I/O commands.
Transferring data.
CPU waits for I/O module to complete
operation.
CPU time wastes.
I/O Commands
Control: Control command is used to active a
peripheral and tell it what to do.
Test: This command is used to test various
status conditions associated with an I/O module
and its peripherals.
Read: It is used to obtain an item of data to
peripheral and place it in an internal buffer.
Write: to take an item of data (byte or word)
from the data bus and subsequently transmit that
data item to the peripheral.
Interrupt Driven I/O
•A better
protocol is to have the computer and IO
device work independently.
• I/O module interrupts when ready.
•When the current instruction completes, the
computer interrupts the current program, saves
the current state and goes to an interrupt service
routine.
How Interrupt Driven I/O
Works
CPU issues read command.
I/O
module gets data from peripheral whilst
CPU does other works.
I/O module interrupts CPU.
CPU requests for data.
I/O module transfers data.
DMA (Direct Memory Access)
Direct memory access (DMA) is a feature of
computer systems that allows certain hardware
subsystems to access main system (RAM)
memory independently of the central processing
unit (CPU).
Without DMA, when the CPU is using
programmed I/O, it is fully busy for Read or Write
operation and unavailable to perform other work.
With DMA, the CPU first begins the transfer,
then it does other operations while the transfer is
in progress.
I/O Bus &
Interface Module
I/O
Data
Bus
Processor Addres
s
Control
Interfac Interfac Interfac Interfac
e e e e
Keyboar
d & Magneti Magneti
Printe
Display c Disk c
r
Terminal Tape
Fig. Connection of I/O Bus to input-output
devices
IO Commands
There are four types of I/O Command:
Control Command
Status Command
Output Data Command
Input Data Command
I/O Versus Memory
Bus
Like I/O Bus, Memory Bus also contains Data,
Address & Control Lines.
Three ways to communicate:
Use two separate buses
Use one common bus but separate control lines
Use common bus with common control lines
Input/Output Processor
An input-output processor (IOP) is a processor with
direct memory access capability. In this, the
computer system is divided into a memory unit and
number of processors.
Each IOP controls and manage the input-output
tasks. The IOP is similar to CPU except that it
handles only the details of I/O processing. The IOP
can fetch and execute its own instructions. These
IOP instructions are designed to manage I/O
transfers only.
Block Diagram Of I/O Processor
Below is a block diagram of a computer along with
various I/O Processors. The memory unit occupies
the central position and can communicate with each
processor.
The CPU processes the data required for solving the
computational tasks. The IOP provides a path for
transfer of data between peripherals and memory.
The CPU assigns the task of initiating the I/O
program.
The IOP operates independent from CPU and
transfer data between peripherals and memory.
The communication between the IOP and the
devices is similar to the program control method of
transfer. And the communication with the memory
is similar to the direct memory access method.
In large scale computers, each processor is
independent of other processors and any
processor can initiate the operation.
The CPU can act as master and the IOP act as
slave processor. The CPU assigns the task of
initiating operations but it is the IOP, who executes
the instructions, and not the CPU. CPU
instructions provide operations to start an I/O
transfer. The IOP asks for CPU through interrupt.
Instructions that are read from memory by an IOP
are also called commands to distinguish them from
instructions that are read by CPU. Commands are
prepared by programmers and are stored in memory.
Command words make the program for IOP. CPU
informs the IOP where to find the commands in
memory.
I/O Problems
Slower than CPU & RAM.
Need I/O modules.
For variety of peripherals it may show different
amount of data, speeds & formats.
Whole system must have to be efficient to
receive input & show output.