Input-Output Organization and Bus Architectures

System Bus Architecture and Accessing I/O Devices

  • Bus Structural Organization:

    • Computer systems connect the processor, main memory, and multiple Input/Output (I/O) devices using a shared set of electrical signal pathways termed a system bus.

    • The system bus consists of three functional groups of signal lines:

    • Address Lines: Specify the unique destination address or location (memory address or I/O register) that the processor intends to access.

    • Data Lines: Bidirectional pathways that transmit binary data blocks between the processor, main memory, and I/O peripheral interfaces.

    • Control Lines: Signal lines carrying operational signals, command functions, and timing signals (such as Read and Write control lines).

Processor, Memory, and I/O devices interconnected via system bus
  • Addressing Mechanism for I/O Access:

    • Each peripheral interface connected to the bus is assigned a unique hardware address.

    • To initiate communication with a target I/O device, the processor places the binary address corresponding to that device onto the address lines.

    • Every device interface connected to the bus constantly monitors the address lines through internal decoding logic.

    • Only the specific device whose assigned address matches the decoded binary address pattern responds to the bus transaction.

    • The processor subsequently asserts appropriate control line signals (e.g., Read or Write commands), and actual data transfer proceeds via the bus data lines.

Memory Addressing Schemes: Memory-Mapped I/O vs. Isolated I/O

  • Address Space Definition:

    • An address space represents the total set or numerical range of distinct addresses that a processor can generate to access memory locations or peripheral interface registers.

    • For a system utilizing a 16-bit address line configuration, the addressable range spans from hex address 00000000 to FFFFFFFF.

  • Memory-Mapped I/O Architecture:

    • Memory locations and I/O interface registers share a single, unified address space.

    • Each I/O register is assigned an explicit numerical address within the system memory map.

    • Machine instructions capable of accessing memory locations (such as MOVE, LOAD, or STORE) are used directly to read from or write to peripheral device registers.

    • Eliminates the need for specialized assembly instructions dedicated strictly to peripheral transfer, resulting in streamlined software instruction set architectures (ISAs).

Memory-Mapped I/O Structural Interconnection
  • Isolated I/O / Port-Mapped I/O Architecture:

    • Main memory and peripheral I/O devices utilize separate, logically distinct address spaces.

    • Requires specialized assembly language instructions (such as IN and OUT) dedicated exclusively to exchanging data between processor registers and I/O ports.

    • Peripheral I/O address ranges are typically smaller than memory address spaces, allowing devices to require fewer physical address lines.

Comparison of Memory Mapped I/O vs Isolated/Port Mapped I/O Address Spaces
  • Sharing Address Lines:

    • Dedicated physical address lines for I/O and memory are not required; systems share identical physical address lines between both spaces.

    • The processor multiplexes the address bus and distinguishes between a memory transaction and an I/O transaction by asserting a dedicated control signal line (e.g., Memory/I/O\text{I/O} control signal).

I/O Interface Architecture and Operational Mechanism

  • Functional Role of an I/O Interface Circuit:

    • Acts as an intermediate hardware buffer and control interface bridging the high-speed system bus and lower-speed external peripherals.

    • Consists of four fundamental components:

    • Address Decoder: Decodes signals arriving from system address lines and enables internal interface logic when the address matches the assigned peripheral address.

    • Data Register: Temporarily stores data payload during transfers between processor and peripheral.

      • Input transfer flow: Peripheral Device →\rightarrow Data Register →\rightarrow Processor.

      • Output transfer flow: Processor →\rightarrow Data Register →\rightarrow Peripheral Device.

    • Status Register: Contains operational flags and status bits indicating device states (such as Device Ready, Device Busy, or Data Available).

    • Control Circuits: Recieves input signals from bus control lines, generates precise internal control commands, and coordinates operational timing across decoders, registers, and external peripheral hardware.

