Skip to main content

4.1 I/O System Architectures: Memory-Mapped vs Isolated I/O

📚04Topic 4.1⏱️14 min
🎯High-Yield For:Every peripheral device connected to a computer—from NVMe drives and GPUs to keyboards and network cards—communicates with the processor via I/O interfaces, relying on either Memory-Mapped or Port-Mapped architectures.

💡 Core Intuition:​

🍳 The Everyday Analogy:​

Imagine an international embassy operating inside a major capital city. The Ambassador (the CPU) sits in an executive suite, while staff members, couriers, and foreign delegates (I/O Peripherals) arrive with messages.

The Ambassador cannot personally run down to the street gate to converse directly with every visitor:

  • Visitors speak hundreds of foreign languages (different data formats like ASCII, binary, analog voltages).
  • Visitors move at vastly different speeds: an optical telegram arrives in seconds, while an ocean freight courier arrives in three weeks (Speed Mismatch).
  • Visitors have different physical orientations: some are human couriers, others are pneumatic tubes or radio signals (Electromechanical vs Electronic media).

Instead, the embassy establishes an Intake Protocol Office (The I/O Interface) with standard inbox trays.

To organize how the Ambassador reads these messages, the embassy chooses between two mailroom architectures:

  1. The Shared Pigeonhole Wall (Memory-Mapped I/O): The mailroom maintains a single master wall of numbered mailboxes (00 to 999999). Mailboxes 00 to 899899 hold internal staff memos (RAM), while mailboxes 900900 to 999999 hold peripheral inboxes (I/O Devices). The Ambassador uses the exact same READ_BOX instruction for both. The downside? Staff lose 100100 mailboxes of storage!
  2. The Dual-Room Mail System (Isolated / Port-Mapped I/O): The mailroom builds two completely separate rooms. Room A has boxes 00 to 999999 exclusively for internal staff memos (Full RAM capacity). Room B has boxes 00 to 9999 for external visitors (I/O Ports). The Ambassador uses a special golden key and dedicated VISITOR_IN / VISITOR_OUT commands to access Room B. Full memory is preserved, but special instructions and extra doors are required!

💻 Bridging to Computer Science:​

In computer systems, the CPU and Main Memory are ultra-fast, synchronized electronic circuits operating in gigahertz clock domains. External peripherals (keyboards, sensors, disk controllers, network interfaces) operate across heterogeneous physical media with independent clocks.

An I/O Interface Module bridges this physical and temporal divide. How the CPU routes addresses to these interface registers defines the two fundamental paradigms of computer architecture: Memory-Mapped I/O (MMIO) and Isolated (Port-Mapped) I/O (PMIO).



🔌 Why Direct CPU-Peripheral Connection is Impossible​

Computer peripherals can never be wired directly to the system CPU buses. An intermediate hardware adapter—the I/O Interface—is mandatory due to four fundamental hardware incompatibilities:

The 4 Incompatibilities Mandating an I/O Interface

Physical, temporal, and electronic boundaries between microprocessors and external peripherals

Barrier 1

Speed & Bandwidth Disparity

⏱️

CPUs operate at 3.0 - 5.5 GHz (nanoseconds). Peripherals operate at kHz to MHz (milliseconds).

A mechanical keyboard generates ~10 bytes/secA high-speed NVMe SSD generates ~7 GB/secDirect connection would force the CPU to stall 99.99% of its operational life waiting on I/O
↓Buffering & Rate Matching
Barrier 2

Data Format & Word Length Mismatch

🔤

CPUs process parallel 32-bit or 64-bit words; peripherals often transmit serial byte streams.

Serial-to-Parallel and Parallel-to-Serial conversion (UART / PCIe)Character code translations (ASCII, UTF-8, parity checking, CRC checksums)
↓Serialization & Format Conversion
Barrier 3

Physical & Electromagnetic Operating Modes

⚡

CPUs are purely electronic CMOS logic; peripherals are magnetic, optical, or radio-based.

