⚑ Input-Output Organization

Master the Art of Computer I/O Systems

πŸ”Œ Input-Output Interface

What is I/O Interface?

The I/O interface provides a method for transferring information between internal storage (memory/CPU) and external I/O devices. It resolves the differences between the computer and peripheral devices.

πŸ’‘ Key Concept: I/O interface acts as a bridge between the CPU and peripheral devices, handling timing, data format, and control signal differences.

Functions of I/O Interface

1. Data Buffer πŸ“¦
Temporarily stores data being transferred between the CPU and peripherals to compensate for speed differences.
2. Error Detection πŸ”
Detects and reports errors during data transmission using parity bits, checksums, or CRC.
3. Signal Conversion πŸ”„
Converts signals between digital (CPU) and analog (some peripherals) formats when necessary.
4. Control & Timing ⏱️
Coordinates timing and control signals between CPU and peripherals with different operating speeds.

I/O Interface Architecture

CPU
β†’
I/O Interface
β†’
Peripheral

Data flows through the interface which handles all communication complexities

Components of I/O Interface

πŸ”„ Asynchronous Data Transfer

Understanding Asynchronous Transfer

Asynchronous data transfer allows two independent units to communicate without using a common clock. Each unit operates at its own speed, and synchronization is achieved through control signals.

Methods of Asynchronous Transfer

1. Strobe Control

Uses a single control line (strobe signal) to indicate when data is valid.

Simple
One-way
Fast

Types:

  • Source-Initiated: Source sends data and activates strobe
  • Destination-Initiated: Destination requests data using strobe

2. Handshaking

Uses two control signals for reliable bidirectional communication between devices.

Reliable
Two-way
Flexible

Handshaking Sequence

Step 1: Source places data on data bus

Step 2: Source activates Data Valid signal

Step 3: Destination reads data

Step 4: Destination activates Data Accepted signal

Step 5: Source removes data and deactivates Data Valid

Step 6: Destination deactivates Data Accepted

Feature Strobe Control Handshaking
Control Lines 1 2
Reliability Moderate High
Speed Faster Slower
Acknowledgment No Yes
πŸ’‘ Why Asynchronous? Asynchronous transfer is essential when devices operate at different speeds or when timing cannot be precisely synchronized across the system.

πŸš€ Modes of Data Transfer

1. Programmed I/O

The CPU is totally responsible for data transfer. It continuously checks the status of the I/O device.

Characteristics:

  • CPU monitors device status continuously (polling)
  • CPU transfers each data item
  • Simple to implement but inefficient
  • CPU time is wasted waiting for devices

Programmed I/O Flow

CPU
β†’
Check Status
β†’
Transfer Data
β†’
Repeat

2. Interrupt-Initiated I/O

The device notifies the CPU when it's ready via an interrupt signal. The CPU can perform other tasks until interrupted.

Characteristics:

  • No need for continuous polling
  • CPU can execute other programs
  • More efficient than programmed I/O
  • Requires interrupt handling mechanism
Efficient
Event-Driven
Multitasking

3. Direct Memory Access (DMA)

Transfers large blocks of data directly between memory and I/O device without CPU intervention.

Characteristics:

  • Fastest data transfer method
  • DMA controller manages the transfer
  • CPU is free to perform other tasks
  • Ideal for bulk data transfers
High Speed
Block Transfer
CPU Independent
Mode CPU Involvement Speed Best For
Programmed I/O High (100%) Slow Simple devices, small data
Interrupt I/O Medium Moderate Interactive devices
DMA Low (minimal) Fast Bulk data transfer

⚑ Priority Interrupt

What is Priority Interrupt?

A priority interrupt system handles multiple interrupt requests by assigning priorities to different devices. When multiple interrupts occur simultaneously, the system serves the highest priority request first.

πŸ’‘ Key Concept: Priority systems ensure critical devices get immediate attention while less critical devices wait their turn.

Priority Interrupt Methods

