0% found this document useful (0 votes)
39 views37 pages

Input-Ouput Interface

An I/O interface connects the CPU and memory to external devices, facilitating communication and ensuring compatibility. It manages data transfer, control operations, and error detection through components like control logic, data buffers, and address decoders. The document also discusses I/O commands, mapping techniques, and data transmission methods, highlighting the differences between isolated and memory-mapped I/O.

Uploaded by

Manoj Kumar Sain
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)
39 views37 pages

Input-Ouput Interface

An I/O interface connects the CPU and memory to external devices, facilitating communication and ensuring compatibility. It manages data transfer, control operations, and error detection through components like control logic, data buffers, and address decoders. The document also discusses I/O commands, mapping techniques, and data transmission methods, highlighting the differences between isolated and memory-mapped I/O.

Uploaded by

Manoj Kumar Sain
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/ 37

I/O Interface

An I/O interface is a hardware or software mechanism that connects the


CPU (Central Processing Unit) and memory to external peripheral devices,
such as keyboards, printers, monitors, hard drives, or network adapters. It
acts as a communication bridge that manages the transfer of data between
the computer's internal components and the outside world.

I/O I/O
CPU Interface Devices
A Method for transferring
information between internal
storage(memory and
registers) & external I/O
devices.
Purpose of an I/O Interface:

1.Facilitate Communication: Ensures that data and control signals are properly exchanged

between the CPU and peripherals.

2.Device Compatibility: Allows devices with different data formats, speeds, and electrical

characteristics to interact with the CPU.

3.Control Operations: Handles synchronization, error detection, and data buffering during

communication.
I/O Interface
I/O Interface Cont…
Key Functions of an I/O Interface:

1.Data Transfer:
1. Manages the movement of data between the CPU and peripherals.
2. Uses various techniques like programmed I/O, interrupt-driven I/O, or Direct Memory
Access (DMA).
2.Address Decoding:
1. Determines whether a specific command or data is meant for a particular I/O device by
decoding the address issued by the CPU.
3.Control Signals:
1. Sends control signals (like read/write) to initiate or terminate communication with a device.
4.Status Monitoring:
1. Tracks the readiness of devices (e.g., busy, idle, or error states) and informs the CPU.
5.Error Detection:
1. Identifies communication errors, such as parity errors or transmission issues, and handles
them appropriately.
Key Components of an
I/O Interface
OVERVIEW AND EXAMPLES
Control Logic
Manages data and control signals between the CPU and devices.
(Manages the communication between CPU and Peripheral Devices).
Interprets commands from CPU and generates appropriate control signal for peripheral.
Example:
Keyboard interface detects key presses and sends signals to the CPU.
Data Buffer
Temporarily stores data being transferred between the CPU and devices.
 Helps in handling difference in speed( CPU is much faster than I/O devices.
Example:
Printer interface stores characters before sending them to be printed.
Control and Status Register
Control Register holds commands from the CPU for the I/O device( start, Stop or Reset ).
Status register Indicates the current status of the I/O device (e.g., ready, busy, error).

Example:
Hard disk interface shows 'busy' while processing a read/write operation.
Example Scenario:

Consider the following interaction between the control register and the status register for a
hard disk interface:
1.The CPU writes a "start" command to the control register to initiate a read operation on
the hard disk.
2.The hard disk begins reading data, and the status register shows a "busy" flag, indicating
that the device is currently in use.
3.Once the read operation completes, the status register clears the "busy" flag and sets the
"ready" flag to indicate that the device is ready for the next operation.
4.If there’s an issue during the operation, such as a bad sector, the status register sets the
"error" flag to inform the CPU.
Address Decoder
Identifies whether a command or data is for a specific I/O device.
In other words, It identifies the I/O devices being accessed using the address
provided by the CPU.

Example:
USB interface responds to the address assigned by the CPU (e.g.,
0xFFFF0000).
Data Bus
Transports data between the CPU, memory, and peripherals.
Data lines in data bus connect the CPU to I/O device for transferring data.

Example:
Transfers file content from RAM to a hard disk.
Control Bus
Sends control signals to manage communication (e.g., read/write).

Example:
Signals USB devices to perform a write operation.
Buffering Mechanism
Temporarily stores data to resolve speed mismatches between devices.
This mechanism is essential for improving performance and efficiency in data
transfer, especially when the producer (sender) and the consumer (receiver) of
the data have different processing speeds.
Example:
Printing a Document
How Buffering Works:
 The computer (sender) sends the document to the printer buffer
(temporary storage).
 The buffer holds the data temporarily.
 The printer (receiver) reads the data from the buffer when it's ready to
print, without needing to wait for the entire document to be transferred at
once.
Interface Logic
Convert data between formats or protocol used by CPU and devices

Example: Parallel to serial conversion.


I/O Commands
OVERVIEW AND TYPES
What are I/O Commands?
I/O commands are instructions issued by the CPU to interact with
peripheral devices. These commands facilitate data transfer, device control,
and status monitoring.
Commands are
◦ Read Command
◦ Write Command
◦ Control Command
◦ Status Command
1. Read Command
Purpose: Retrieves data from an I/O device to the CPU or memory.

Process:
- The CPU sends a read command to the device.
- The device places data on the data bus.
- The CPU reads and processes the data.
Example:
- Reading a character from a keyboard.
- Fetching a file from a hard disk.
2. Write Command
Purpose: Sends data from the CPU or memory to an I/O device.

Process:
- The CPU sends a write command with data to the device.
- The device stores or processes the data.

Example:
- Sending a document to a printer.
- Writing data to a USB drive.
3. Control Command
Purpose: Configures or manages the operation of an I/O device.

Process:
- The CPU sends a control command specifying the operation.
- The device updates its configuration.

Example:
- Resetting a printer.
- Setting a network card to start data transmission.
4. Status Command
Purpose: Queries the current status of an I/O device.

Process:
- The CPU sends a status command to the device.
- The device returns its operational state (ready, busy, or error).

Example:
- Checking if a printer is ready to print.
- Verifying if a USB drive is ready to receive data.
Interface Unit Diagram
Selection of interface unit
I/O Mapping
OVERVIEW AND TYPES
Overview
When Computer use one common bus to transfer information between memory or I/O
device or CPU

There are 2 ways that computer programs communicate with I/O devices or 2 technique
for addressing the I/O device by the CPU.

1. Isolated I/O (Port Mapped I/O)


2. Memory Mapped I/O
Isolated I/O
1. Dedicated Control Lines:
1. Isolated I/O requires specific control lines to distinguish whether the operation is
directed at memory or an I/O device.
2. Examples of control signals include:
1.Memory Read (MEMR) and Memory Write (MEMW) for memory operations.
2.I/O Read (IOR) and I/O Write (IOW) for I/O device operations.
2. Purpose of Control Lines:
1. MEMR and MEMW signals ensure the CPU interacts with the memory subsystem.
2. IOR and IOW signals ensure the CPU interacts with I/O devices in the I/O address
space.
3. I/O Address Space:
1. Isolated I/O uses a separate address space distinct from the memory address space.
2. The CPU checks the control lines to determine whether the operation targets memory or
I/O.
CPU Memory I/O

Add
Data
MEMR
MEMW
IOR
IOW

# Special Instruction “IN” or “Out “ used for Input output


# MOV instruction used for Memory access.
Advantages of Isolated I/O
1.Separate Address Space:
1. I/O devices are mapped to a separate address space, preserving the entire memory
address space for program data and instructions.
2.Simplified I/O Control:
1. With distinct control lines (IOR, IOW), it becomes easier for the CPU to identify
whether the operation is for memory or an I/O device.
Disadvantages of Isolated I/O
1.Requires Special Instructions:
•The CPU needs dedicated I/O instructions like IN and OUT, increasing instruction
complexity and dependency.
2.Slower Access:
•Compared to Memory-Mapped I/O, isolated I/O may introduce overhead due to the use of
separate control lines and instructions.
3.Extra Control Lines:
•Additional hardware (like separate IOR and IOW lines) is required, which can increase
cost and complexity.
Memory-Mapped I/O Overview

•In Memory-Mapped I/O, both memory and I/O devices are assigned addresses in the
same address space. This means that the I/O devices are accessed using the same
instructions (such as LOAD and STORE) as memory.
•The CPU doesn't distinguish between memory and I/O devices when performing
operations; it uses memory control signals to read from or write to both memory and I/O
devices.
•Single set of read/write control lines for both I/O & memory .

Let's assume the address space is as follows:


•0x0000 – 0xFFFF: Memory addresses
•0x1000 – 0x1FFF: I/O devices
Example of Operation
Let's assume the address space is as follows:
•0x0000 – 0xFFFF: Memory addresses
•0x1000 – 0x1FFF: I/O devices
When the CPU wants to perform an operation:
1.Reading from Memory:
1. If the CPU accesses address 0x0030, it will perform a MEMR operation to read data from
memory.
2.Reading from an I/O Device:
1. If the CPU accesses address 0x1005, it will treat this as an I/O read operation, but it will
still use the MEMR control signal, and the data will come from the I/O device.
3.Writing to Memory:
1. When the CPU writes to 0x0040, a MEMW signal is generated, and the data is written to
memory.
4.Writing to an I/O Device:
1. When writing to 0x1020, the MEMW signal is generated, but the data is transferred to the
I/O device.
Advantages:
•Simplified Access: I/O devices are accessed using regular memory instructions, making
programming easier.
•Faster Data Transfer: More efficient than port-mapped I/O since it uses the same mechanism
as memory access.
•No Special Instructions Needed: Eliminates the need for complex I/O instructions.

Disadvantages:
•Consumes Address Space: Uses part of the system’s address space, reducing available
memory.
•Potential Conflicts: Address overlap between memory and I/O can cause issues.
•Security Risks: Direct access to I/O devices can be a security concern.
•Complex Hardware: Requires more complex hardware for mapping and access control.
Data Transfer
Transmission of data from one unit to another
1.Serial Transmission
1.1 Synchronous data transfer
1.2 asynchronous data transfer
2. Parallel Transmission (synchronous )
Feature Synchronous Data Transfer Asynchronous Data Transfer

Clock Two units share a common clock. Two units are independent, each with its
own private clock.
Data Synchronization Data transfer between sender and receiver Data transfer between sender and receiver is
is synchronized with the same clock not synchronized with the same clock pulse.
pulse.
Usage Used between devices that match in Used between devices that do not match in
speed. speed.
Bit Transmission Bits are transmitted continuously to keep Bits are sent only when available, and the
the clock frequency synchronized in both line remains idle when there is no data to
units. transmit.
Meaning Synchronous means at the same time (due Asynchronous means at regular intervals
to common clock). (due to no common clock).
Speed Fast. Slow.
Cost Costly Economical.
Thank you for your patience.

Any Question!!!!!!

You might also like