Computer Organization and Architecture
Comprehensive exam revision notes for BCA-207N Unit 4 (Input/Output Organization, Interfaces & Data Transfer Modes). Includes Section A (2M), Section B (5M), and Section C (15M) questions, answers, and diagrams.
Computer Organization and Architecture
Input/Output Organization, Interfaces & Data Transfer Modes
Core Definitions & Key Concepts
Why is an I/O Interface needed between the CPU and peripheral devices
An I/O Interface is required because:
- Speed Mismatch: Peripherals operate electromechanically or electronically at orders of magnitude slower speeds than high-speed CPU/RAM.
- Data Format Disparity: Peripherals use serial bitstreams or custom encodings, whereas the CPU operates on parallel words (32/64 bits).
- Signal Levels: Peripherals use differing voltage levels and control standards requiring level-shifting and buffering.
Isolated (Standard) I/O and Memory-Mapped I/O
| Feature | Isolated (Port-Mapped) I/O | Memory-Mapped I/O |
|---|---|---|
| Address Space | Separate address spaces for memory and I/O devices (e.g., IN, OUT instructions). | Unified address space; I/O ports are mapped as standard memory addresses. |
| Instructions | Special I/O instructions required (IN, OUT in x86). | Standard memory instructions (MOV, LOAD, STORE) access devices. |
| Memory Capacity | Entire memory address space is available for RAM. | Consumes part of the addressable memory space for I/O registers. |
What is Asynchronous Data Transfer? List two common protocols
Asynchronous Data Transfer occurs when the transmitting and receiving units operate with separate, independent clock pulses. Two standard synchronization protocols are:
- Strobe Control: Single control line pulse initiating transfer.
- Handshaking: Two-way exchange of control signals (Request and Acknowledge).
Direct Memory Access (DMA)
Direct Memory Access (DMA) is a high-speed data transfer technique where a specialized hardware controller (DMA Controller) transfers entire blocks of data directly between an I/O device and main memory across the system bus without routing data through CPU registers, freeing the CPU for concurrent computation.
What is Cycle Stealing in DMA data transfer
In Cycle Stealing Mode, the DMA controller takes control of the system bus for exactly one bus cycle to transfer a single word, and then releases the bus back to the CPU. The CPU is paused for only one cycle, permitting interleaved execution.
What is an Interrupt Service Routine (ISR)
An ISR (Interrupt Handler) is a dedicated kernel subroutine executed in response to a specific hardware or software interrupt signal. The CPU pushes its PC and flags onto the stack, jumps to the ISR address indicated by the interrupt vector, services the device, and executes IRET to resume interrupted execution.
Conceptual & Architectural Analysis
The Handshaking Data Transfer Protocol for asynchronous communication with timing diagrams
Asynchronous Handshaking Data Transfer Protocol
Unlike simple strobe control (which provides zero feedback), Handshaking employs two separate control lines: Data Ready (from source) and Data Accepted (from destination), eliminating timing errors.
Source-Initiated Handshaking Timing Sequence:
Bus Lines: ==================[ Valid Data ]====================
| |
Data Ready (Source): +---------------------------------------+
| |
Data Accepted (Dest): +-----------------------+
|Step-by-Step Handshake Cycle:
- Source Places Data: Source unit places data onto data bus lines and asserts
Data Readysignal high. - Destination Receives: Destination detects
Data Ready, reads data from bus lines, and assertsData Acceptedsignal high. - Source Acknowledges: Source detects
Data Acceptedand lowersData Readysignal, indicating it knows data was received. - Destination Completes: Destination lowers
Data Accepted, restoring the system to idle state ready for the next word.
Fault-Tolerance: If either unit crashes or delays, the handshake pauses safely without dropping bytes.
Compare the three Modes of Data Transfer: Programmed I/O, Interrupt-Initiated I/O, and Direct Memory Access (DMA)
Modes of Computer Data Transfer
| Feature | Programmed I/O | Interrupt-Initiated I/O | Direct Memory Access (DMA) |
|---|---|---|---|
| CPU Involvement | Continuous polling loop. CPU sits in busy-wait checking status flag. | CPU executes background code until alerted by interrupt signal. | CPU merely initializes DMAC (source, dest, word count); zero involvement during block transfer. |
| Transfer Rate | Very slow; limited by CPU instruction cycle loop. | Moderate; overhead of saving registers and executing ISR per byte. | Blisteringly fast; limited strictly by memory bus bandwidth. |
| Hardware Complexity | Minimal; zero interrupt hardware required. | Moderate; requires priority encoder and interrupt controllers. | High; requires dedicated DMA Controller and bus arbitration logic. |
| Best Application | Simple embedded keyboard polling. | Infrequent, bursty inputs (mouse clicks, serial port). | High-speed block devices (NVMe SSDs, Gigabit Ethernet, GPU framebuffers). |
The Daisy-Chaining Priority Interrupt architecture with a neat circuit diagram
Daisy-Chaining Priority Interrupt Architecture
Daisy-chaining is a hardware serial priority arbitration scheme where devices requesting interrupts are chained together in priority order (Device 1 highest, Device N lowest).
+-----------+ Interrupt Request (INTR)
| |<--------------------------------------------------+
| CPU | |
| |---> Interrupt Acknowledge (INTA) |
+-----------+ | |
v |
+-----------+ +-----------+
| Device 1 | (PI PO) (PI PO| Device N |
| (Highest) |---------> ... ------------->| (Lowest) |
+-----------+ +-----------+
| |
+------------ VAD to Bus -----------------+Working Principle:
- When any device needs service, it pulls the common open-collector
INTRline low. - CPU completes current instruction and emits an
INTA(Interrupt Acknowledge) pulse into Device 1's Priority-In (PI) pin. - If Device 1 requested interrupt: It intercepts the signal (sets PO = 0) and places its Vector Address (VAD) directly onto the data bus for the CPU.
- If Device 1 did not request interrupt: It passes the acknowledge pulse through its Priority-Out (PO) line to Device 2 (PO = 1), which continues down the chain.
In-Depth Analysis & Implementation
Direct Memory Access (DMA) in comprehensive detail. Describe the internal block diagram of a DMA Controller (DMAC), its register structure, bus request/grant arbitration, and compare Burst Transfer vs Cycle Stealing modes
Comprehensive Architecture of Direct Memory Access (DMA)
DMA bypasses the CPU for bulk data transfers between high-speed secondary peripherals and main memory.
+-------------------------------------------------------+
| System Data Bus |
+-------------------------------------------------------+
^ ^ ^
| | |
+-------+ +--------+ +----------+
| CPU |<== BR, BG ==| DMAC |<== DREQ, DACK | Disk/Net |
+-------+ +--------+ +----------+
| | |
+-------------------------------------------------------+
| System Address Bus |
+-------------------------------------------------------+1. Internal Registers of the DMA Controller
- Address Register (MAR): Holds the starting physical memory address where data is to be written or read. Automatically increments after every transferred word.
- Word Count Register (WCR): Initialized with the total number of words to transfer. Automatically decrements after each transfer. When WCR reaches 0, DMAC raises a terminal count interrupt.
- Control / Status Register: Configures transfer direction (Memory-to-I/O or I/O-to-Memory), mode (Burst/Steal), and reports transfer status.
2. Step-by-Step DMA Transfer Sequence:
- CPU Setup: The CPU driver writes starting address to MAR, block size to WCR, and initiates the device. The CPU then continues executing unrelated user threads.
- DMA Request (DREQ): When peripheral has data ready, it asserts
DREQto the DMAC. - Bus Request (BR): The DMAC asserts
BR(Bus Request) to the CPU. - Bus Grant (BG): The CPU finishes its current bus cycle, floats its address/data buses to High-Z, and asserts
BG(Bus Grant) back to DMAC. - Direct Data Flow: The DMAC places memory addresses onto the address bus and pulses
DACKandI/O Read/Memory Writelines. Data words flow directly from device to RAM at hardware bus speed. - Interrupt on Completion: When WCR = 0, DMAC releases the bus back to the CPU and emits an interrupt alerting the OS that the block transfer is complete.
3. Comparison of DMA Transfer Modes:
- Burst Mode (Block Transfer): The DMAC retains control of the system bus continuously until the entire block of data (e.g., 4 KB) is transferred. Maximizes transfer speed but locks the CPU out of RAM during the burst.
- Cycle Stealing Mode: The DMAC requests the bus, transfers one word, and releases the bus back to CPU. Minimizes CPU stalling at the expense of slight arbitration overhead.
Discuss Parallel Priority Interrupt Hardware using a Priority Encoder. Describe the role of the Interrupt Status Register, Mask Register, and explain how software interrupt masking enables nested interrupts
Parallel Priority Interrupt System with Priority Encoder
Parallel priority interrupt hardware resolves simultaneous interrupt requests in a single clock cycle using combinational logic.
Inputs (0-7) +---------------------+
from Devices ----> | Interrupt Mask Reg |
+---------------------+
|
v
+---------------------+
| Interrupt Status Reg|
+---------------------+
|
v
+---------------------+
| Priority Encoder | ===> Outputs: 3-bit Vector Address (VAD)
| (8-to-3 Lines) | ===> Interrupt Request to CPU (IST)
+---------------------+System Components:
- Interrupt Status Register: 8-bit register where flip-flop i is set to 1 when Device i raises an interrupt request.
- Mask Register: 8-bit register programmatically set by the CPU. If Mask bit M_i = 1, the interrupt from Device i is blocked (masked); if M_i = 0, it is allowed through.
- Priority Encoder: An 8-to-3 line priority encoder generates the binary code corresponding to the highest priority unmasked input bit.
Truth Table for 8-to-3 Priority Encoder:
| I_7 (Highest) | I_6 | I_5 | I_4 | I_3 | I_2 | I_1 | I_0 (Lowest) | Y_2 | Y_1 | Y_0 | Valid (V) |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | X | X | X | X | X | X | X | 1 | 1 | 1 | 1 |
| 0 | 1 | X | X | X | X | X | X | 1 | 1 | 0 | 1 |
| 0 | 0 | 1 | X | X | X | X | X | 1 | 0 | 1 | 1 |
| 0 | 0 | 0 | 1 | X | X | X | X | 1 | 0 | 0 | 1 |
| 0 | 0 | 0 | 0 | 1 | X | X | X | 0 | 1 | 1 | 1 |
| 0 | 0 | 0 | 0 | 0 | 1 | X | X | 0 | 1 | 0 | 1 |
| 0 | 0 | 0 | 0 | 0 | 0 | 1 | X | 0 | 0 | 1 | 1 |
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 |
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | X | X | X | 0 |
- Nested Interrupt Handling: When an ISR for Device 3 executes, the OS sets Mask bits for levels 0–3 to 1, while leaving levels 4–7 unmasked. Thus, an emergency high-priority device (like Device 7 power-fail) can preempt the current ISR, enabling nested prioritization.
Important Exam Points & Quick Revision
Examiner Insights & University Exam Strategy:
- Guaranteed 10/15-Mark DMA Question: Draw the full DMAC architecture with Address Register, Word Count Register, and control bus handshake (BR and BG). Distinguish clearly between Burst mode and Cycle Stealing.
- Daisy Chaining vs Priority Encoder: Often contrasted in 5-mark questions. Daisy chaining is serial hardware; Priority encoder is parallel combinational logic.
- Isolated vs Memory-Mapped I/O: Write a 4-point comparison table noting address space separation and instruction set impact.
100% left on this page — finishing it closes the gap for Input/Output Organization, Interfaces & Data Transfer Modes.
Input/Output Organization, Interfaces & Data Transfer Modes still counts as a weak topic until you finish this note and answer its questions.
Practise this unitTest Your Understanding
Now that you've read through these notes, practice unit MCQs to identify weak points and solidify your learning before exams.