Peripherals utilize electromechanical motors, optical lasers, and inductive coilsRequires analog-to-digital (ADC) and digital-to-analog (DAC) transducers with signal isolation
↓Signal Transduction
Barrier 4

Autonomous Timing & Clock Domains

🔄

Peripherals operate on asynchronous, independent local oscillators decoupled from CPU clocks.

Requires explicit handshaking, strobing, and FIFO buffering to prevent data corruption

Anatomy of an I/O Interface Unit:​

An I/O interface typically contains four internal hardware registers accessible to the CPU:

  1. Data Input Register: Buffers bytes received from the external device before the CPU reads them.
  2. Data Output Register: Holds bytes written by the CPU before transmission to the external device.
  3. Control Register: Configures peripheral operational modes, baud rates, interrupts, and parity.
  4. Status Register: Contains hardware flags reflecting device readiness (e.g., Busy, Data Ready, Error).

🏛️ Memory-Mapped I/O vs Isolated I/O: The Two Grand Paradigms​

When the CPU needs to communicate with an I/O interface register, it emits an address across the system bus. Microprocessors handle this address using one of two distinct architectural philosophies:

Memory-Mapped I/O vs Isolated (Port-Mapped) I/O

Fundamental structural trade-offs between unified address spaces and segregated I/O spaces

Unified Space

Memory-Mapped I/O (MMIO)

🌐
Dominant Architecture / DomainModern Architectures: ARM, RISC-V, MIPS, PCIe Base Address Registers
  • •Shared address space: Memory and I/O share the same 2^n address range.
  • •Unified control bus: Uses standard MEMR and MEMW signals.
  • •Rich instruction set: MOV, ADD, SUB, AND, CMP can manipulate I/O registers directly.
  • •Reduces available physical RAM capacity by the size of the mapped I/O range.
  • •Zero specialized I/O assembly instructions required.
"Every hardware port is simply a memory cell accessed via standard pointer arithmetic."
Segregated Space

Isolated / Port-Mapped I/O (PMIO)

🚪
Dominant Architecture / DomainDesktop x86/x86-64 Legacy Ports & Classic Microprocessors (Intel 8085/8086)
  • •Independent address spaces: Memory and I/O have distinct, overlapping address maps.
  • •Dedicated control signals: Uses separate IOR and IOW lines (or an IO/M status line).
  • •Restricted instructions: Only dedicated IN and OUT instructions can access I/O ports.
  • •Preserves 100% of physical RAM address space without stealing a single byte.
  • •Data transfers must funnel strictly through the CPU Accumulator register.
"Memory and I/O live in isolated universes bridged only by specialized doorway instructions."

1. Memory-Mapped I/O (MMIO) Mechanics​

In Memory-Mapped I/O, the processor hardware does not distinguish between a physical DRAM cell and a peripheral interface register:

  • If the address bus is 16 bits16\text{ bits} wide (64 KB64\text{ KB} total addressability):
    • Addresses 0x0000 to 0xEFFF (60 KB60\text{ KB}) map to physical DRAM.
    • Addresses 0xF000 to 0xFFFF (4 KB4\text{ KB}) map to I/O device registers.
  • Control Bus Simplicity: The CPU requires only two bus control lines: MEMR‾\overline{\text{MEMR}} (Memory Read) and MEMW‾\overline{\text{MEMW}} (Memory Write).
  • Programming Flexibility: The full power of the ALU can be applied directly to hardware ports:
    ; Directly set Bit 3 in an I/O control register in MMIO:
    OR [0xF004], 0x08 ; Single instruction, zero register overhead!
    ADD EAX, [0xF000] ; Read sensor directly into arithmetic addition!
  • The Penalty: Any address assigned to an I/O device can never be used for physical RAM.

2. Isolated I/O (Port-Mapped I/O / PMIO) Mechanics​