Functional block diagram of an I/O interface circuit
  • Sequential Operational Workflow of I/O Transfers:

    1. The processor outputs the assigned peripheral interface address onto the address bus.

    2. The address decoder within the interface circuit decodes the bit pattern and enables the target interface circuit registers.

    3. The processor issues operational commands via the bus control lines.

    4. Data payloads are placed onto the data lines and stored temporarily within data buffer registers.

    5. The status register updates status flags to reflect current device readiness or completion state.

    6. Internal control circuits manage timing and execution of peripheral operations.

Detailed control and data line flows within an I/O interface

Data Transfer Synchronization and Program-Controlled I/O

  • Synchronization Requirements:

    • High-speed central processors operate significantly faster than external mechanical or electronic I/O hardware.

    • A keyboard generates character data sporadically based on manual user keystrokes, during which the processor could execute millions of instructions.

    • Hardware mechanisms must coordinate timing differences to prevent lost data during slow device processing.

  • Program-Controlled I/O and Polling:

    • In program-controlled I/O, software instructions continuously query and evaluate peripheral status flags to execute transfers.

    • Polling Procedure:

    1. Processor sends an initial operation command to the peripheral.

    2. Processor enters an explicit execution loop, continually reading the device status register.

    3. The processor evaluates status flags until the device signals completion or readiness.

    4. Upon confirmation of readiness, the processor executes the actual memory or register data movement.

    • Inherent Limitation:

    • Polling wastes CPU instruction cycles inside idle wait loops.

    • While polling slow devices, processor computation capacity remains underutilized.

Interrupt-Driven I/O Architecture

  • Concept and Mechanism:

    • Eliminates idle processor polling by shifting response initiative to external hardware.

    • Instead of continuous processor querying, an I/O peripheral independently issues an asynchronous hardware electrical signal—termed an interrupt request—when requiring CPU attention.

    • The interrupt signal travels along dedicated control lines called Interrupt-Request lines (INTR‾\overline{\text{INTR}}).

    • Allows the processor to execute unrelated task routines concurrently, pausing execution only when alerted by peripheral hardware.

  • Interrupt Execution Sequence and Stack Maintenance:

    • Assume the processor is executing an instruction located at memory address ii when an interrupt request is detected:

    1. The processor completes the execution phase of instruction ii.

    2. Execution transfers to a dedicated service program called an Interrupt Service Routine (ISR).

    3. Prior to branching to the ISR, the processor automatically preserves program context by pushing the return address—the updated Program Counter (PC) value pointing to address i+1i+1—onto the system stack.

    4. Execution branches to the starting location of the designated ISR.

    5. At the conclusion of the ISR, a specialized Return-from-Interrupt instruction executes, popping the saved PC address (i+1i+1) off the stack and resuming original execution.

Transfer of control to an Interrupt Service Routine upon interrupt assertion
  • Subroutine vs. Interrupt Service Routine (ISR) Structural Comparison:

    • Functional Purpose:

    • Subroutine: Executes a task explicitly requested by the calling main application software.

    • ISR: Services asynchronous peripheral hardware requests and may be unrelated to the suspended application thread.

    • Control Transfer Trigger:

    • Subroutine: Explicitly invoked via software branch/call instructions (e.g., CALL, JSR).

    • ISR: Automatically hardware-invoked when an external electrical interrupt line is asserted.

    • Program Relationship:

    • Subroutine: Shares logical context and scope within the user execution program.

    • ISR: Belongs to system-level operating system code or lower-level device drivers.

    • Context Preservation Requirements:

    • Subroutine: Typically requires saving only the return address on the stack (alongside user-specified registers).

    • ISR: Must thoroughly preserve the complete processor state, including the Program Counter (PC), Processor Status Register (PSR) condition flags, and modified registers.

    • Return Mechanism:

    • Subroutine: Executes a software return instruction (RET), returning directly to the caller line.

    • ISR: Executes a specialized return-from-interrupt instruction, completely restoring the preserved hardware processor status register before returning control.

