Role of the I/O Interface Bridge
Role of the I/O Interface Bridge
Fast Central CPU
➔ System Bus ➔
I/O Interface Module
(Buffers, Decoders, Handshaking)
(Buffers, Decoders, Handshaking)
➔ External Peripheral Device
Explanation
- An interface translates bus requests into operations the device understands.
- Its registers hold data, commands and status for the driver.
Addressing Schemes Comparison
Addressing Schemes Comparison
Isolated I/O (Port-Mapped)
RAM and I/O devices have completely separate address spaces.
Uses dedicated instructions (
Uses dedicated instructions (
IN, OUT).Memory-Mapped I/O
I/O devices share the same address space as RAM.
Uses regular memory instructions (
Uses regular memory instructions (
MOV, LDA).Explanation
- Memory-mapped I/O assigns device registers addresses in the memory space.
- Isolated I/O uses a separate port address space and suitable instructions.
Evolution of Data Transfer Schemes
Evolution of Data Transfer Schemes
1. Programmed I/O
CPU constantly checks (polls) the device in a loop. Wastes 100% of CPU time.
2. Interrupt-Initiated I/O
Device rings an electronic bell only when ready. CPU does useful work in the meantime.
3. DMA Transfer
A hardware controller moves data blocks directly between drive and RAM without CPU help!
4. I/O Processor (IOP)
A dedicated helper CPU with its own instruction set managing all device traffic.
Explanation
- Programmed I/O repeatedly checks readiness and interrupt-driven I/O waits for a signal.
- DMA moves blocks with less CPU involvement, while an I/O processor can manage more of the operation.
DMA System Architecture
DMA System Architecture
CPU (Releases Bus on Bus Grant)
➔ DMA Controller (DMAC)
➔ Direct Transfer: Peripheral ↔ Main RAM
Explanation
- The CPU supplies a buffer location, transfer direction and count.
- The DMA controller moves the block and can interrupt the CPU when finished.
The Memory Hierarchy Pyramid
The Memory Hierarchy Pyramid
1. CPU Registers
Fastest (< 1 ns) | Smallest (Few KB) | Highest Cost
2. Cache Memory (L1, L2, L3)
Ultra-fast (1–10 ns) | Megabytes (MB) | SRAM Technology
3. Main Memory (RAM)
Moderate (50–100 ns) | Gigabytes (8–64 GB) | DRAM Technology
4. Auxiliary Storage (SSD / HDD)
Slow (Microseconds/ms) | Terabytes (TB) | Lowest Cost per bit
Explanation
- Registers and caches sit close to the processor and hold relatively little data.
- Lower levels supply more capacity with longer access times.
The Two Dimensions of Locality
The Two Dimensions of Locality
1. Temporal Locality (Time)
If you access a variable now, you will likely access it again very soon.
(e.g., loop counter
(e.g., loop counter
i in for(i=0; i<1000; i++))2. Spatial Locality (Space)
If you access one address, its nearby neighbor addresses will be accessed next.
(e.g., array elements
(e.g., array elements
arr[0], arr[1], arr[2])Explanation
- Temporal locality means returning to recently used data.
- Spatial locality means using nearby addresses soon after one another.
Cache Mapping Comparison
Cache Mapping Comparison
1. Direct Mapping
Each RAM block maps to strictly ONE fixed cache line.
Formula:
Formula:
Line = Block mod Total Lines2. Associative Mapping
Any RAM block can be placed in ANY free cache line.
Zero conflicts, but needs expensive search hardware.
Zero conflicts, but needs expensive search hardware.
3. Set-Associative Mapping
Cache is divided into sets (e.g., 2-way or 4-way).
The perfect middle ground used in all modern CPUs!
The perfect middle ground used in all modern CPUs!
Explanation
- Direct mapping gives a block one possible cache line.
- Set-associative mapping gives a group of choices and fully associative mapping allows any line.
Associative Memory Hardware Organization
Associative Memory Hardware Organization
Argument Register (A) ➔ Word to Search
Key Register (K) ➔ Bitmask of Interest
➔ Parallel Match Logic ➔ Match Register (M)
Explanation
- Associative memory compares a search value against stored entries in parallel.
- Match signals identify entries whose selected bits agree.
Virtual-to-Physical Address Translation
Virtual-to-Physical Address Translation
CPU Virtual Address: [ Page p | Offset d ]
➔ Looks up Page p in Page Table
➔ Physical RAM Address: [ Frame f | Offset d ]
Explanation
- Divide a virtual address into its page number and offset.
- The page table supplies the physical frame and the offset stays the same.
Direct Structural Comparison: Ancient vs. Modern Memory
Direct Structural Comparison: Ancient vs. Modern Memory
Scholar's Study Desk
Holds 1 or 2 active palm leaves being studied right now.
Modern Equivalent: CPU Working Registers
Modern Equivalent: CPU Working Registers
Reading Hall Racks
Holds frequently used reference scrolls for fast access.
Modern Equivalent: High-Speed Cache Memory (L1/L2)
Modern Equivalent: High-Speed Cache Memory (L1/L2)
Main Granthāgāra Towers
Nine-story organized shelves holding the active collection.
Modern Equivalent: Main Memory (RAM)
Modern Equivalent: Main Memory (RAM)
Underground Stone Vaults
Climate-safe sandalwood chests preserving master archive copies.
Modern Equivalent: Auxiliary Storage (SSD / Hard Disk)
Modern Equivalent: Auxiliary Storage (SSD / Hard Disk)
Explanation
- The manuscript example compares a small working collection with a larger store.
- The computer analogy is about access time and capacity.