0% found this document useful (0 votes)
27 views42 pages

Input - Output Unit

The document provides a comprehensive overview of Input/Output (I/O) units in computer systems, detailing their functions, structures, and techniques for data transfer. It explains the role of I/O modules in interfacing with peripheral devices, the various methods of I/O operations such as programmed I/O, interrupt-driven I/O, and Direct Memory Access (DMA). Additionally, it discusses the importance of control signals, status signals, and error detection in ensuring efficient communication between the CPU and external devices.

Uploaded by

surafeltadese315
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views42 pages

Input - Output Unit

The document provides a comprehensive overview of Input/Output (I/O) units in computer systems, detailing their functions, structures, and techniques for data transfer. It explains the role of I/O modules in interfacing with peripheral devices, the various methods of I/O operations such as programmed I/O, interrupt-driven I/O, and Direct Memory Access (DMA). Additionally, it discusses the importance of control signals, status signals, and error detection in ensuring efficient communication between the CPU and external devices.

Uploaded by

surafeltadese315
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Input –Output Unit

1
Outline
• Introduction
• External devices
• Input/output modules
• I/O module function
• I/O module structure
• Input/output techniques
• Programmed I/O
• Interrupt driven I/O
• Direct memory access
• I/O channels and processors
• The External interface
2
Introduction
• I/O modules
• third key element of a computer system, next to processor and memory
• Interfaces to a system bus and controls one or more peripheral devices
• Contains logic/intelligence
• To perform communication function b/n the peripherals and the
bus

• Definition : Peripheral device/ Peripheral


• An external device connected to an I/O module

3
Introduction…
• Why peripheral devices not connected directly to the system bus ?
• Reasons
• Wide variety of peripherals with different method of operation
• It would be impractical to incorporate the necessary logic within the
processor , to control a range of devices
• Delivering different amounts of data
• The data transfer rate of peripherals is often much slower than that of
the memory or processor.
• At different speeds
• In different formats
• All slower than CPU and RAM
• Peripherals often use different data formats and word lengths than the
computer to which they are attached.
• Need I/O modules
4
Introduction…
• Input/output module has two functions:
• Interface to CPU and Memory –via system bus
• Interface to one or more peripherals- via (tailored) data links

• Generic model of I/O


module

5
Introduction…
• External devices
• Attaches to a computer by a link to an I/O module
• Used to accomplish I/O operations
• The link is used to exchange control, status, and data between the I/O
module and the external device.
• Provides a means of exchanging data between
• external environment
• Computer
• An external device connected to an I/O module is often referred to as a
peripheral device or,simply,a peripheral.

6
Introduction…
• External devices broadly classified into three categories:

• Human readable devices


• Suitable to communicate with the computer user
• E.g. Screen, printer, keyboard
• Machine readable devices
• Suitable for communicating with equipment
• E.g. magnetic disk and tape system
• And sensors and actuators, such as are used in a robotics application
• Communication devices
• Allow the computer to exchange data with a remote device
• E.g. Modem, Network Interface Card (NIC)
• It may be human readable devices 7
Introduction…
• External device block diagram

8
Introduction…

• The External Device : 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),
• Data: set of bits to be sent to or received from the I/O module
• Status signals: indicate the state of the device E.g. READY/NOT-
READY
• Control logic: controls the device’s operations in response to direction
from the I/O module
• Transducer: converts data from electrical to other forms and vice versa
• Buffer: temporarily holds data being transferred b/n I/O module and 9
external environment
Input/output Modules
 I/O module functions --- fall into the following categories
• Control & Timing
• Processor Communication
• Device Communication
• Data Buffering
• Error Detection

10
I/O module functions
1. control and timing:
 any period of time, the processor may communicate with one or more
external devices, 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 or ask 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 11
the transfer of data, by means of a command to the I/O module.
I/O module functions
4. The I/O module obtains a unit of data from the external device.
5. The data are transferred from the I/O module to the processor.
2. Processor communication
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.
This indicates that the I/O module must communicate with the processor
and with the external device
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
12
• The latter commands is sent on the data bus.
I/O module functions
 Data:
 Data are exchanged between the processor and the I/O module over
the data bus.
 Status reporting:
• 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. Common status signals are BUSY and READY.
Address recognition:
• 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.
3. device communication.
On the other side, the I/O module must be able to perform device
communication.
13
This communication involves commands, status information, and data.
I/O module functions
4. data buffering.
Data coming from main memory are sent to an I/O module in a rapid burst.
The data are buffered in the I/O module and then sent to the peripheral
device at its data rate
5. error detection
an I/O module is often responsible for error detection and for subsequently
reporting errors to the processor
One class consists of unintentional changes to the bit pattern as it is
transmitted from device to I/O module.

14
I/O Module Structure

15
I/O Module Structure…
• Module connects to the computer through a set of signal lines (e.g. system
bus)
• Data transferred to and from the module are buffered with data registers
• Status information provided through status registers – may also act as
control registers
• Module logic interacts with processor via a set of control signal lines
• Processor uses control signal lines to issue commands to the I/O module
• Module must recognize and generate addresses for devices associated with
the devices it controls

16
Input Output Techniques
• Three techniques exist for I/O operations:
• Programmed I/O
• Interrupt driven I/O
• Direct Memory Access (DMA)

17
Programmed I/O
Programmed I/O
• Data are exchanged between processor (CPU) and the I/O Module.
• CPU has direct control over the I/O device.
• Sensing the device status
• Sending a read or write command
• Transferring the data
• When the processor (CPU) issues a command to I/O module, it waits for
the I/O to complete its operation.
• If the processor is faster then the I/O module then this is wasteful of
processor time
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
18
• 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:
Programmed I/O
 Control: Used to activate a peripheral and tell it what to do
 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 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:
19
 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.
Input Output Techniques…
• Programmed I/O
• CPU requests I/O operation to appropriate I/O module
• I/O module performs the requested operation
• I/O module sets status bits in the I/O status register
• CPU checks status bits periodically
• I/O module does not inform/interrupt CPU directly

• CPU waits for I/O module to complete operation


• Wastes CPU time

20
Input Output Techniques…
• Interrupt Driven I/O
 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
• Overcomes CPU waiting
• No repeated CPU checking of device
• I/O module interrupts when ready
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

21
Input Output Techniques…
• Interrupt Driven I/O …
Basic Operation (for input)
• CPU issues read command
• I/O module gets data from peripheral whilst CPU does other work
• I/O module interrupts CPU
• CPU requests data
• I/O module transfers data

22
Input Output Techniques…
• Interrupt Driven I/O…
• CPU Viewpoint (for input)
• The processor issues a READ command.
• It then goes off and does something else ,Do other work
• Processor Check for interrupt at end of each instruction cycle
• If interrupted:-
• Save context (program counter and processor registers) of current
program
• Then processor Process the interrupt
• In this case, the processor reads the word of data from the I/O module and
stores it in memory
• It then restores the context of the program it was working on and resumes
execution.
23
Input Output Techniques…
• Interrupt Driven I/O…

• I/O module viewpoint (for input)


• I/O module receives read command from the CPU
• I/O module reads data from associated peripheral
• I/O module puts the data in its data registers
• The module signals an interrupt over control line
• The module then waits until its data are requested by the processor
• When the request is made, The module places the data on the data bus
• The module is ready for another I/O operation

24
Input Output Techniques…
• Interrupt Driven I/O…

• Design Issues
• How does the processor determine which device issued the interrupt?
• And if multiple interrupts have occurred, how does the processor decide
which one to process?

25
Input Output Techniques…
• Identifying Interrupting Module
• Four techniques are common:
• Multiple interrupt lines
• Software poll
• Daisy chain (hardware poll)
• Bus arbitration

26
Input Output Techniques…
• Identifying Interrupting Module …
• Multiple interrupt lines
• Different interrupt line for each module
• Impractical due to no of pins required on the CPU
• Limits number of devices
• Software poll
• poll each I/O module to determine which module caused the interrupt.
• poll could be in the form of a separate command line (e.g. TESTI/O).
• places the address of a particular I/O module on the address lines
• each I/O module could contain an addressable status register.
• The processor then reads the status register of each I/O module
• to identify the interrupting module.
• Once the correct module is identified, 27
• the processor branches to a device-service routine specific to that device.
• It is Slow i.e. it is time consuming
Input Output Techniques…
• Identifying Interrupting Module ...
• Daisy Chain /Hardware poll
• For interrupts , All modules share a common interrupt request line
• When the processor senses an interrupt, it sends out an interrupt acknowledge
• Interrupt acknowledge line is daisy chained through modules
• This signal propagates through a series of I/O modules until it gets to a
requesting module.
• The requesting module typically responds by placing a word on the data lines
• Module responsible places (data) on bus
• Bus Master(arbitration.)
• an I/O module must first gain control of the bus before it can raise the
interrupt request line.
• only one module can raise the line at a time.
• When the processor detects the interrupt, it responds on the interrupt
acknowledge line. 28
• The requesting module then places its Data on the data lines.
Input Output Techniques…
• Multiple Interrupts
• With multiple lines
• Each interrupt line has a priority
• CPU picks the interrupt line with high priority
• With software polling
• The order of polling modules determines their priority
• With daisy chaining
• The order of modules on the daisy chain determines their
priority
• With Bus arbitration
• Only current master can interrupt, current master selection …

