Unit-5_Slides_COA_updated
Unit-5_Slides_COA_updated
Syllabus
Different types of I/O devices and I/O transfer schemes
Programmed Input/output
Interrupts
Direct Memory Access
Interface circuits
Standard I/O Interfaces
I/ O Processors
Different types of I/O devices
• Complexity of control
• Unit of transfer - Data may be transferred as a stream of bytes
for a terminal or in larger blocks for a disk
• Data representation (Encoding schemes)
• Error conditions (Devices respond to errors differently)
Issue Description Challenges Examples
Managing diverse, Requires device-specific
asynchronous devices drivers, scheduling, and Scheduling I/O in multi-
Complexity of Control
with varying data rates handling interrupt device environments
and buffer needs priority
Byte streams may be
Data is transferred as
inefficient for large data; Streaming for terminals;
Unit of Transfer streams (bytes) or blocks
block transfers require blocks for hard disks
depending on the device
proper buffering
Mismatched encoding
Data must be encoded
can cause data
Data Representation to be interpreted ASCII for text, JPEG for
corruption; different
(Encoding) correctly by both system images
devices require different
and I/O device
encoding schemes
Errors occur during
Need for error detection,
transmission or device Checksums, ECC in
correction, or retry; real-
Error Conditions operation, requiring storage, CRC in
time response needed in
robust handling networking
critical systems
mechanisms
• Each of these issues plays a critical role in designing reliable and efficient I/O systems.
Effective I/O management ensures that devices can communicate with the system
seamlessly, minimizing errors, optimizing performance.
I/O Module / Interface / Processor
Memory CPU
I/O
• Data Transfer between CPU and I/O devices may be handled in a
variety of modes.
• Some modes use the CPU as an intermediate path ,others transfer
the data directly to and from the memory unit.
• Data transfer to and from peripherals may be handled in one of three
possible modes.
• Programmed I/O
• Interrupt- Initiated I/O
• Direct Memory Access(DMA)
Programmed I/O
• Programmed I/O: It is one simplest form of I/O where CPU has to do
all the work.
• This technique transfer the data between the processor and the I/O module.
• 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 in the program. Usually, the
transfer is to and from a CPU register and peripheral.
• Transferring data under program control requires constant monitoring of the peripheral
by the CPU.
• Once a data transfer is initiated, the CPU is required to monitor the interface to see
when a transfer can again be made.
• It is up to the programmed instructions executed in the CPU to keep close tabs on
everything that is taking place in the interface unit and the I/O device.
Examples:
• Reading data from a keyboard or a mouse where the CPU continuously polls the device
for keypresses or mouse movements.
• Writing data to a printer where the CPU initiates the print operation, checks the printer
status, and transfers data in small chunks.
Advantages:
• Simple to implement
• Very Little hardware support
Disadvantages
• Busy waiting as CPU need to continuously monitor the I/O devices to check whether
I/O devices are ready for transfer or not.
• Programmed I/O can be inefficient, especially for high-speed devices or large data
transfers, as it keeps the CPU busy and may lead to a waste of processing time.
• The CPU is dedicated to managing the I/O operation, limiting its ability to perform other
tasks parallelly.
Interrupt –initiated I/O
Address and
command
Data
t0 t1 t2
Bus cycle
Master places the
device address and Addressed slave places
command on the bus, data on the data lines Master “strobes” the data
and indicates that on the data lines into its
it is a Read operation. input buffer, for a Read
operation.
➢At time to, the master places the device address on the address
lines & sends an appropriate command on the control lines.
➢In this case, the command will indicate an input operation &
specify the length of the operand to be read.
➢The clock pulse width t1 – t0 must be longer than the maximum
delay between devices connected to the bus.
➢The clock pulse width should be long to allow the devices to
decode the address & control signals so that the addressed
device can respond at time t1.
➢The slaves take no action or place any data on the bus before t1.
• Fig:A detailed timing diagram for the input transfer
T ime
Address & Bus clock
command Data reaches
Seen by
appear on the master tAM the master.
bus. Address and
command
Data
Address & tDM
command reach
Seen by slave
the slave. tAS
Address and Data appears
command on the bus.
Data
tDS
t0 t1 t
2
Multiple Cycle Transfer:-
➢During, clock cycle1, the master sends address & cmd
infn/. On the bus‟ requesting a „read‟ operation.
➢The slave receives this information & decodes it.
➢At the active edge of the clock (i.e.) the beginning of clock
cycel2, it makes accession to respond immediately.
➢The data become ready & are placed in the bus at clock
cycle3.
➢At the same times, the slave asserts a control signal called
„slave-ready‟.
➢The master which has been waiting for this signal, strobes,
the data to its i/p buffer at the end of clock cycle3.
➢The bus transfer operation is now complete & the master
sends a new address to start a new transfer in clock cycle4.
➢The „slave-ready‟ signal is an acknowledgement form the
slave to the master confirming that valid data has been
sent.
• Fig:An input transfer using multiple clock cycles
Asynchronous Bus:-
➢An alternate scheme for controlling data transfer on.
The bus is based on the use of „handshake‟ between
Master & the Slave. The common clock is replaced
by two timing control lines.
➢They are
✓Master–ready
✓Slave ready.
Fig:Handshake control of data transfer during an
input operation
➢The handshake protocol proceed as follows :
➢At t0 à The master places the address and command
information on the bus and all devices on the bus begin to
decode the information
➢At t1 à The master sets the Master ready line to 1 to inform the
I/O devices that the address and command information is ready.
➢The delay t1 – t0 is intended to allow for any skew that may
occurs on the bus.
➢The skew occurs when two signals simultaneously transmitted
from one source arrive at the destination at different time.
➢Thus to guarantee that the Master ready signal does not arrive
at any device a head of the address and command information
the delay t1 – t0 should be larger than the maximum possible
bus skew.
➢ At t2 à The selected slave having decoded the address and command information
performs the required i/p operation by placing the data from its data register on the
data lines. At the same time, it sets the “slave – Ready” signal to 1.
➢ At t3 à The slave ready signal arrives at the master indicating that the i/p data are
available on the bus.
➢ At t4 à The master removes the address and command information on the bus. The
delay between t3 and t4 is again intended to allow for bus skew. Errorneous
addressing may take place if the address, as seen by some device on the bus, starts to
change while the master – ready signal is still equal to 1.
➢ At t5 à When the device interface receives the 1 to 0 tranitions of the Master – ready
signal. It removes the data and the slave – ready signal from the bus. This completes
the i/p transfer.
➢ In this diagram, the master place the output data on the data lines and at the same
time it transmits the address and command information.
➢ The selected slave strobes the data to its o/p buffer when it receives the Master-ready
signal and it indicates this by setting the slave – ready signal to 1.
➢ At time t0 to t1 and from t3 to t4, the Master compensates for bus.
➢ A change of state is one signal is followed by a change is the other signal. Hence this
scheme is called as Full Handshake.
➢ It provides the higher degree of flexibility and reliability.
Interface circuits
• A mediator between the system.
• How communication media is connected to sender or how
communication media is connected to receiver is called interface
circuit.
• End Port Connectivity is called interface circuit.
Communication Media
Sender Receiver
Communication Media
• Fast Transmission.
• Only when all the systems are close to each other parallel port is possible
because many wires are used.
Keyboard Interface:
• A typical keyboard consists of mechanical switches that are normally open.
When a key is pressed, its switch closes and establishes a path for an
electrical signal.
• This signal is detected by an encoder circuit that generates the ASCII code for
the corresponding character.
• The output of the encoder consists of the bits that represents the encoded
character and one control signal called valid, which indicates that a key is
being pressed.
• This information is sent to the interface circuit, which contains a data
register DATAIN, and a status flag SIN.
• When a key is pressed, the valid signal changes from o to 1 causing the ASCII
code to be loaded into DATAIN and SIN to be set to 1.
• SIN is cleared to 0 when the processor reads the contents of the DATAIN register.
• Chip and Register Select: This block manages data routing and access, ensuring that
data is read from or written to the correct location. It includes address and control
signals (like R/W for read/write) to facilitate communication.
• Status and Control: This component monitors and controls the status of the data
transfer process. It includes the INTR (interrupt) line, which signals when data
transfer is complete or when the system is ready for new data.
• Clocks: Separate receiving and transmission clocks ensure synchronization for data
flow in and out.
• Key Functions of Interface Circuits
• Interface circuits are crucial because they manage several aspects of communication,
including:
1.Signal Conversion: They often need to convert signals to be compatible with different
devices. For instance, digital signals may need to be converted to analog or vice versa.
2.Voltage Level Shifting: Different devices may operate at different voltage levels, so
interface circuits adjust voltages accordingly to ensure compatibility and prevent
damage.
3.Data Synchronization: Interface circuits handle the timing and synchronization of
data transfer, as various devices can operate at different speeds.
4.Control and Status Signals: These circuits help in generating control signals required
for data transfer, and they often manage status signals that indicate the readiness of a
device to send or receive data.
5.Error Detection and Correction: Some interfaces include error-checking mechanisms
to ensure data integrity during transfer.
Also learn about
• Memory Interfaces, Bus Interfaces, Network Interfaces
Standard I/O Interface
• Used to connect I/O to the computer.
• The concept of DMA operation can be extended to relieve the CPU further
from getting involved with the execution of I/O operations.
• This gives rise to the development of special purpose processors called Input-
Output Processor (IOP) or IO channels.
• The Input-Output Processor (IOP) is just like a CPU that handles I/O
operations.
• The IOP can fetch and execute instructions that are specifically related to I/O
transfers.
• In addition to the I/O-related tasks, it can also perform other processing tasks
like arithmetic, logic, branching, and code translation.
• The main memory related to this, is communicated with processor via DMA.
• The Input-Output Processor is a specialized processor which loads and stores data in
memory along with the execution of I/O instructions.
• It acts as an interface between the system and devices. It involves a sequence of events
to execute I/O operations and then store the results in memory.
Differences Between CPU and IOP