In Isolated I/O, the processor provides two completely distinct address spaces that share the same physical address bus lines:

  • In the Intel 8086 architecture:
    • Memory Space: 1 MB1\text{ MB} addressable space (0x00000 to 0xFFFFF, 20 bits20\text{ bits}).
    • I/O Port Space: 64 KB64\text{ KB} addressable space (0x0000 to 0xFFFF, 16 bits16\text{ bits}).
  • Hardware Discrimination: How does the memory chip know not to respond when the CPU addresses port 0x0040? The CPU asserts dedicated control lines:
    • For Memory: MEMR‾\overline{\text{MEMR}} and MEMW‾\overline{\text{MEMW}} are active.
    • For I/O: IOR‾\overline{\text{IOR}} and IOW‾\overline{\text{IOW}} are active (or an IO/M‾\text{IO}/\overline{\text{M}} status line is held High).
  • Instruction Constraint: Only specialized transfer instructions can communicate with ports, and data must funnel strictly through the Accumulator:
    ; Manipulating an I/O port in Isolated I/O (x86):
    IN AL, 0x40 ; Read port 0x40 into Accumulator
    OR AL, 0x08 ; Modify bit in CPU register
    OUT 0x40, AL ; Write back to port

🎛️ Detailed Architectural Feature Comparison Matrix​

Feature ParameterMemory-Mapped I/O (MMIO)Isolated / Port-Mapped I/O (PMIO)
Address Space StructureUnified (Single shared address map)Segregated (Two independent, overlapping maps)
Instruction SetFull memory set (MOV, ADD, SUB, AND, CMP)Restricted dedicated instructions (IN, OUT)
Operand DestinationAny general-purpose CPU register or direct memoryMust route strictly through the Accumulator (AL/AX)
Bus Control Signals2 lines (MEMR‾,MEMW‾\overline{\text{MEMR}}, \overline{\text{MEMW}})4 lines (MEMR‾,MEMW‾,IOR‾,IOW‾\overline{\text{MEMR}}, \overline{\text{MEMW}}, \overline{\text{IOR}}, \overline{\text{IOW}}) or IO/M‾\text{IO}/\overline{\text{M}}
RAM Capacity ImpactReduces available RAM (I/O steals address range)Zero impact on RAM (Full 2n2^n addressability for DRAM)
Addressing ModesAll addressing modes (Direct, Indirect, Indexed)Limited addressing modes (Direct port, Register indirect DX)
Hardware DecodingRequires full nn-bit address decodersSimpler decoders (I/O addresses typically 8 or 16 bits)
Primary ExamplesARM, RISC-V, MIPS, Motorola 68000, PCIe BARsIntel 8085, 8086, x86 Legacy Ports

🤝 Asynchronous Data Transfer: Strobe vs Two-Wire Handshaking​

When a processor communicates with memory, transfers are typically Synchronous—governed by a shared master clock generator.

However, because peripherals operate on independent, asynchronous clock crystals, data transfer must be regulated by hardware coordination protocols:

1. The Strobe Signal Method (Open-Loop Control)​

A single control line carries a brief pulse (the Strobe) to coordinate the transfer:

  • Source-Initiated Strobe: The transmitting device places data on the data bus, waits for voltages to stabilize, and asserts a Strobe pulse.
  • Destination-Initiated Strobe: The receiving device asserts a Strobe pulse requesting data, and the transmitter puts data on the bus.
📐The Fatal Flaw of Strobe Pulsing: Lack of Acknowledgementprinciple

The Strobe method is strictly open-loop:

  • In source-initiated transfer, the transmitter has no confirmation whether the destination actually captured the data or if it was busy/powered off!
  • In destination-initiated transfer, the receiver has no guarantee that the transmitter responded in time before the receiver read the bus.
  • If either device experiences a clock glitch, data is silently lost or corrupted.

2. The Two-Wire Handshaking Protocol (Closed-Loop Control)​