Interrupt Handling, Control, and Priority Structures

  • Interrupt Latency:

    • Defined as the total elapsed time delay measured from the precise moment an external hardware interrupt request is asserted to the initiation of the first instruction within the Interrupt Service Routine (ISR).

    • \n    \text{Interrupt Latency} = \text{Time}(\text{Interrupt Request Asserted}) \rightarrow \text{Time}(\text{ISR Execution Starts})\n    

    • Latency is directly affected by context saving operations; saving extensive register files requires memory bus cycles, increasing latency.

    • To minimize latency, modern processor hardware automatically saves only minimal context registers (PC and PSR) before branching, delegating additional register saving to software instructions at the start of the ISR.

  • Interrupt Acknowledgment Protocols:

    • Method 1: Dedicated Hardware Signal:

    • Processors issue a hardware Interrupt Acknowledge (INTA\text{INTA}) signal along control lines.

    • Received by interrupting peripheral interface, confirming request recognition.

    • Method 2: Implicit Bus Data Transfer:

    • Acknowledgment is accomplished without dedicated signals.

    • Accessing or reading data registers during interrupt processing implicitly signals recognition to peripheral hardware logic.

  • Enabling and Disabling Interrupts:

    • Uncontrolled nested interrupts can destabilize execution during critical state processing inside an ISR.

    • Systems implement machine instructions to manage state acceptance:

    • Interrupt-Disable Instruction: Blocks the processor from accepting incoming software or hardware interrupt requests.

    • Interrupt-Enable Instruction: Re-arms processing logic to evaluate incoming interrupt requests.

    • ISR Control Flow Protocol:

    1. Entry phase: Execute Interrupt-Disable as the first instruction to prevent concurrent interruption by identical peripherals.

    2. Processing phase: Execute core peripheral handling routines.

    3. Exit phase: Execute Interrupt-Enable as the final instruction before returning.

  • Interrupt-Enable (IE) Bit in Peripheral Interfaces:

    • Peripheral interface registers contain a dedicated software-configurable bit termed the Interrupt-Enable (IE) bit.

IE Bit Value

Functional Meaning

0

Device is explicitly prohibited from generating hardware interrupt requests.

1

Device is allowed to assert hardware interrupt request lines (IE=1→\text{IE}=1 \rightarrow Request permitted).

  • Multi-Level Control Logic:

    • Control operates across two distinct hierarchy levels:

    1. Peripheral Device Interface Level: Regulated by internal interface IE bit settings.

    2. Processor Core Level: Regulated by processor status flags and programmed priority bit masks.

  • Privilege Levels and Protected States:

    • Current execution priority is stored within designated bits in the Processor Status Register (PSR).

    • Instructions that alter execution priority or modify PSR values are privileged instructions.

    • Privileged instructions execute exclusively when the system operates in Supervisor Mode (Kernel Mode) and cannot be executed by user-level code operating in User Mode.

    • Attempting to execute privileged priority instructions while running in User Mode triggers a hardware exception termed a Privilege Exception, transferring execution directly to kernel trap handlers.

Hardware Interrupt Schemes and Identification Methods

  • Identification of Interrupting Peripherals:

    • Software Polling Scheme:

    • Peripherals share a single INTR‾\overline{\text{INTR}} control line connected to the processor.

    • When an interrupt occurs, individual interface status registers set an internal IRQ (Interrupt Request) status flag bit to 1 (IRQ=1\text{IRQ}=1).

    • The master ISR executes a sequential polling routine, sequentially reading peripheral status registers.

    • Device priority is defined by polling sequence order; the first device evaluated with IRQ=1\text{IRQ}=1 is serviced.

    • Limitation: Software polling incurs high overhead when many peripherals are attached.

    • Vectored Interrupt Scheme:

    • The interrupting peripheral identifies itself directly to processor hardware by writing a 4-to-8 bit binary identification code—termed an Interrupt Vector—onto data lines upon receiving acknowledgment.

    • The processor uses the vector as an index offset into a system memory structure called the Interrupt Vector Table (IVT).

    • The IVT stores absolute memory entry pointers to target ISR routines, enabling direct branching without polling delays.

  • Hardware Priority Arbitration Architectures:

    • 1. Multiple Independent Priority Lines:

    • Every individual peripheral connects to dedicated physical Interrupt Request (INTR‾p\overline{\text{INTR}}_p) and Interrupt Acknowledge (INTAp\text{INTA}_p) bus lines.

    • Requests route directly to an internal hardware priority arbitration circuit within the CPU core, evaluating requests against current PSR levels.

