0% found this document useful (0 votes)
22 views

Chapter 13 Input Output

Input Output

Uploaded by

DANIAL IRFAN
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)
22 views

Chapter 13 Input Output

Input Output

Uploaded by

DANIAL IRFAN
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
You are on page 1/ 46

Chapter 13

Input/Output (I/O)
Architecture
Outline
• Introduction
• External Devices
• I/O Module
• I/O Functions
• I/O Techniques
• I/O Channel
• External Interface
A Model I/O Configuration
External Devices
• Human readable
– Screen, printer, keyboard
• Machine readable
– Monitoring and control
• Communication
– Modem
– Network Interface Card (NIC)
Input/Output Problems
• Wide variety of devices
– Delivering different amounts of data
– At different speeds
– In different formats
• All slower than CPU and RAM
• Need I/O modules
I/O Module
• Interface to CPU and Memory
• Interface to one or more peripherals
External Device Block Diagram
Function of I/O modules
1) Control and Timing.
2) CPU Communicating.
3) Device Communication.
4) Data Buffering.
5) Error Detection.
1) Control and Timing
① CPU asks I/O module to check the
status of attached device.
② I/O module tells the status.
③ CPU requests for data transfer to I/O
module if device is ready.
④ I/O module gathers the data and
transfers to the CPU.

Chapter 12 — I/O Topics — 57


2) CPU Communication
① Command Decoding : Like read/write
seek etc.
② Data - Exchange between CPU and
Module.
③ Status reporting - to CPU, since
peripherals are slow.
④ Address recognition for the devices
connected to it.
3) Device Communication : This
may involves command, status
information and data transfer.

4) Data Buffering : Essential


function to overcome speed mismatch.

5) Error Detection : Like paper jam,


bad data etc.
Block Diagram of an I/O Module
I/O Module Decisions
• Hide or reveal device properties to CPU
• Support multiple or single device
• Control device functions or leave for CPU
• Also Operating System decisions
– e.g. Unix treats everything it can as a file
Input Output Techniques
• Programmed
• Interrupt driven
• Direct Memory Access (DMA)
Programmed I/O
• CPU has direct control over I/O
– Sensing status
– Read/write commands
– Transferring data
• CPU waits for I/O module to complete
operation
• Wastes CPU time
Programmed I/O - detail
1) CPU requests I/O operation
2) I/O module performs operation
3) I/O module sets status bits
4) CPU checks status bits periodically
5) I/O module does not inform CPU
directly
6) I/O module does not interrupt CPU
7) CPU may wait or come back later
Programmed I/O
I/O Commands
• CPU issues address
– Identifies module (& device if >1 per module)
• CPU issues command
– Control - telling module what to do
• e.g. spin up disk
– Test - check status
• e.g. power? Error?
– Read/Write
• Module transfers data via buffer from/to device
Programmed I/O
Addressing I/O Devices
• Under programmed I/O data transfer is very
like memory access (CPU viewpoint)
• Each device given unique identifier
• CPU commands contain identifier (address)
Programmed I/O
I/O Mapping
• Memory mapped I/O
– Devices and memory share an address space
– I/O looks just like memory read/write
– No special commands for I/O
• Large selection of memory access commands available
• Isolated I/O
– Separate address spaces
– Need I/O or memory select lines
– Special commands for I/O
• Limited set
Interrupt Driven I/O
• Overcomes CPU waiting
• No repeated CPU checking of device
• I/O module interrupts when ready
Interrupt Driven I/O
Basic Operation
• 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
Programmed vs. Interrupt I/O
• Interrupt I/O is more efficient than
programmed I/O because it eliminates
needless waiting.
• However, interrupt I/O still consumes a lot of
processor time,
– every word of data that goes from memory to I/O
module or from I/O module to memory must pass
through the processor
Simple Interrupt
Processing

PSW - program status word


PC – Program counter
Interrupt Driven I/O
CPU Viewpoint
• Issue read command
• Do other work
• Check for interrupt at end of each instruction
cycle
• If interrupted:-
– Save context (registers)
– Process interrupt
• Fetch data & store
Programmed & Interrupt Driven I/O
Drawbacks
• I/O transfer rate is limited by the speed with
which the processor can test and service a
device.
• Processor is tied up in managing an I/O
transfer
– a number of instructions must be executed for
each I/O transfer
Direct Memory Access
• Interrupt driven and programmed I/O require
active CPU intervention
– Transfer rate is limited
– CPU is tied up
• DMA is the answer
Direct Memory Access
• I/O module and main memory exchange data
directly, without processor involvement
DMA Function
• Additional Module (hardware) on bus
• DMA controller takes over from CPU for I/O
Typical DMA Module Diagram
DMA Module
• Capable of mimicking the processor
– take over control of the system from the processor
• Transfer data to and from memory over the
system bus.
DMA Operation
• CPU tells DMA controller
– Read/Write
– Device address
– Starting address of memory block for data
– Amount of data to be transferred
• CPU carries on with other work
• DMA controller deals with transfer
• DMA controller sends interrupt when finished
DMA Transfer Cycle Stealing
• DMA controller takes over bus for a cycle
• Transfer of 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
DMA Configurations

System bus

Single-bus, detached DMA


DMA Configurations

System bus

Single-bus, integrated DMA-I/O


DMA Configurations

I/O bus
Evolution of the I/O Function
1. CPU directly controls a peripheral device. This
is seen in simple microprocessor-controlled
devices
2. Use controller or I/O module
3. Implement interrupts
– CPU need not spend time waiting for an I/O
operation to be performed, thus increasing
efficiency
Evolution of the I/O Function
4. I/O module is given direct access to memory
via DMA.
– can move a block of data to or from memory
without involving the CPU, except at the beginning
and end of the transfer
Evolution of the I/O Function
5. I/O module is enhanced to become a
processor in its own right
– specialized instruction set tailored for I/O
6. I/O module has a local memory of its own
– a large set of I/O devices can be controlled, with
minimal CPU involvement
External Interface
• Interface to a peripheral from an I/O module
must be tailored to the nature and operation
of the peripheral
• Two types
– parallel interface
– serial interface
Parallel Interface
• Multiple lines connecting the I/O module and
the peripheral,
• Multiple bits are transferred simultaneously,
just as all of the bits of a word are transferred
simultaneously over the data bus.
• Use for higher-speed peripherals, such as tape
and disk
Parallel I/O
Serial Interface
• Only one line used to transmit data
• Bits must be transmitted one at a time
• Use for printers and terminals
• With a new generation of high-speed serial
interfaces, parallel interfaces are becoming
much less common
Serial I/O
Parallel & Serial Interface on a PC
Review Questions
1. List three broad classifications of external, or
peripheral, devices.
2. What are the major functions of an I/O
module?
3. List and briefly define three techniques for
performing I/O
4. Explain how programmed I/O is different from
interrupt-driven I/O.
5. How does direct memory access (DMA) work?

You might also like