To eliminate data loss, robust computing systems utilize Asynchronous Two-Wire Handshaking. Two independent control lines provide mutual hardware acknowledgement:

  • Line 1 (Data Valid / Strobe): Asserted by the Source.
  • Line 2 (Data Accepted / Ready): Asserted by the Destination.
Architecture Flow

Source-Initiated Two-Wire Handshaking Sequence

Fully interlocked closed-loop protocol guaranteeing zero data loss across asynchronous clock domains

💡 Hover or click any card for deep-dive operational details
📦Phase 1

Data Bus Drive

Source drives data word onto data bus lines and allows voltage to stabilize.

→
📢Phase 2

Assert Data Valid

Source asserts Data Valid = 1, notifying destination that bus lines are stable.

→
📥Phase 3

Latch & Accept

Destination captures data into register and asserts Data Accepted = 1.

→
🔄Phase 4

Handshake Reset

Source drops Data Valid = 0; destination drops Data Accepted = 0, returning bus to idle.

The Interlocked Guarantee:​

Because each state transition depends strictly on the partner device's confirmation signal:

  1. The source cannot remove data until the destination confirms receipt (Data Accepted = 1).
  2. The destination cannot accept duplicate data because the handshake does not reset until both signals return to zero.
  3. The protocol automatically self-throttles to the speed of the slowest communicating unit!

🏭 Real-World Production Context:​

1. PCIe Base Address Registers (BARs) in Modern GPUs​

Every modern graphics card (NVIDIA RTX, AMD Radeon) plugged into a PCIe slot uses Memory-Mapped I/O:

  • During system boot, the BIOS/UEFI enumerates the PCIe device's Base Address Registers (BARs).
  • The OS kernel assigns a contiguous range of the 64-bit physical address space directly to the GPU's on-board VRAM and command submission rings.
  • When a high-performance game or CUDA kernel issues write instructions to those memory addresses, the CPU's memory controller bypasses DRAM entirely and routes the transactions over the PCIe bus directly into the GPU registers at full bus speed.

2. High-Performance Driver Polling vs Interrupt Overhead​

Device driver engineers often debate whether to use MMIO polling or interrupts:

  • For ultra-low-latency devices (e.g., 100 Gbps100\text{ Gbps} Ethernet cards using DPDK or NVMe SSDs with SPDK), the overhead of handling hardware interrupts and context switching (5 to 10 microseconds5\text{ to }10\text{ microseconds}) is too slow.
  • Drivers deploy Kernel-Bypass Polling: user-space threads continuously read an MMIO status flag directly in a tight loop. Because MMIO operations hit on-chip PCIe buffers, status verification completes in nanoseconds, sustaining tens of millions of packets per second.

3. Safety Watchdogs in Handshaking Interfaces​

In safety-critical embedded systems (automotive ECUs, medical pumps), a hardware failure can cause a peripheral to never assert Data Accepted = 1. Because a pure handshaking protocol waits indefinitely, modern bus controllers incorporate hardware Watchdog Timers:

  • If Data Accepted is not returned within a programmed threshold (e.g., 100 microseconds100\text{ microseconds}), the bus controller forces a Bus Error Exception (SIGBUS) to prevent the CPU from hanging.

📐 Numerical Applications & Worked Examples​

Example 1: Memory-Mapped vs Isolated I/O Capacity & Address Decoding​

Problem Statement:
A microprocessor has a 16-bit address bus and an 8-bit data bus. The computer requires an interface with 512 distinct I/O ports.

  1. Under Isolated I/O, what is the maximum physical RAM capacity that can be connected?
  2. Under Memory-Mapped I/O, what is the maximum physical RAM capacity that remains available?
  3. In Memory-Mapped I/O, design the address decoding allocation: specify the exact hexadecimal address range allocated to I/O ports (placing them at the highest available addresses) and the address range for RAM.
  4. How many address lines are required to select an individual I/O port?