Priority arbitration scheme utilizing individual interrupt lines
  • 2. Daisy Chain Scheme:

    • Peripherals share a common INTR‾\overline{\text{INTR}} line, but the INTA\text{INTA} acknowledgment line is connected serially from device to device in a chain.

    • Upon receiving INTR‾\overline{\text{INTR}}, the processor asserts INTA\text{INTA} to Device 1.

    • If Device 1 requested service, it captures INTA\text{INTA} and places its vector on the bus. If Device 1 did not request service, it passes INTA\text{INTA} down to Device 2.

    • Physical proximity to the processor defines hardware priority: electrically closer devices hold higher priority.

Daisy chain interrupt acknowledge hardware configuration
  • 3. Hybrid Combination Scheme:

    • Combines independent priority levels with daisy chain lines.

    • Peripherals are organized into discrete priority groups.

    • Each group shares a unique priority INTR‾\overline{\text{INTR}} line, while individual peripherals within a single group are daisy-chained along that group's INTA\text{INTA} line.

Hybrid multi-group priority arbitration and daisy chain arrangement

System Exceptions

  • Definition:

    • An exception refers to any internal or external event that interrupts standard sequential application execution, requiring control transfer to specialized software handlers.

  • Taxonomy of System Exceptions:

    • I/O Interrupt Requests: Asynchronous external hardware notifications generated by peripheral devices.

    • Bus and Runtime Hardware Errors: Internal execution faults, such as memory parity errors, bus timeouts, or division-by-zero operations.

    • Software Traps and Debugging Functions: Execution traps utilized by software debuggers to establish breakpoints and monitor state transitions.

    • Privilege Exceptions: Security violations triggered when user-mode applications attempt executing protected supervisor instructions.

Direct Memory Access (DMA) Operations

  • DMA Principles:

    • Direct Memory Access (DMA) enables high-speed peripheral devices to transfer data blocks directly to and from main memory over the system bus without processor intervention.

    • Managed by specialized controller hardware termed a DMA Controller (DMAC).

  • Operational Functions of a DMA Controller:

    • Generates sequential physical memory addresses.

    • Generates required read/write bus control signals.

    • Manages data payload transfer between memory and peripherals.

    • Automatically increments memory address pointers following each transferred word.

    • Maintains internal loop counters tracking remaining word block counts.

  • DMA Initialization Sequence:

    1. The processor writes initialization parameters to internal DMAC registers:

    • Target Memory Starting Address.

    • Total Word Count / Block Length.

    • Transfer Direction (Peripheral-to-Memory or Memory-to-Peripheral).

    1. The processor releases the system bus to continue executing independent computations.

    2. The DMAC manages block data movement autonomously.

    3. Upon transferring the complete data block count, the DMAC asserts a hardware interrupt line to notify the processor of completion.

  • DMA Bus Operating Modes:

    • Cycle Stealing Mode:

    • DMAC interweaves single-word memory cycles between processor instruction memory cycles.

    • The DMAC temporarily "steals" individual bus cycles, relinquishing control back to the processor between transfers.

    • Keeps the processor active concurrently during large transfers.

    • Block / Burst Mode:

    • DMAC acquires exclusive, continuous control of the system bus for the complete block transfer.

    • The processor remains suspended from accessing the memory bus until the entire burst completes.

Mode Comparison Feature

Cycle Stealing Mode

Block / Burst Mode

Bus Control Duration

Takes bus for single individual word transfers

Retains exclusive bus control for complete block

Bus Access Pattern

Processor and DMAC access bus alternately

DMAC locks bus exclusively throughout transfer

Processor Execution

Processor continues execution between transfers

Processor waits for complete burst finish

Application Suitability

Maintains concurrent processor activity