29
Input Output Techniques…
• Direct Memory Access
• Interrupt driven I/O efficient than programmed I/O
• But both, interrupt driven and programmed I/O, require active CPU
intervention
• Any data transfer transverse a path through the processor

• Both forms of I/O suffer from two inherent drawbacks


• I/O transfer rate is limited by speed of the processor to test and service
a device
• CPU is tied up in managing an I/O transfer
• A no of instructions must be executed for each I/O transfer

• DMA is the solution, more efficient technique


• To move large blocks of data 30
Input Output Techniques…
• DMA Function
• DMA involves an additional module on the system bus --- DMA
module
• The DMA module is capable of mimicking/seems 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

31
Typical DMA Module Diagram

32
DMA Operation
• When the processor wants to read/write a block of data.
• CPU tells DMA controller:-
• Whether Read/Write is requested
• the address of the I/O device involved
• Communicated over data bus
• Starting location in memory to read from or write to
• Communicated over data lines and stored by the DMA in its data register
• Amount of data to be transferred
• Communicated via data lines and stored in the data count register

• Then …

33
DMA Operation
 The processor then continues with other work. It has delegated this I/O
operation to the DMA module.
 The DMA module transfers the entire block of data,
 One word at a time, directly to or from memory,
 without going through the processor.
 When the transfer is complete,
 the DMA module sends an interrupt signal to the processor.
 Thus, the processor is involved only at
 the beginning and
 end of the transfer

34
DMA Transfer
Cycle Stealing
• DMA controller takes over bus for a cycle
• Transfer one word of data
• Not an interrupt
• CPU does not switch context
• CPU suspended just before it accesses bus
• i.e. before an operand or data fetch or a data write
• Slows down CPU but not as much as CPU doing transfer

35
DMA and Interrupt Breakpoints During an
Instruction Cycle

36
Definition:
• I/O channel or I/O processor
• An I/O module that takes on most of the processing burden,
presenting a high-level interface to the processor

• I/O controller or device controller


• An I/O module that is quite primitive and requires detailed
control

37
I/O Channels
• The Evolution of the I/O Function
• Processor directly controls peripheral device
• A controller or I/O module is added
• Processor uses programmed I/O, it becomes divorced from the specific details
of external device interface.
• Same as above – interrupts added
• Increases efficiency
• I/O module given direct access to memory using DMA
• Block of data can be moved to/from memory without involving the CPU,
except at beginning and end
• I/O module enhanced to become processor like – I/O channel
• The processor directs the I/O channel to execute an I/O program in memory
• The I/O channel fetches and executes I/O instructions without the CPU
involvement
• I/O module has local memory of its own – computer like – I/O processor 38
I/O Channels...
• Two type of I/O channels
• Selector channel
• Controls multiple high-speed devices
• Dedicated to the transfer of data with one of the devices, at any one
time
• Each device handled by a controller, or I/O module
• I/O channel controls these I/O controllers

• Multiplexor channel
• Can handle I/O with multiple devices at the same time
• Byte multiplexor
• used for low-speed devices
• Accepts or transmits characters as fast as possible to multiple devices
• Block multiplexor 39
• Used for high speed devices
• interleaves blocks of data from several devices.
External Interface…
• The interface to a peripheral from an I/O module
• Major characteristic of the interface is whether it is serial or
parallel
• Parallel interface – multiple bits transferred simultaneously
• Serial interface – bits transferred one at a time

40
External Interface…
• The I/O module must engage in a dialogue with the peripheral.
• In general terms, the dialogue for a write operation is as
follows:
• I/O module sends control signal – requesting permission to send
data
• Peripheral acknowledges the request
• I/O module transfers data
• The peripheral acknowledges receipt of the data

41
The Course is Over
Thank You!!!

42

You might also like