Step-by-Step Solution:

  1. Maximum RAM Capacity in Isolated I/O:

    • Address bus width n=16 bitsn = 16\text{ bits}.
    • In Isolated I/O, the memory space is entirely separate from I/O space and is distinguished by control lines (MEMR‾/MEMW‾\overline{\text{MEMR}} / \overline{\text{MEMW}} vs IOR‾/IOW‾\overline{\text{IOR}} / \overline{\text{IOW}}).
    • Total addressable memory space = 216 bytes=64 KB2^{16}\text{ bytes} = \mathbf{64\text{ KB}}.
    • Result: Full 64 KB64\text{ KB} of physical RAM can be connected.
  2. Maximum RAM Capacity in Memory-Mapped I/O:

    • In Memory-Mapped I/O, RAM and I/O share the single 64 KB64\text{ KB} address space.
    • Number of I/O ports = 512 ports=512 bytes=29 bytes=0.5 KB512\text{ ports} = 512\text{ bytes} = 2^9\text{ bytes} = 0.5\text{ KB}. Remaining RAM Capacity=64 KB−512 bytes=65,536−512=65,024 bytes (63.5 KB)\text{Remaining RAM Capacity} = 64\text{ KB} - 512\text{ bytes} = 65,536 - 512 = \mathbf{65,024\text{ bytes (63.5 KB)}}
  3. Address Range Allocation:

    • Total 16-bit address range: 0x0000 to 0xFFFF (65,53665,536 addresses).
    • Allocating the highest 512 addresses to I/O ports:
      • 512 in hex=0x0200512\text{ in hex} = 0\text{x}0200.
      • I/O Start Address = 0xFFFF−0x0200+1=0xFE000\text{xFFFF} - 0\text{x}0200 + 1 = \mathbf{0\text{xFE00}}.
      • I/O Port Address Range: 0xFE00 to 0xFFFF.
      • Physical RAM Address Range: 0x0000 to 0xFDFF.
  4. Address Lines Required to Select an I/O Port:

    • Number of ports = 512=29512 = 2^9.
    • log⁡2(512)=9 address lines\log_2(512) = \mathbf{9\text{ address lines}} (A0A_0 to A8A_8).
    • The remaining upper 7 address lines (A9A_9 to A15A_{15}) are fed into an address decoder to assert the Chip Select (CS‾\overline{\text{CS}}) signal when A15..9=11111112A_{15..9} = 1111111_2.

Example 2: Interleaved Memory Architecture & System Bus Bottleneck​

Problem Statement:
Consider a main memory system consisting of 8 independent memory modules attached to a common system bus that is one word wide.

  • When a write request is made, the bus is occupied for 100 ns100\text{ ns} by the data, address, and control signals.
  • During the same 100 ns100\text{ ns}, and for 500 ns500\text{ ns} thereafter, the addressed memory module executes one internal memory cycle accepting and storing the data (600 ns600\text{ ns} total module cycle time).
  • The internal operations of different memory modules may overlap in time, but only one write request can occupy the system bus at any given instant.

Calculate:

  1. The maximum number of write stores (of one word each) that can be initiated in 1 millisecond1\text{ millisecond} (1 ms1\text{ ms}).
  2. The minimum number of memory modules required to ensure the bus operates at 100%100\% saturation.