1. Polling (Software)

CPU checks each device in sequence according to priority order.

  • Simple to implement
  • Flexible priority assignment
  • Slower response time
  • CPU cycles wasted in checking

2. Daisy Chain (Hardware)

Devices are connected in series. Interrupt acknowledge signal passes through devices in priority order.

  • Fast response
  • Minimal hardware cost
  • Fixed priority based on position
  • Single interrupt line

Daisy Chain Configuration

CPU
β†’
Device 1 (Highest)
β†’
Device 2
β†’
Device 3

3. Parallel Priority (Hardware)

Each device has its own interrupt line. Priority logic determines which request to serve.

  • Fastest method
  • Individual interrupt lines
  • Complex hardware
  • Most flexible priority control
Fastest
Most Expensive

Interrupt Service Routine (ISR)

Steps in Interrupt Handling πŸ”§
  1. Save current program state (PC, registers)
  2. Identify interrupt source
  3. Jump to appropriate ISR
  4. Execute ISR (handle the interrupt)
  5. Restore program state
  6. Return to interrupted program
⚠️ Important: Nested interrupts occur when a higher priority interrupt interrupts the ISR of a lower priority interrupt.

πŸ’Ύ Direct Memory Access (DMA)

What is DMA?

DMA is a method that allows I/O devices to transfer data directly to/from memory without CPU intervention. A DMA controller manages the entire transfer process.

DMA Transfer Architecture

I/O Device
↔
DMA Controller
↔
Memory

CPU only initializes the transfer; DMA handles the rest

DMA Controller Registers

  • Address Register: Holds memory address for transfer
  • Word Count Register: Number of words to transfer
  • Control Register: Mode of transfer (read/write)
  • Status Register: Indicates transfer status

DMA Transfer Modes

1. Burst Mode (Block Transfer)

DMA controller takes over system bus and transfers entire block of data in one burst.

  • Fastest transfer method
  • CPU is halted during transfer
  • Ideal for high-speed devices
Fastest
CPU Blocked

2. Cycle Stealing Mode

DMA controller transfers one word at a time, stealing a bus cycle when needed.

  • CPU can continue execution
  • Slightly slower than burst mode
  • Minimal CPU disruption
Balanced
CPU Friendly

3. Transparent Mode

DMA transfers only when CPU is not using the bus.

  • No CPU cycle stealing
  • Slowest DMA mode
  • Zero impact on CPU
Slowest
Zero CPU Impact

DMA Transfer Steps

Click to see DMA process flow πŸ“‹
  1. Initialization: CPU programs DMA controller with address, count, and control
  2. Request: I/O device requests DMA transfer
  3. Grant: DMA controller requests bus from CPU
  4. Transfer: DMA manages data transfer directly
  5. Complete: DMA sends interrupt to CPU when done
πŸ’‘ Advantage: DMA frees the CPU to perform other tasks, resulting in significant performance improvement for bulk data transfers.

πŸ–₯️ Input-Output Processor (IOP)

What is an IOP?

An Input-Output Processor (IOP) is a specialized processor designed to handle all I/O operations independently. It has its own instruction set and can execute complex I/O programs.

πŸ’‘ Evolution: IOP represents the highest level of I/O sophistication: Programmed I/O β†’ Interrupt I/O β†’ DMA β†’ IOP

IOP vs CPU

Aspect CPU IOP
Primary Function General computation I/O operations only
Instructions General purpose I/O specific
Memory Access Full access Shared with CPU
Operation Independent Receives commands from CPU

Types of IOP

1. Channel

A simplified IOP that can execute limited I/O programs stored in memory.

  • Operates using channel programs
  • Manages multiple devices
  • Common in mainframe computers

2. I/O Module

More sophisticated processor with its own local memory and instruction set.

  • Can execute complex I/O tasks
  • Has private memory for I/O tables
  • Reduces CPU workload significantly

CPU-IOP Communication