Optimized for high-speed, continuous block transfers

  • Multi-Channel DMA Architecture:

    • Advanced DMACs integrate multiple independent transfer channels (e.g., Disk/DMA controllers driving multiple drives simultaneously by duplicating memory address registers, word counters, and control registers per channel).

System bus architecture incorporating dedicated DMA controllers

Bus Arbitration Mechanisms: Centralized and Distributed

  • Bus Arbitration Principles:

    • System buses are shared communication links that can be driven by only one master device at any given instant to prevent electrical signal corruption (bus contention).

    • The active controlling device authorized to initiate transfers is designated as the Bus Master.

    • Bus Arbitration is the formal decision process that selects which requesting master device acquires bus control when multiple devices request access simultaneously.

  • Three-Step Arbitration Sequence:

    1. Request: A device asserts a request line indicating a requirement for bus ownership.

    2. Arbitration: The system evaluates relative priorities among all active requests.

    3. Grant: Control logic asserts a bus grant line, conferring master status to the selected device.

  • Centralized Bus Arbitration:

    • A single dedicated hardware unit—the Central Bus Arbiter (frequently embedded inside the processor core)—manages all bus allocations.

    • Control Signals:

    • Bus Request (BR‾\overline{\text{BR}}): Shared active-low line asserted by devices requesting master status.

    • Bus Grant (BG1\text{BG1}, BG2\text{BG2}): Serial daisy-chained grant line routed through candidate controllers.

    • Bus Busy (BBSY‾\overline{\text{BBSY}}): Active-low line driven to 0 by the active bus master to signal that the bus is occupied.

Centralized bus arbitration circuit block diagram
  • Centralized Arbitration Operational Steps:

    1. DMA Controller 2 asserts BR‾\overline{\text{BR}}.

    2. The central processor detects BR‾\overline{\text{BR}} and asserts BG1\text{BG1}.

    3. BG1\text{BG1} propagates along the daisy chain. Intermediate controllers not asserting requests propagate the signal downstream (BG1→BG2\text{BG1} \rightarrow \text{BG2}).

    4. Upon receiving BG2\text{BG2}, DMA Controller 2 detects BBSY‾=1\overline{\text{BBSY}}=1 (bus free), assumes bus mastership, and sets BBSY‾=0\overline{\text{BBSY}}=0 (bus busy).

    5. After completing its transfers, DMA Controller 2 releases BBSY‾\overline{\text{BBSY}} to 1, returning mastership to the processor.

Timing signal diagram for centralized bus arbitration operations
  • Distributed Bus Arbitration:

    • Operates without a central arbiter; all candidate master devices participate in decentralized hardware logic to determine bus ownership.

    • Offers higher system fault tolerance by eliminating single points of failure.

    • Bus Line Allocation:

    • 4 Shared Arbitration Lines (ARB0‾\overline{\text{ARB0}} to ARB3‾\overline{\text{ARB3}}): Driven by open-collector outputs to transmit device ID codes.

    • 1 Start-Arbitration Line (Start-Arbitration‾\overline{\text{Start-Arbitration}}): Shared line asserted to trigger an arbitration cycle.

Device Designation

Assigned Unique 4-bit Binary ID

Device 1

0001

Device 2

0010

Device 3

0100

Device 4

1000

  • Distributed Arbitration Mechanics:

    1. Devices desiring bus access assert Start-Arbitration‾\overline{\text{Start-Arbitration}} and drive their unique 4-bit ID onto lines ARB0‾−ARB3‾\overline{\text{ARB0}}-\overline{\text{ARB3}}.

    2. Open-collector hardware connections perform a logical OR operation on all asserted bit patterns simultaneously.

    3. Each participating device compares its internal ID bit pattern against the combined pattern appearing on the arbitration lines starting from the most significant bit (MSB).

    4. If a device detects a higher-priority binary bit asserted on any line where its own ID bit is 0, it deactivates its lower-order driver outputs and withdraws from competition.

    5. The device possessing the highest numerical ID survives the comparison, wins arbitration, and assumes bus mastership.

Distributed bus arbitration circuit with open-collector drivers