Step-by-Step Solution:

  1. Calculate Maximum Initiated Stores in 1 ms1\text{ ms}:

    • Bus occupancy time per store request = Tbus=100 nsT_{\text{bus}} = 100\text{ ns}.
    • Total module cycle time = 100 ns+500 ns=Tmodule=600 ns100\text{ ns} + 500\text{ ns} = T_{\text{module}} = 600\text{ ns}.
    • Since there are 8 independent modules, writes can be distributed across different modules:
      • Cycle 1 (0−100 ns0 - 100\text{ ns}): Module 0 accepts store; starts internal write (busy until t=600 nst = 600\text{ ns}).
      • Cycle 2 (100−200 ns100 - 200\text{ ns}): Module 1 accepts store; starts internal write (busy until t=700 nst = 700\text{ ns}).
      • Cycle 3 (200−300 ns200 - 300\text{ ns}): Module 2 accepts store.
      • Cycle 4 (300−400 ns300 - 400\text{ ns}): Module 3 accepts store.
      • Cycle 5 (400−500 ns400 - 500\text{ ns}): Module 4 accepts store.
      • Cycle 6 (500−600 ns500 - 600\text{ ns}): Module 5 accepts store.
      • Cycle 7 (600−700 ns600 - 700\text{ ns}): Module 0 has completed its 600 ns600\text{ ns} internal cycle and is completely free again!
    • Therefore, memory modules are never the bottleneck! The single system bus is the strict limiting resource. A new request can be placed on the bus every 100 ns100\text{ ns} continuously. Maximum Stores=Total Available TimeBus Occupancy Time=1 ms100 ns=1×10−3 s100×10−9 s=10,000 stores\text{Maximum Stores} = \frac{\text{Total Available Time}}{\text{Bus Occupancy Time}} = \frac{1\text{ ms}}{100\text{ ns}} = \frac{1 \times 10^{-3}\text{ s}}{100 \times 10^{-9}\text{ s}} = \mathbf{10,000\text{ stores}}
  2. Minimum Modules for 100%100\% Bus Saturation: To keep the bus occupied continuously without stalling for a module to finish its internal cycle: Minimum Modules=⌈TmoduleTbus⌉=⌈600 ns100 ns⌉=6 modules\text{Minimum Modules} = \left\lceil \frac{T_{\text{module}}}{T_{\text{bus}}} \right\rceil = \left\lceil \frac{600\text{ ns}}{100\text{ ns}} \right\rceil = \mathbf{6\text{ modules}} Because the system provides 8 modules (8≥68 \ge 6), the bus is guaranteed to run at its maximum theoretical throughput of 10,000 words/ms.


Example 3: Asynchronous Two-Wire Handshaking Maximum Transfer Rate​

Problem Statement:
An asynchronous two-wire handshaking interface connects an I/O peripheral to a computer system. The timing parameters for each transaction phase are:

  • Source places data on bus and propagation settles: 20 ns20\text{ ns}.
  • Source asserts Data Valid: 10 ns10\text{ ns}.
  • Cable propagation delay between devices: 15 ns15\text{ ns}.
  • Destination detects Data Valid and latches data: 25 ns25\text{ ns}.
  • Destination asserts Data Accepted: 10 ns10\text{ ns}.
  • Source detects Data Accepted and deasserts Data Valid: 15 ns15\text{ ns}.
  • Destination detects Data Valid = 0 and deasserts Data Accepted: 15 ns15\text{ ns}.
  • Data bus is 32 bits (4 bytes4\text{ bytes}) wide.

Calculate:

  1. The total time required to complete one full handshaking cycle.
  2. The maximum data transfer rate in Megabytes per second (MB/s\text{MB/s}).

Step-by-Step Solution:

  1. Calculate Total Handshake Period (TcycleT_{\text{cycle}}): A complete interlocked handshake requires two forward signal propagations and two return signal propagations:

    • Phase 1 (Data setup & bus stabilization): 20 ns20\text{ ns}.
    • Phase 2 (Source asserts Data Valid): 10 ns10\text{ ns}.
    • Phase 3 (Signal travels through cable to Destination): 15 ns15\text{ ns}.
    • Phase 4 (Destination latches data & asserts Data Accepted): 25 ns+10 ns=35 ns25\text{ ns} + 10\text{ ns} = 35\text{ ns}.
    • Phase 5 (Return signal travels through cable to Source): 15 ns15\text{ ns}.
    • Phase 6 (Source acknowledges & drops Data Valid): 15 ns15\text{ ns}.
    • Phase 7 (Drop signal travels through cable): 15 ns15\text{ ns}.
    • Phase 8 (Destination drops Data Accepted): 15 ns15\text{ ns}.

    Total Cycle Time Tcycle=20+10+15+35+15+15+15+15=140 ns\text{Total Cycle Time } T_{\text{cycle}} = 20 + 10 + 15 + 35 + 15 + 15 + 15 + 15 = \mathbf{140\text{ ns}}

  2. Calculate Maximum Data Transfer Rate:

    • Each handshake transmits one 32-bit word = 4 bytes4\text{ bytes}. Transfers per second=1Tcycle=1140×10−9 s≈7,142,857 transfers/sec\text{Transfers per second} = \frac{1}{T_{\text{cycle}}} = \frac{1}{140 \times 10^{-9}\text{ s}} \approx 7,142,857\text{ transfers/sec} Transfer Rate=7,142,857×4 bytes/sec≈28,571,428 B/s≈28.57 MB/s\text{Transfer Rate} = 7,142,857 \times 4\text{ bytes/sec} \approx 28,571,428\text{ B/s} \approx \mathbf{28.57\text{ MB/s}}

🎯 Exam & Interview Pitfall Check​

Core Conceptual Questions
  • Question 1: Why is Memory-Mapped I/O widely preferred in modern 64-bit architectures over Isolated I/O?
    Answer: In a 64-bit architecture, the Virtual Address Space is astronomical (16 Exabytes16\text{ Exabytes}). Reserving several gigabytes or terabytes for Memory-Mapped I/O (e.g., PCIe BARs, GPU memory, network buffers) has zero noticeable impact on available RAM capacity. Furthermore, MMIO allows modern compilers to apply rich pointer arithmetic, direct memory structures, and generic DMA descriptors directly to hardware registers without requiring specialized assembly instructions.

  • Question 2: What is the primary operational difference between the Strobe method and the Handshaking method of asynchronous data transfer?
    Answer: The Strobe method is open-loop; it transmits a single timed pulse without receiving confirmation, creating high vulnerability to data loss if the receiver is busy. The Handshaking method is closed-loop; it uses two interlocking control lines (Data Valid and Data Accepted), ensuring that the sender never removes data until the receiver explicitly acknowledges successful capture.

  • Question 3: In an Isolated I/O system, why does an instruction like ADD [0x0040], EAX fail to write to I/O port 0x0040?
    Answer: Because the ADD instruction is a memory-reference instruction. When the CPU executes ADD, the hardware bus controller automatically asserts the Memory Write (MEMW‾\overline{\text{MEMW}}) control line. The I/O interface at port 0x0040 is only wired to respond to the I/O Write (IOW‾\overline{\text{IOW}}) line generated by dedicated OUT instructions. The operation updates RAM cell 0x0040, leaving the peripheral port completely untouched!

Common Interview Traps
  • Trap 1: Assuming Memory-Mapped I/O Requires More Bus Lines than Isolated I/O.
    It is the exact opposite! Memory-Mapped I/O requires fewer control bus lines (only MEMR‾\overline{\text{MEMR}} and MEMW‾\overline{\text{MEMW}}). Isolated I/O requires extra control lines (IOR‾\overline{\text{IOR}} and IOW‾\overline{\text{IOW}}, or an IO/M‾\text{IO}/\overline{\text{M}} line) to inform the system bus whether the address lines refer to memory or I/O.

  • Trap 2: Forgetting Cable Propagation Delays in Handshaking Calculations.
    When calculating handshaking cycle time, students frequently add only the device setup and latch times while omitting cable propagation delays. Because handshaking signals must physically travel back and forth between devices, cable propagation delay must be counted twice (once for Data Valid to reach the receiver, and once for Data Accepted to travel back to the sender).

  • Trap 3: Believing Isolated I/O Increases Total RAM.
    Isolated I/O does not create more RAM than the address bus width allows; it simply prevents I/O ports from stealing addressable space from the RAM pool. A 16-bit bus supports 64 KB64\text{ KB} of RAM in Isolated I/O, but 64 KB64\text{ KB} minus I/O ports in Memory-Mapped I/O.


💬

Discussion & Doubts