COA Notes
I/O interface design, I/O ports, handshaking, and communication between CPU and peripheral devices.
Introduction
The CPU and I/O devices speak different languages — the CPU works with parallel binary data at nanosecond speeds, while devices like keyboards operate with serial signals at millisecond speeds, and disk drives work with analog signals and mechanical delays. The I/O interface (also called a device controller or I/O adapter) sits between them, translating between these different worlds — handling speed matching, data format conversion, signal level adaptation, and communication protocols.
Why I/O Interfaces Are Needed
- Speed mismatch: CPU operates at GHz; keyboard at ~10 characters/second; disk at ~100 MB/s
- Data format differences: CPU uses 32/64-bit parallel; devices may use serial, analog, or custom formats
- Signal level differences: CPU logic levels vs device-specific voltages
- Synchronization: CPU is synchronous (clock-driven); many devices are asynchronous
- Error handling: Devices can produce errors that need detection and reporting
I/O Interface Block Diagram
Interface Registers
Every I/O interface has these key registers accessible by the CPU:
Data Register
- Holds data being transferred between CPU and device
- Input: Device writes data here; CPU reads it
- Output: CPU writes data here; device reads it
- May be buffered (FIFO) to handle speed differences
Status Register
- Reports the current state of the device
- Bits indicate: device ready, busy, error, data available, transfer complete
- CPU reads this to check if it can interact with the device
Control Register
- CPU writes commands here to control the device
- Commands: start transfer, reset device, set mode, enable interrupts
Addressing I/O Interfaces
Memory-Mapped I/O
- I/O registers assigned addresses in the memory address space
- CPU accesses device registers using regular LOAD/STORE instructions
- Example: Writing to address 0xFF00 might send data to a display controller
- Advantage: No special instructions needed; full instruction set available for I/O
- Used by: ARM, MIPS, most modern architectures
Isolated I/O (Port-Mapped)
- Separate I/O address space from memory
- Special instructions: IN (read port), OUT (write port)
- Example:
OUT 0x3F8, AL(send byte to serial port) - Advantage: Memory address space fully available for RAM
- Used by: x86 architecture
Handshaking
What is Handshaking?
A synchronization protocol between CPU and device to ensure reliable data transfer. Since devices operate at different speeds, handshaking signals confirm "I'm ready" and "I've received it."
Source-Initiated Handshake
| Source (device/CPU) | 1. Place data on bus |
| Destination | 3. Read data |
| Source | 5. Remove data |
| Destination | 7. De-assert "Data Accepted" |
Destination-Initiated Handshake
| Destination (CPU) | 1. Assert "Ready for Data" signal |
| Source (device) | 2. Place data on bus |
| Destination | 4. Read data |
Types of Data Transfer
Serial Interface
- Data transmitted one bit at a time
- Fewer wires but slower for bulk data
- Examples: UART, USB, SPI, I²C
- Common for: keyboards, mice, modems, sensors
Parallel Interface
- Multiple bits transmitted simultaneously
- More wires but faster for bulk data
- Examples: Traditional parallel port, internal buses (PCIe lanes)
- Being replaced by high-speed serial (ironically faster at modern frequencies)
Modern I/O Interface Examples
| Interface | Type | Speed | Use Case |
|---|---|---|---|
| USB 3.2 | Serial | 20 Gbps | Peripherals |
| PCIe 5.0 x1 | Serial | 32 Gbps | Expansion cards |
| SATA III | Serial | 6 Gbps | Storage |
| NVMe (PCIe x4) | Serial | 128 Gbps | Fast SSDs |
| Ethernet | Serial | 1-100 Gbps | Networking |
| I²C | Serial | 3.4 Mbps | Sensors/embedded |
Key Takeaways
- I/O interfaces bridge the gap between the fast, parallel CPU and diverse, slow devices
- Every interface has data, status, and control registers accessible by the CPU
- Handshaking protocols ensure reliable asynchronous communication
- Memory-mapped I/O uses regular addresses; port-mapped uses special IN/OUT instructions
- Interfaces handle speed matching, data conversion, and error detection
- Modern interfaces are predominantly serial at high speeds (USB, PCIe)
- The I/O interface design determines how efficiently the CPU can communicate with peripherals
Exam Focus
Revise definitions, diagrams, examples, and short-answer points for I/O Interface.
Interview Use
Prepare one clear explanation, one practical example, and one common mistake for this Computer Organization & Architecture topic.
Search Terms
computer-organization, computer organization & architecture, computer, organization, input, output, interface, i/o interface
Related Computer Organization & Architecture Topics