Communication Flow

CPU
β†’
Memory
β†’
IOP
β†’
I/O Devices

Communication Methods

1. Memory-Mapped Communication

  • CPU and IOP communicate through shared memory
  • CPU writes commands to memory locations
  • IOP reads commands and writes status back
  • Mailbox system for message passing

2. Interrupt Communication

  • IOP interrupts CPU when task completes
  • CPU can interrupt IOP with new commands
  • Enables asynchronous operation

IOP Instruction Format

Typical IOP Instructions πŸ“
  • Read/Write: Transfer data between device and memory
  • Sense: Check device status
  • Jump: Branch based on conditions
  • Control: Send control signals to devices
  • Transfer in Channel: Move data within channel
⚑ Performance Boost: IOPs can handle complex I/O operations including data formatting, error checking, and device management without CPU involvement.

πŸ“‘ Serial Communication

What is Serial Communication?

Serial communication transmits data one bit at a time over a single channel or wire. It's widely used for long-distance communication and connecting peripheral devices.

Serial vs Parallel Communication

Feature Serial Parallel
Data Lines 1 or 2 8, 16, 32+
Speed (short distance) Slower Faster
Cost Low High
Distance Long Short
Crosstalk Minimal Significant
Use Case Networks, peripherals Internal buses

Types of Serial Communication

1. Synchronous Serial Communication

Data is transmitted with a clock signal. Both sender and receiver share the same clock.

Characteristics:

  • Requires clock synchronization
  • Faster and more efficient
  • Used for high-speed applications
  • Examples: SPI, IΒ²C, SATA
Fast
Clock Required
High Efficiency

2. Asynchronous Serial Communication

Data is transmitted without a clock signal. Uses start and stop bits for synchronization.

Characteristics:

  • No clock signal needed
  • Uses start and stop bits
  • Flexible but less efficient
  • Examples: UART, RS-232, USB
Simple
No Clock
Flexible

Asynchronous Data Frame

Frame Structure:

[Start Bit (1)] [Data Bits (5-9)] [Parity Bit (0-1)] [Stop Bits (1-2)]

Serial Communication Parameters

1. Baud Rate ⚑

Number of signal changes per second. Common rates: 9600, 19200, 38400, 57600, 115200 bps.

Note: Baud rate must match between sender and receiver!

2. Data Bits πŸ“Š

Number of bits in each data packet (typically 5, 6, 7, or 8 bits). Most common is 8 bits.

3. Parity Bit πŸ”

Used for error detection. Types:

  • Even Parity: Makes total 1s even
  • Odd Parity: Makes total 1s odd
  • None: No parity checking
4. Stop Bits ⏸️

Indicates end of transmission (1, 1.5, or 2 bits). Provides time for receiver to prepare for next byte.

Serial Communication Standards

RS-232

  • Old but still widely used standard
  • Point-to-point communication
  • Maximum distance: ~15 meters
  • Voltage levels: Β±3V to Β±15V

USB (Universal Serial Bus)

  • Modern, high-speed serial standard
  • Plug-and-play capability
  • Supports multiple devices (up to 127)
  • Provides power to devices
  • Versions: USB 1.1, 2.0, 3.0, 3.1, 4.0

UART (Universal Asynchronous Receiver-Transmitter)

  • Hardware device for asynchronous serial communication
  • Converts parallel data to serial and vice versa
  • Widely used in embedded systems
  • Full-duplex communication
πŸ’‘ Modern Trend: Despite being "slower," serial communication dominates modern computing due to lower cost, longer distance capability, and higher speeds at modern frequencies.

🎯 Test Your Knowledge

Question 1: Which mode of transfer is fastest?

Question 2: What does IOP stand for?

Question 3: Asynchronous transfer uses how many control signals in handshaking?

Question 4: Which DMA mode causes minimal CPU disruption?

Question 5: Serial communication is better than parallel for:

Question 6: In priority interrupt, the fastest method is: