Computer Organization & Architecture

Unit 5: Input-Output Organization

From peripheral devices to DMA controllers โ€” master how computers communicate with the outside world, handle interrupts, and transfer data at blazing speed.

โฑ๏ธ 5 hrs theory + 3 hrs lab  |  ๐ŸŽฏ GATE ~2 marks  |  ๐Ÿ–ฅ๏ธ Aadhaar Biometric I/O

๐Ÿ’ผ Jobs this unlocks: Embedded Systems Engineer (โ‚น5โ€“10 LPA)  |  Hardware Design Engineer (โ‚น6โ€“12 LPA)  |  IoT Developer (โ‚น4โ€“8 LPA)

Section A

Opening Hook โ€” The Fingerprint That Feeds 80 Crore Indians

๐Ÿ–๏ธ How Aadhaar's Fingerprint Scanner Bypasses the CPU

Walk into any Indian ration shop, place your thumb on the biometric scanner, and within 2 seconds your identity is verified against a database of 1.4 billion records. But here's the engineering marvel most people miss: when that fingerprint scanner captures your print, the image data doesn't pass through the CPU.

The biometric device uses Direct Memory Access (DMA) โ€” a hardware technique where the scanner writes fingerprint data directly into memory, bypassing the CPU entirely. Why? Because the CPU is too busy running the operating system, managing the display, and handling network packets. If the CPU had to personally move every byte of fingerprint image data, the verification would take 10ร— longer.

This isn't just theory โ€” it's the I/O architecture that powers India's largest digital identity system. The same DMA principle is used in your phone (camera sensor โ†’ memory), your laptop (SSD โ†’ RAM), and every ATM you've ever used. This chapter teaches you exactly how all of this works.

๐Ÿ‡ฎ๐Ÿ‡ณ UIDAI (Aadhaar)๐Ÿ‡ฎ๐Ÿ‡ณ Texas Instruments๐Ÿ‡ฎ๐Ÿ‡ณ ISRO๐Ÿ‡ฎ๐Ÿ‡ณ DRDO๐Ÿ‡ฎ๐Ÿ‡ณ Qualcomm India๐Ÿ‡ฎ๐Ÿ‡ณ Intel India
India's Aadhaar system is the world's largest biometric database. It processes over 100 million authentication requests per day. Each biometric scanner performs I/O operations using DMA, interrupt-driven transfers, and serial communication (UART) โ€” the exact three techniques you'll learn in this chapter. The entire authentication pipeline completes in under 200 milliseconds.
Section B

Learning Outcomes โ€” Bloom's Taxonomy Mapped

Bloom's LevelLearning Outcome
๐Ÿ”ต RememberList the three modes of data transfer (Programmed, Interrupt-driven, DMA) and define each
๐Ÿ”ต RememberRecall the difference between Memory-mapped I/O and Isolated (I/O-mapped) I/O
๐ŸŸข UnderstandExplain how DMA transfers data without CPU intervention and describe cycle stealing
๐ŸŸข UnderstandDescribe the handshaking protocol in asynchronous data transfer with timing diagrams
๐ŸŸก ApplyCalculate DMA transfer rates, bus bandwidth, and interrupt latency for given configurations
๐ŸŸก ApplyDraw the UART frame format for a given character with correct start, data, parity, and stop bits
๐ŸŸ  AnalyzeCompare daisy chain vs parallel priority interrupt structures with trade-offs
๐ŸŸ  AnalyzeAnalyze why certain I/O devices (keyboard vs disk) use different transfer modes
๐Ÿ”ด EvaluateEvaluate which data transfer mode is optimal for a given real-world I/O scenario (sensor, camera, network card)
๐Ÿ”ด EvaluateAssess the performance impact of DMA burst mode vs cycle stealing on CPU utilization
๐ŸŸฃ CreateDesign a priority interrupt system for a given set of devices with different priority levels
๐ŸŸฃ CreateDesign a complete I/O interface block diagram for an embedded system with multiple peripherals
Section C

Concept Explanation โ€” I/O Organization from Scratch

1. Peripheral Devices

A computer processor by itself is just a number-crunching machine. It becomes useful only when it can communicate with the outside world โ€” keyboards, monitors, printers, scanners, network cards, and sensors. These external devices are called peripheral devices (or simply peripherals).

๐Ÿ–ฅ๏ธ Classification of Peripheral Devices

Input Devices: Send data INTO the computer โ€” Keyboard, mouse, scanner, microphone, fingerprint sensor, barcode reader, webcam

Output Devices: Receive data FROM the computer โ€” Monitor, printer, speaker, LED display, motor controller

Input/Output (I/O) Devices: Both send and receive โ€” Hard disk, SSD, USB flash drive, network card (NIC), touchscreen, modem

Every UPI payment terminal in India uses multiple peripherals simultaneously: a touchscreen (input/output), a QR scanner (input), a thermal receipt printer (output), and a network module (I/O). The I/O organization determines how all these devices share the processor and memory without conflicts.

The fundamental challenge: peripherals operate at vastly different speeds. A keyboard generates ~10 bytes/second, a mouse ~100 bytes/second, but an NVMe SSD can deliver 7 GB/second. The CPU runs at GHz speeds. How do you connect a snail to a bullet train? That's what I/O organization solves.

Speed Hierarchy
  Device             Speed              Analogy
  โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€  โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€  โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  Keyboard           ~10 B/s            ๐Ÿšถ Walking
  Mouse              ~100 B/s           ๐Ÿšฒ Cycling
  Printer            ~100 KB/s          ๐Ÿš— Car
  USB 2.0            ~60 MB/s           ๐Ÿš† Train
  Gigabit Ethernet   ~125 MB/s          โœˆ๏ธ Airplane
  SATA SSD           ~600 MB/s          ๐Ÿš€ Rocket
  NVMe SSD           ~7 GB/s            โšก Lightning
  CPU โ†” RAM          ~50 GB/s           ๐Ÿ’ซ Speed of Light

2. I/O Interface

Peripherals can't talk directly to the CPU โ€” they speak different "languages" (voltage levels, data formats, speeds). An I/O Interface acts as a translator that sits between the CPU/memory bus and the peripheral device.

Analogy: Think of a post office in a small town. The CPU is the District Collector (DC) who writes orders. The I/O Interface is the post office that receives the DC's order, translates it into the right format (Hindi to local language), and delivers it to the right person (device). The post office also handles incoming letters (data from devices) and routes them to the DC.

๐Ÿ”Œ CPU โ†’ I/O Interface โ†’ Device Architecture

  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                                     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
  โ”‚          โ”‚    Address Bus                       โ”‚              โ”‚
  โ”‚          โ”‚โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—                   โ”‚   Peripheral โ”‚
  โ”‚   CPU    โ”‚    Data Bus      โ•‘   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚    Device    โ”‚
  โ”‚          โ”‚โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ฌโ•โ•โ–ถโ”‚  I/O       โ”‚ โ”‚  (Printer,   โ”‚
  โ”‚          โ”‚    Control Bus   โ•‘   โ”‚ Interface  โ”‚โ•โ•โ•โ–ถ Scanner,   โ”‚
  โ”‚          โ”‚โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•   โ”‚ (Port/     โ”‚ โ”‚   Disk...)   โ”‚
  โ”‚          โ”‚                      โ”‚  Controllerโ”‚ โ”‚              โ”‚
  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚                                 โ”‚
       โ”‚         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”            โ”‚
       โ””โ•โ•โ•โ•โ•โ•โ•โ•โ–ถโ”‚  Memory  โ”‚โ—€โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ”˜
                 โ”‚  (RAM)   โ”‚
                 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

  Functions of I/O Interface:
  โ”œโ”€โ”€ Data Format Conversion (serial โ†” parallel)
  โ”œโ”€โ”€ Speed Matching (fast CPU โ†” slow device via buffers)
  โ”œโ”€โ”€ Device Selection (address decoding)
  โ”œโ”€โ”€ Status Monitoring (ready / busy / error flags)
  โ””โ”€โ”€ Control Signal Generation (read, write, strobe)

Memory-Mapped I/O vs Isolated I/O

There are two ways the CPU can address I/O devices:

Memory-Mapped I/O
  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
  โ”‚     Single Address Space             โ”‚
  โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”‚
  โ”‚  โ”‚  0x0000 โ”€โ”€โ”€ RAM             โ”‚     โ”‚
  โ”‚  โ”‚  ...                        โ”‚     โ”‚
  โ”‚  โ”‚  0x7FFF โ”€โ”€โ”€ RAM (ends)      โ”‚     โ”‚
  โ”‚  โ”‚  0x8000 โ”€โ”€โ”€ Keyboard Port   โ”‚ โ—€โ”€โ”€ I/O addresses are
  โ”‚  โ”‚  0x8004 โ”€โ”€โ”€ Display Port    โ”‚     part of memory map
  โ”‚  โ”‚  0x8008 โ”€โ”€โ”€ Printer Port    โ”‚     โ”‚
  โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ”‚
  โ”‚  CPU uses: MOV, LOAD, STORE          โ”‚
  โ”‚  Same instructions for I/O & memory  โ”‚
  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
Isolated I/O (I/O-Mapped)
  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
  โ”‚  Memory Space      โ”‚   โ”‚  I/O Space          โ”‚
  โ”‚  0x0000 โ”€โ”€โ”€ RAM    โ”‚   โ”‚  Port 0 โ”€ Keyboard  โ”‚
  โ”‚  ...               โ”‚   โ”‚  Port 1 โ”€ Display   โ”‚
  โ”‚  0xFFFF โ”€โ”€โ”€ RAM    โ”‚   โ”‚  Port 2 โ”€ Printer   โ”‚
  โ”‚                    โ”‚   โ”‚                     โ”‚
  โ”‚  SEPARATE spaces   โ”‚   โ”‚  SEPARATE spaces    โ”‚
  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  CPU uses: IN / OUT (special I/O instructions)
  IO/Mฬ„ control line distinguishes the two spaces
FeatureMemory-Mapped I/OIsolated I/O (I/O-Mapped)
Address SpaceShared with memorySeparate I/O address space
InstructionsMOV, ADD, any ALU instructionSpecial IN/OUT instructions only
Control LineNo special I/O line neededIO/Mฬ„ line needed
Address BitsReduces available memory addressesFull memory space preserved
FlexibilityCan use any instruction on I/OLimited to IN/OUT
HardwareSimplerNeeds extra decoder for I/O space
Used ByARM (Raspberry Pi), MIPS, RISC-VIntel x86 (your PC)
Indian ExampleARM-based Aadhaar biometric devicesOld railway booking terminals (x86)
Students confuse "Memory-Mapped I/O" with "DMA." Memory-mapped I/O is about addressing โ€” how the CPU refers to an I/O port (as a memory address). DMA is about data transfer โ€” moving data without CPU intervention. They are completely different concepts that can coexist in the same system.

3. Data Transfer Modes โ€” How Data Moves Between CPU and Peripherals

There are three fundamental ways data can move between I/O devices and the CPU/memory. Think of them as three levels of postal service:

๐Ÿ“ฆ The Three Modes of Data Transfer

Mode 1 โ€” Programmed I/O (Polling): The CPU keeps asking the device "Are you ready?" in a loop. Like standing at the door waiting for a courier โ€” you do nothing else until the parcel arrives.

Mode 2 โ€” Interrupt-Driven I/O: The device sends a signal (interrupt) when it's ready. Like giving your phone number to the courier โ€” "Call me when you arrive, I'll be working on other things."

Mode 3 โ€” Direct Memory Access (DMA): A special hardware controller transfers data directly between device and memory, without involving the CPU at all. Like hiring a personal assistant to receive all parcels and put them in the right room โ€” you don't even know the delivery happened.

Programmed I/O (Polling)
  CPU                          Device
   โ”‚                             โ”‚
   โ”‚โ”€โ”€โ”€โ”€ Read Status โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ถ โ”‚
   โ”‚โ—€โ”€โ”€โ”€ Status: NOT READY โ”€โ”€โ”€โ”€ โ”‚
   โ”‚                             โ”‚
   โ”‚โ”€โ”€โ”€โ”€ Read Status โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ถ โ”‚    โ† CPU stuck in
   โ”‚โ—€โ”€โ”€โ”€ Status: NOT READY โ”€โ”€โ”€โ”€ โ”‚      busy-wait loop
   โ”‚                             โ”‚      (wasting time!)
   โ”‚โ”€โ”€โ”€โ”€ Read Status โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ถ โ”‚
   โ”‚โ—€โ”€โ”€โ”€ Status: READY โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ”‚    โ† Finally ready!
   โ”‚                             โ”‚
   โ”‚โ”€โ”€โ”€โ”€ Read Data โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ถ โ”‚
   โ”‚โ—€โ”€โ”€โ”€ Data: 0x4D โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ”‚    โ† Data transferred
   โ”‚                             โ”‚
   โ–ผ                             โ–ผ
Interrupt-Driven I/O
  CPU                          Device
   โ”‚                             โ”‚
   โ”‚ โ† doing other work...       โ”‚ โ† preparing data...
   โ”‚    (executing programs)     โ”‚
   โ”‚                             โ”‚
   โ”‚โ—€โ•โ•โ•โ• INTERRUPT! โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• โ”‚  โ† Device signals CPU
   โ”‚                             โ”‚
   โ”‚โ”€โ”€โ”€โ”€ Save context โ”€โ”€โ”€โ”€โ”     โ”‚
   โ”‚     (push registers) โ”‚     โ”‚
   โ”‚                      โ–ผ     โ”‚
   โ”‚โ”€โ”€โ”€โ”€ Read Data โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ถ โ”‚
   โ”‚โ—€โ”€โ”€โ”€ Data: 0x4D โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ”‚  โ† Data transferred
   โ”‚                             โ”‚
   โ”‚โ”€โ”€โ”€โ”€ Restore context โ”€โ”€โ”    โ”‚
   โ”‚     (pop registers)   โ”‚    โ”‚
   โ”‚โ—€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚
   โ”‚ โ† resume original work     โ”‚
   โ–ผ                             โ–ผ
Indian Analogy โ€” Three Types of Bank Transfers:
Programmed I/O = Going to the bank counter โ€” you stand in line, wait your turn, hand over the cheque, wait for processing, collect receipt. You're stuck at the bank the whole time.
Interrupt I/O = Getting an emergency call during a meeting โ€” you're busy working, the bank calls "Your cheque is cleared!", you briefly handle it and go back to your meeting.
DMA = NEFT/RTGS transfer โ€” you set it up once, then the bank transfers money directly from account to account without you being involved at all. You don't even need to be awake!
FeatureProgrammed I/OInterrupt-Driven I/ODMA
CPU Involvement100% โ€” CPU stuck in loopPartial โ€” CPU handles interruptMinimal โ€” CPU only initiates
CPU EfficiencyโŒ Very poor (busy waiting)โœ… Goodโœ…โœ… Excellent
SpeedSlowMediumFast
Hardware Cost๐Ÿ’ฐ Cheapest๐Ÿ’ฐ๐Ÿ’ฐ Moderate๐Ÿ’ฐ๐Ÿ’ฐ๐Ÿ’ฐ Expensive (DMA controller)
Data PathDevice โ†’ CPU โ†’ MemoryDevice โ†’ CPU โ†’ MemoryDevice โ†’ Memory (bypasses CPU)
Best ForSlow devices (keyboard)Medium devices (mouse, UART)Fast devices (disk, camera, NIC)
GATE FavouriteComparison questionsISR, vector table QsDMA transfer time numericals
GATE Exam Shortcut: If a question asks "which mode is most efficient for high-speed devices?" โ€” the answer is always DMA. If it asks "which mode wastes CPU cycles?" โ€” Programmed I/O. These are guaranteed 1-mark questions.

4. Direct Memory Access (DMA) โ€” The Star of Unit 5

DMA is the most important topic in this unit. It appears in GATE every 2โ€“3 years, and understanding it deeply will help you crack both exams and interviews.

How DMA Works โ€” Step by Step

โšก DMA Controller Block Diagram

                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚          DMA CONTROLLER                 โ”‚
                    โ”‚                                         โ”‚
  CPU โ—€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”‚
   โ”‚   Bus Request  โ”‚  โ”‚ Address Reg  โ”‚  โ”‚  Word Count  โ”‚    โ”‚
   โ”‚   (BR/HRQ)     โ”‚  โ”‚  (AR)        โ”‚  โ”‚  Register    โ”‚    โ”‚
   โ”‚                โ”‚  โ”‚ Starting     โ”‚  โ”‚  (WC)        โ”‚    โ”‚
   โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ถโ”‚  โ”‚ address in   โ”‚  โ”‚  Number of   โ”‚    โ”‚
   โ”‚   Bus Grant    โ”‚  โ”‚ memory       โ”‚  โ”‚  words to    โ”‚    โ”‚
   โ”‚   (BG/HLDA)    โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚  transfer    โ”‚    โ”‚
   โ”‚                โ”‚         โ”‚          โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚
   โ”‚                โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”         โ”‚            โ”‚
  โ•โ•โ• System Bus โ•โ•โ•โ•ฌโ•โ•โ”‚ Control      โ”‚โ—€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜            โ”‚
   โ”‚                โ”‚  โ”‚ Logic        โ”‚                      โ”‚
   โ”‚                โ”‚  โ”‚ (R/Wฬ„, DMA   โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”‚
   โ”‚                โ”‚  โ”‚  Request,    โ”‚  โ”‚  Data Reg    โ”‚    โ”‚โ”€โ”€โ–ถ I/O Device
   โ”‚                โ”‚  โ”‚  DMA Ack)    โ”‚โ”€โ”€โ”‚  (DR)        โ”‚    โ”‚
   โ”‚                โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚  Buffer for  โ”‚    โ”‚
   โ”‚                โ”‚                    โ”‚  data byte   โ”‚    โ”‚
   โ”‚                โ”‚                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚
  โ”Œโ”€โ”               โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  โ”‚Mโ”‚
  โ”‚Eโ”‚   DMA Registers:
  โ”‚Mโ”‚   โ”œโ”€โ”€ AR  = Starting memory address
  โ”‚Oโ”‚   โ”œโ”€โ”€ WC  = Word count (decrements each transfer)
  โ”‚Rโ”‚   โ”œโ”€โ”€ DR  = Data register (holds one word in transit)
  โ”‚Yโ”‚   โ””โ”€โ”€ Control = Direction (Read/Write), DMA mode
  โ””โ”€โ”˜

DMA Transfer Sequence

DMA Handshake
  Step   CPU                    DMA Controller              Device
  โ”€โ”€โ”€โ”€   โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€   โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€   โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
   1     CPU initializes DMA:
         โ†’ Loads AR (start addr)
         โ†’ Loads WC (word count)
         โ†’ Sets direction (R/W)
         โ†’ Enables DMA

   2     CPU continues its        DMA waits for device       Device
         normal work...           request...                 prepares data

   3                               Device sends DRQ โ—€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ DRQ
                                   (DMA Request)

   4                               DMA sends BR โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ถ CPU
                                   (Bus Request / HRQ)

   5     CPU finishes current
         bus cycle, then sends
         BG (Bus Grant / HLDA) โ”€โ”€โ–ถ DMA takes over bus

   6     CPU floats its                                      
         address/data lines        DMA puts address on bus
         (tri-state)               DMA transfers 1 word:
                                   Device โ—€โ”€โ”€โ–ถ Memory

   7                               WC = WC - 1
                                   AR = AR + 1
                                   If WC โ‰  0: repeat from 3
                                   If WC = 0: send interrupt
                                   to CPU (transfer complete!)

   8     CPU gets interrupt,
         resumes normal bus
         ownership

DMA Transfer Modes

ModeHow It WorksCPU ImpactUse Case
Burst ModeDMA holds the bus for entire block transferCPU blocked for duration of transferDisk read (large sequential block)
Cycle StealingDMA takes bus for 1 word, returns it, then takes againCPU slowed down slightly, but not blockedNetwork card, audio streaming
Transparent / InterleavedDMA uses bus only when CPU is not using itZero CPU impact (uses idle bus cycles)Refresh, background transfers
Cycle Stealing โ€” Timing Diagram
  Bus Ownership Timeline:
  
  Time โ†’  T1   T2   T3   T4   T5   T6   T7   T8   T9   T10  T11  T12
         โ”Œโ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”
  Owner: โ”‚CPU โ”‚CPU โ”‚DMA โ”‚CPU โ”‚CPU โ”‚DMA โ”‚CPU โ”‚CPU โ”‚DMA โ”‚CPU โ”‚CPU โ”‚CPU โ”‚
         โ”‚    โ”‚    โ”‚ โ†‘  โ”‚    โ”‚    โ”‚ โ†‘  โ”‚    โ”‚    โ”‚ โ†‘  โ”‚    โ”‚    โ”‚    โ”‚
         โ””โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”˜
                    โ”‚              โ”‚              โ”‚
                   steal          steal          steal
                  1 word         1 word         1 word

  DMA "steals" one bus cycle, transfers one word,
  then gives bus back. CPU barely notices the slowdown.
Your laptop uses DMA right now! When you copy a file from USB to SSD, the DMA controller moves gigabytes of data directly between the USB controller and SSD controller through memory โ€” your CPU is free to play YouTube simultaneously. Without DMA, copying a 4 GB file would freeze your entire system.
Students think DMA completely eliminates CPU involvement. Not true! The CPU must initialize the DMA controller (set AR, WC, direction) and respond to the completion interrupt. DMA eliminates CPU involvement only during the actual data transfer. Think of it as delegating โ€” the boss (CPU) assigns the task and checks the result, but doesn't do the grunt work.

5. Input-Output Processor (IOP)

While DMA handles simple block transfers, complex I/O operations need a dedicated processor โ€” the I/O Processor (IOP), also called an I/O Channel.

Analogy: DMA is like a delivery boy who can carry packages from A to B. An IOP is like a logistics manager who can plan routes, handle returns, repackage items, manage multiple deliveries simultaneously, and make decisions without calling the CEO (CPU).

๐Ÿ”„ IOP Architecture

  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
  โ”‚          โ”‚  CMD    โ”‚    I/O Processor  โ”‚
  โ”‚   CPU    โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ถโ”‚    (Channel)      โ”‚
  โ”‚ (Main    โ”‚         โ”‚                   โ”‚
  โ”‚  Proc.)  โ”‚         โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
  โ”‚          โ”‚โ—€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚  โ”‚ Channel Cmd โ”‚  โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ–ถโ”‚ Device 1 โ”‚
  โ”‚          โ”‚  STATUS โ”‚  โ”‚ Word (CCW)  โ”‚  โ”‚       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜         โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
       โ”‚               โ”‚                   โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ–ถโ”‚ Device 2 โ”‚
       โ”‚               โ”‚  Own registers,   โ”‚       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  โ”Œโ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”         โ”‚  can execute      โ”‚       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
  โ”‚  Main    โ”‚โ—€โ•โ•โ•โ•โ•โ•โ•โ–ถโ”‚  channel programs โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ–ถโ”‚ Device 3 โ”‚
  โ”‚  Memory  โ”‚         โ”‚                   โ”‚       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Channel Command Word (CCW): The CPU sends a high-level command to the IOP (e.g., "Read 1000 records from disk into memory starting at address 0x5000"). The IOP breaks this into individual I/O operations, executes them independently, and notifies the CPU only when the entire operation is complete (or if an error occurs).

Types of I/O Channels

Channel TypeDescriptionUse Case
Multiplexer ChannelHandles multiple slow/medium devices simultaneously by interleaving bytesMultiple printers, card readers, terminals
Selector ChannelHandles one high-speed device at a time; dedicated until transfer completesMagnetic tape, disk drive
Block Multiplexer ChannelCombines both: handles multiple high-speed devices by interleaving blocksMultiple disks (mainframe environments)
India's banking core systems (Infosys Finacle, TCS BaNCS) run on IBM mainframes that use I/O channels extensively. When SBI processes millions of transactions daily, the IOP manages simultaneous disk reads/writes, printer operations, and network I/O โ€” all without burdening the main CPU.

6. Priority Interrupt System

When multiple devices request CPU attention simultaneously, who goes first? The priority interrupt system decides. It's like a hospital emergency room โ€” a heart attack patient gets treated before someone with a headache, even if the headache patient arrived first.

Daisy Chain Priority

Daisy Chain Priority Interrupt
                                    Priority: Highest โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ถ Lowest
  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
  โ”‚      โ”‚ PI  โ”‚ Device 0 โ”‚ PO  โ”‚ Device 1 โ”‚ PO  โ”‚ Device 2 โ”‚
  โ”‚      โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚ (Highest โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚ (Medium  โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚ (Lowest  โ”‚
  โ”‚ CPU  โ”‚     โ”‚ Priority)โ”‚     โ”‚ Priority)โ”‚     โ”‚ Priority)โ”‚
  โ”‚      โ”‚     โ”‚          โ”‚     โ”‚          โ”‚     โ”‚          โ”‚
  โ”‚      โ”‚โ—€โ•โ•โ•โ•โ•ชโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ชโ•โ•โ•โ•โ•โ•ชโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ชโ•โ•โ•โ•โ•โ•ชโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ชโ•โ•โ• INT Line
  โ”‚      โ”‚     โ”‚          โ”‚     โ”‚          โ”‚     โ”‚          โ”‚    (common
  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    wired-OR)

  INT = Interrupt Request (active when ANY device requests)
  PI  = Priority In (from CPU or previous device)
  PO  = Priority Out (to next device)

  Rule: A device can respond to the acknowledge signal
        ONLY if its PI input is active (1).
        If it has an interrupt pending, it blocks PO (sends 0).
        Otherwise, it passes PI through as PO.

  Example: If Device 1 and Device 2 both request simultaneously,
           Device 1 gets serviced first (it blocks PO to Device 2).

Parallel Priority Interrupt (Hardware)

Parallel Priority โ€” Using Priority Encoder
  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”
  โ”‚ Device 0 โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚                       โ”‚     โ”‚      โ”‚
  โ”‚ Device 1 โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚   Priority Encoder    โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚ CPU  โ”‚
  โ”‚ Device 2 โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚   (Combinational      โ”‚     โ”‚      โ”‚
  โ”‚ Device 3 โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚    Logic Circuit)     โ”‚     โ”‚ Gets โ”‚
  โ”‚ Device 4 โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚                       โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚vectorโ”‚
  โ”‚ Device 5 โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚  Outputs: highest     โ”‚     โ”‚numberโ”‚
  โ”‚ Device 6 โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚  priority device ID   โ”‚     โ”‚      โ”‚
  โ”‚ Device 7 โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚  as binary code       โ”‚     โ”‚      โ”‚
  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

  8 devices โ†’ 3-bit output (2ยณ = 8 combinations)
  ISR = Interrupt Service Routine (fetched from vector table)

  Advantage: Fastest โ€” all devices checked in ONE clock cycle
  Disadvantage: More hardware (encoder, mask register, etc.)

Software Poll

Instead of hardware priority, the CPU checks each device's status register in software, in a fixed order. The first device found with an interrupt pending gets serviced.

Assembly-style Pseudocode
; Software Polling Routine
POLL:   IN    STATUS_DEV0     ; Read Device 0 status
        BNZ   ISR_DEV0        ; If interrupt pending, jump to ISR
        IN    STATUS_DEV1     ; Read Device 1 status
        BNZ   ISR_DEV1
        IN    STATUS_DEV2     ; Read Device 2 status
        BNZ   ISR_DEV2
        IN    STATUS_DEV3
        BNZ   ISR_DEV3
        JMP   POLL            ; No device pending, keep polling
MethodSpeedHardware CostFlexibilityBest For
Daisy ChainMediumLow (just PI/PO wires)Fixed prioritySmall systems, microcontrollers
Parallel PriorityFast (1 cycle)High (encoder, mask reg)Programmable via maskHigh-performance CPUs, servers
Software PollSlow (sequential)Minimal (no extra HW)Fully flexible in softwareSimple embedded systems
GATE often asks: "In a daisy chain with 4 devices, if device 2 and device 3 raise interrupts simultaneously, which one gets serviced first?" Answer: Device 2 (closer to CPU = higher priority). The key insight: priority is determined by physical position in the chain.

7. Asynchronous Data Transfer โ€” Handshaking

In synchronous transfer, both sender and receiver are controlled by the same clock. But what if they run at different speeds? Asynchronous transfer uses a handshaking protocol โ€” a conversation of control signals that says "I'm sending" / "I received it" / "Send the next one."

Analogy: Think of handing a heavy box to someone. You don't just throw it โ€” you say "Ready?", they say "Ready!", you hand it over, they say "Got it!", then you pick up the next box. That's handshaking.

๐Ÿค Source-Initiated Strobe Handshaking

  Source (Sender)                     Destination (Receiver)
       โ”‚                                     โ”‚
       โ”‚โ”€โ”€ places data on bus โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ถโ”‚
       โ”‚                                     โ”‚
       โ”‚โ”€โ”€ sends STROBE pulse (โ†“) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ถโ”‚
       โ”‚                                     โ”‚โ”€โ”€ reads data from bus
       โ”‚                                     โ”‚โ”€โ”€ sends ACK (โ†‘)
       โ”‚โ—€โ”€โ”€ ACK received โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚
       โ”‚โ”€โ”€ removes data from bus             โ”‚
       โ”‚                                     โ”‚โ”€โ”€ removes ACK (โ†“)
       โ”‚                                     โ”‚
  
  Timing:
       Data โ”€โ”€โ”€โ”€โ”€โ”ฌโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
                 โ”‚   Valid Data      โ”‚
  STROBE โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
                                          โ”‚
  ACK โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”‚
                                     โ””โ”€โ”€โ”€โ”€โ”˜

๐Ÿค Full Handshaking (4-Phase)

  Phase  Source                      Destination         Signals
  โ”€โ”€โ”€โ”€โ”€  โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€      โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€      โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
    1    Places data on bus          โ€”                   DATA valid
         Sets DATA_VALID = 1        โ€”                   DV โ†‘

    2    โ€”                           Reads data          
         โ€”                           Sets DATA_ACK = 1   DA โ†‘

    3    Sees ACK, removes data     โ€”                   DV โ†“
         Sets DATA_VALID = 0        โ€”

    4    โ€”                           Sees DVโ†“            DA โ†“
         โ€”                           Sets DATA_ACK = 0

  Timing Diagram:
  DATA    โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  DATA_VALID โ”€โ”€โ”€โ”˜                   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  DATA_ACK โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
                     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                1    2    3    4    (phases)
India's Fastag (toll plaza RFID) uses asynchronous handshaking. The RFID reader sends a signal (strobe) to the tag, the tag responds with vehicle data (ACK), and the barrier lifts. If the handshake fails (wrong tag, insufficient balance), the system retries โ€” all within 2โ€“3 seconds at 30 km/h.

8. UART โ€” Universal Asynchronous Receiver-Transmitter

UART is the most common serial communication protocol. Every Arduino project, GPS module, Bluetooth module (HC-05), GSM module (SIM800), and even your computer's serial port uses UART.

Analogy: Think of UART like sending a telegram. You send one letter at a time (serial), with special "start" and "stop" markers so the receiver knows when a message begins and ends. You also include a check digit (parity) so the receiver can detect errors.

๐Ÿ“ก UART Frame Format

  UART Idle State: Line held HIGH (1)

  โ”Œโ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”
  โ”‚ ST โ”‚ D0โ”‚ D1โ”‚ D2โ”‚ D3โ”‚ D4โ”‚ D5โ”‚ D6โ”‚ D7โ”‚ Parity โ”‚ STOP โ”‚
  โ”‚ 0  โ”‚ b โ”‚ b โ”‚ b โ”‚ b โ”‚ b โ”‚ b โ”‚ b โ”‚ b โ”‚  bit   โ”‚  1   โ”‚
  โ””โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”˜
   โ†‘     โ†‘                                   โ†‘       โ†‘
   โ”‚     โ”‚                                   โ”‚       โ”‚
  Start  8 Data Bits                      Parity   Stop
  Bit    (LSB first)                      (Even/   Bit
  (0)                                      Odd)    (1)

  Total frame = 1 + 8 + 1 + 1 = 11 bits per character

  Example: Sending ASCII 'A' (0x41 = 0100 0001) with Even Parity

  โ”Œโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”
  โ”‚ 0 โ”‚ 1 โ”‚ 0 โ”‚ 0 โ”‚ 0 โ”‚ 0 โ”‚ 0 โ”‚ 1 โ”‚ 0 โ”‚ 0 โ”‚ 1 โ”‚
  โ”‚ S โ”‚D0 โ”‚D1 โ”‚D2 โ”‚D3 โ”‚D4 โ”‚D5 โ”‚D6 โ”‚D7 โ”‚ P โ”‚ SPโ”‚
  โ””โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”˜
       LSB โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ถ MSB
  
  D0โ€“D7 = 1,0,0,0,0,0,1,0 (binary of 0x41, LSB first)
  Parity = 0 (even parity: total 1s in data = 2, already even)
  
  Baud Rate = bits per second
  Common: 9600, 115200
  At 9600 baud: 1 character = 11 bits / 9600 = 1.146 ms
UART ParameterCommon ValueNotes
Baud Rate9600, 115200Bits per second (both sides must match)
Data Bits85, 6, 7, or 8 bits; 8 is standard
ParityNone / Even / OddError detection; optional
Stop Bits1 or 2Marks end of frame
Flow ControlNone / RTS-CTSHardware handshaking for fast transfers
For interviews and labs: "8N1" means 8 data bits, No parity, 1 stop bit โ€” the most common UART config. If someone says "9600 8N1", they mean baud rate 9600, 8 data bits, no parity, 1 stop bit. Total frame = 10 bits (1 start + 8 data + 0 parity + 1 stop).
Every Arduino project in every Indian engineering college uses UART. When you type Serial.begin(9600) in Arduino, you're configuring the UART module at 9600 baud. The Serial Monitor receives UART frames, strips the start/stop/parity bits, and shows you the ASCII characters.
Section D

Learn by Doing โ€” 3-Tier Lab Structure

๐ŸŸข Tier 1 โ€” GUIDED: Simulate UART Transmission in Python

โฑ๏ธ 45โ€“60 minutesBeginnerZero prior knowledge assumed

Objective:

Write a Python program that takes an ASCII character, converts it to a UART frame (Start + 8 Data + Parity + Stop), and displays the bit stream.

Step 1: Get the ASCII value

Python
char = input("Enter a character: ")
ascii_val = ord(char)
print(f"ASCII value of '{char}' = {ascii_val} (decimal) = {bin(ascii_val)} (binary)")

Step 2: Build the UART frame

Python
# Convert to 8-bit binary (LSB first for UART)
data_bits = format(ascii_val, '08b')[::-1]  # Reverse for LSB first

# Calculate even parity
ones_count = data_bits.count('1')
parity = '0' if ones_count % 2 == 0 else '1'

# Build frame: Start(0) + Data(8) + Parity(1) + Stop(1)
frame = '0' + data_bits + parity + '1'

print(f"\nUART Frame for '{char}':")
print(f"Start | Data (LSBโ†’MSB) | Parity | Stop")
print(f"  {frame[0]}   | {frame[1:9]}         |   {parity}    |  {frame[-1]}")
print(f"Complete frame: {frame} ({len(frame)} bits)")

Step 3: Calculate transmission time

Python
baud = 9600
bit_time = 1 / baud  # seconds per bit
frame_time = len(frame) * bit_time * 1000  # milliseconds
print(f"\nAt {baud} baud:")
print(f"Time per bit  = {bit_time*1000:.4f} ms")
print(f"Time per frame = {frame_time:.4f} ms")
print(f"Max characters/sec = {baud // len(frame)}")
Enter a character: A ASCII value of 'A' = 65 (decimal) = 0b1000001 (binary) UART Frame for 'A': Start | Data (LSBโ†’MSB) | Parity | Stop 0 | 10000010 | 0 | 1 Complete frame: 01000001001 (11 bits) At 9600 baud: Time per bit = 0.1042 ms Time per frame = 1.1458 ms Max characters/sec = 872

๐ŸŸก Tier 2 โ€” SEMI-GUIDED: DMA Transfer Simulator in C

โฑ๏ธ 60โ€“90 minutesIntermediateHints provided, you fill the gaps

Your Mission:

Simulate a DMA controller in C that transfers a block of data from a "device buffer" array to a "memory" array, word by word, while counting cycles.

Hints:

  1. Data Structures: Create struct DMA { int AR; int WC; int DR; int mode; }
  2. Device Buffer: int device_buffer[256] filled with random data
  3. Memory: int memory[1024] initialized to zero
  4. Transfer Loop: On each "cycle", copy device_buffer[i] โ†’ DMA.DR โ†’ memory[DMA.AR], then AR++, WC--
  5. Mode Switch: In burst mode, complete all transfers in one go. In cycle-stealing mode, interleave with "CPU work" prints
  6. Completion: When WC == 0, print "DMA INTERRUPT: Transfer Complete!"
Stretch Goal: Add a timer to measure actual execution time for burst vs cycle-stealing modes. Which is faster in total? Which gives better CPU availability?

๐Ÿ”ด Tier 3 โ€” OPEN CHALLENGE: Priority Interrupt Controller in Verilog/VHDL

โฑ๏ธ 2โ€“3 hoursAdvancedNo instructions โ€” real-world design

The Brief:

Design a priority interrupt controller for 8 devices using a priority encoder, interrupt mask register, and interrupt acknowledge logic. Implement in Verilog (or use Logisim for a visual approach).

  1. Inputs: 8 interrupt request lines (IR0โ€“IR7)
  2. Outputs: 3-bit interrupt vector, INT signal to CPU
  3. Mask Register: 8-bit register to enable/disable individual interrupts
  4. Priority Logic: IR0 = highest priority, IR7 = lowest
  5. Acknowledge: When CPU sends INTA, latch the current vector and clear the serviced interrupt
  6. Test: Simulate simultaneous interrupts on IR2 and IR5 โ€” verify IR2 is serviced first
This project is portfolio gold. A working priority interrupt controller on your GitHub (Verilog + testbench + waveforms) demonstrates hardware design skills valued at โ‚น6โ€“12 LPA entry-level roles at companies like Texas Instruments, Qualcomm, Intel, and Samsung India.
Section E

Practice Problems โ€” Diagrams, Numericals, Industry & GATE

๐Ÿ“ Diagram-Based Problems (D1โ€“D3)

D1

Draw the complete block diagram of a DMA controller showing AR, WC, DR, Control Logic, and its connections to CPU, Memory, and I/O device. Label all bus signals (BR, BG, Address Bus, Data Bus).

ApplyIntermediate
โœ… Refer to the DMA block diagram in Section C.4. Key signals: BR (Bus Request) from DMA to CPU, BG (Bus Grant) from CPU to DMA, bidirectional Data Bus, unidirectional Address Bus (DMA โ†’ Memory), and DRQ/DACK between DMA and device.
D2

Draw the daisy chain priority interrupt structure for 4 devices. Show the INT (wired-OR), PI, and PO connections. Indicate which device gets priority if Device 1 and Device 3 raise interrupts simultaneously.

ApplyIntermediate
โœ… Device 1 gets serviced first. In daisy chain, PI propagates from CPU โ†’ Device 0 โ†’ Device 1 โ†’ Device 2 โ†’ Device 3. Device 1 will see PI=1, block PO to Device 2/3, and respond to the interrupt acknowledge. Device 3 waits until Device 1's ISR completes.
D3

Draw a complete UART frame for transmitting the character 'M' (ASCII 77 = 0x4D = 01001101) with odd parity, 8 data bits, and 1 stop bit. Label each bit.

ApplyBeginner
โœ… Binary of 'M' = 01001101. LSB first: 1,0,1,1,0,0,1,0. Number of 1s in data = 4 (even). For odd parity, parity bit = 1 (to make total 1s odd = 5). Frame: [0] [1 0 1 1 0 0 1 0] [1] [1] = 0-10110010-1-1 (11 bits total).

๐Ÿ”ข Numerical Problems (N1โ€“N6)

N1

A DMA controller transfers data from a disk to memory. The disk transfer rate is 2 MB/s, memory cycle time is 40 ns, and the DMA uses cycle stealing. Calculate: (a) Number of memory cycles stolen per second, (b) Percentage of memory cycles stolen if CPU also uses memory at 20 million accesses/sec.

ApplyGATE Level
โœ… (a) Disk rate = 2 MB/s = 2 ร— 10โถ bytes/s. If word size = 1 byte, cycles stolen = 2 ร— 10โถ/s. (b) Total cycles available = 1/40ns = 25 ร— 10โถ/s. CPU needs 20M, DMA needs 2M, total = 22M. % stolen = (2M / 25M) ร— 100 = 8%. CPU is barely affected!
N2

A UART operates at 115200 baud with 8 data bits, even parity, and 1 stop bit. Calculate: (a) Time to transmit one character, (b) Maximum characters per second, (c) Effective data rate in bits/second (only data bits, not overhead).

ApplyIntermediate
โœ… (a) Frame = 1+8+1+1 = 11 bits. Time = 11/115200 = 95.49 ฮผs. (b) Max chars/sec = 115200/11 = 10,472 chars/sec. (c) Effective data rate = 10472 ร— 8 = 83,776 bps โ‰ˆ 83.8 kbps (only 72.7% of baud rate is useful data!).
N3

A system has a 32-bit data bus operating at 100 MHz. DMA transfers a 1 MB file from disk. Calculate: (a) Bus bandwidth in MB/s, (b) Minimum time for DMA burst transfer, (c) Number of bus cycles needed.

ApplyGATE Level
โœ… (a) Bandwidth = 32 bits ร— 100 MHz = 3200 Mbps = 400 MB/s. (b) Time = 1 MB / 400 MB/s = 2.5 ms. (c) Each cycle transfers 4 bytes (32 bits). Cycles = 1MB / 4B = 262,144 cycles.
N4

In a priority interrupt system with 4 devices, the ISR execution times are: Dev0 = 25 ฮผs, Dev1 = 40 ฮผs, Dev2 = 15 ฮผs, Dev3 = 30 ฮผs. If all four devices raise interrupts at t=0, and Dev0 has highest priority, what is the response time for each device?

AnalyzeIntermediate
โœ… Service order: Dev0 โ†’ Dev1 โ†’ Dev2 โ†’ Dev3. Response times: Dev0 = 0 ฮผs (immediate), Dev1 = 25 ฮผs (after Dev0), Dev2 = 65 ฮผs (after Dev0+Dev1), Dev3 = 80 ฮผs (after Dev0+Dev1+Dev2). Total = 110 ฮผs.
N5

A DMA controller has a 16-bit address register and 12-bit word count register. What is: (a) Maximum addressable memory, (b) Maximum block size per DMA transfer?

ApplyBeginner
โœ… (a) 16-bit AR โ†’ 2ยนโถ = 64 KB addressable. (b) 12-bit WC โ†’ 2ยนยฒ = 4096 words maximum per transfer. If word = 2 bytes, max block = 8 KB.
N6

A system uses cycle-stealing DMA. The CPU clock is 500 MHz, and the DMA steals 1 cycle every 10 ฮผs. What is the percentage slowdown of the CPU?

ApplyGATE Level
โœ… CPU cycle time = 1/500MHz = 2 ns. In 10 ฮผs = 10,000 ns, CPU executes 5000 cycles. DMA steals 1 cycle. Slowdown = 1/5000 ร— 100 = 0.02%. Negligible! This is why cycle stealing is preferred.

๐Ÿญ Industry Application Problems (I1โ€“I3)

I1

Aadhaar Biometric Authentication: An Aadhaar-enabled POS device captures a 300 KB fingerprint image. The biometric scanner uses DMA at a transfer rate of 5 MB/s. The authentication server responds in 150 ms via the network. Calculate the total time from scan to verification, assuming CPU processing takes 20 ms.

AnalyzeIndustry
โœ… DMA transfer time = 300 KB / 5 MB/s = 60 ms. Network round-trip = 150 ms. CPU processing = 20 ms. Total โ‰ˆ 60 + 20 + 150 = 230 ms. Real Aadhaar authentication targets ~200 ms โ€” engineers optimize each stage.
I2

ISRO Satellite Data: ISRO's Chandrayaan-3 orbiter sends scientific data at 8 Mbps. The onboard computer uses DMA with a 64-bit data bus at 50 MHz. Is the bus bandwidth sufficient? What percentage of bus capacity does the data link use?

EvaluateIndustry
โœ… Bus bandwidth = 64 bits ร— 50 MHz = 3200 Mbps = 3.2 Gbps. Data link = 8 Mbps. Usage = 8/3200 ร— 100 = 0.25%. Bus is vastly over-provisioned โ€” this is intentional for reliability in space applications.
I3

UPI Payment Terminal: A UPI terminal has: touchscreen (interrupt-driven), QR scanner (DMA), receipt printer (programmed I/O), and network module (DMA). Design the priority interrupt assignment and justify which device gets highest priority.

CreateIndustry
โœ… Priority (highest first): 1. Network module (time-critical for transaction), 2. QR scanner (DMA for image data), 3. Touchscreen (user input, moderate priority), 4. Printer (slowest, can wait). Justification: Network must complete transactions within timeout limits; printer is non-critical and can buffer.

๐ŸŽฏ GATE-Style Problems (G1โ€“G5)

G1 GATE

A device with a transfer rate of 10 KB/s is connected to a CPU via DMA. The CPU clock rate is 1 GHz, and one bus cycle takes 4 clock cycles. What fraction of CPU time is consumed by the DMA in cycle-stealing mode? [GATE 2015 Style]

Apply2 marks
โœ… Transfer rate = 10 KB/s = 10,240 bytes/s. Each DMA transfer steals 1 bus cycle = 4 clock cycles. Cycles stolen/sec = 10,240 ร— 4 = 40,960. CPU total cycles/sec = 10โน. Fraction = 40,960/10โน = 4.096 ร— 10โปโต โ‰ˆ 0.004%. Answer: Negligible fraction.
G2 GATE

Consider a system with memory-mapped I/O. The address space is 16 bits. If 1 KB is reserved for I/O ports, how many bytes of memory are addressable? [GATE 2018 Style]

Apply1 mark
โœ… Total address space = 2ยนโถ = 64 KB. I/O reserved = 1 KB. Memory addressable = 64 - 1 = 63 KB. In isolated I/O, the full 64 KB would be available for memory (separate I/O space).
G3 GATE

In a system with daisy-chained interrupt, which of the following is TRUE?
(A) The device closest to CPU has the lowest priority
(B) The device farthest from CPU has the highest priority
(C) Priority is determined by the physical position in the chain
(D) All devices have equal priority

Remember1 mark
โœ… Answer: (C) โ€” In daisy chain, the device closest to the CPU has the highest priority. Priority is inherently determined by physical position. The acknowledge signal passes through each device sequentially.
G4 GATE

A DMA controller is transferring a 64 KB block. The word size is 4 bytes, and each word transfer takes 100 ns (cycle stealing). What is the total DMA transfer time? [GATE 2020 Style]

Apply2 marks
โœ… Block = 64 KB = 65,536 bytes. Words = 65,536 / 4 = 16,384 words. Each word takes 100 ns. Total time = 16,384 ร— 100 ns = 1,638,400 ns = 1.638 ms โ‰ˆ 1.64 ms.
G5 GATE

A computer has 4 I/O devices. Device interrupt response times must satisfy: Dev A โ‰ค 50ฮผs, Dev B โ‰ค 100ฮผs, Dev C โ‰ค 200ฮผs, Dev D โ‰ค 500ฮผs. ISR times: A=30ฮผs, B=60ฮผs, C=40ฮผs, D=100ฮผs. Determine a valid priority ordering. Can all deadlines be met?

Evaluate2 marks
โœ… Assign priority by deadline (Rate Monotonic): A (highest) โ†’ B โ†’ C โ†’ D (lowest). Response times: A=0+30=30ฮผs โ‰ค 50 โœ…, B=30+60=90ฮผs โ‰ค 100 โœ…, C=90+40=130ฮผs โ‰ค 200 โœ…, D=130+100=230ฮผs โ‰ค 500 โœ…. All deadlines met!
Section F

MCQ Assessment Bank โ€” 30 Questions (Bloom's Mapped)

Remember / Identify (Q1โ€“Q6)

Q1

DMA stands for:

  1. Direct Memory Allocation
  2. Direct Memory Access
  3. Dynamic Memory Addressing
  4. Dual Mode Architecture
Remember
โœ… Answer: (B) Direct Memory Access โ€” A technique where data is transferred directly between I/O devices and memory without CPU intervention.
Q2

In isolated I/O, the CPU uses _____ instructions to communicate with I/O devices.

  1. MOV and ADD
  2. IN and OUT
  3. LOAD and STORE
  4. PUSH and POP
Remember
โœ… Answer: (B) IN and OUT โ€” Isolated I/O uses separate I/O instructions. Memory-mapped I/O uses regular memory instructions like MOV.
Q3

The start bit in a UART frame is always:

  1. Logic 1
  2. Logic 0
  3. Same as parity bit
  4. Depends on data
Remember
โœ… Answer: (B) Logic 0 โ€” The idle state is logic 1, so a transition to 0 marks the start of a new frame. The stop bit returns to logic 1.
Q4

Which register in the DMA controller holds the starting memory address for data transfer?

  1. Word Count Register (WC)
  2. Data Register (DR)
  3. Address Register (AR)
  4. Status Register (SR)
Remember
โœ… Answer: (C) Address Register (AR) โ€” AR holds the memory address where data will be written to (or read from). It increments after each word transfer.
Q5

In programmed I/O, the CPU checks device status using:

  1. Interrupts
  2. DMA
  3. Polling (busy-wait loop)
  4. Channel commands
Remember
โœ… Answer: (C) Polling โ€” The CPU repeatedly reads the device's status register in a loop until the device is ready. This wastes CPU cycles.
Q6

UART stands for:

  1. Universal Asynchronous Receiver-Transmitter
  2. Unified Address Register Transfer
  3. Universal Analog Relay Terminal
  4. Uniform Access Resource Table
Remember
โœ… Answer: (A) Universal Asynchronous Receiver-Transmitter โ€” It converts parallel data to serial for transmission and vice versa.

Understand / Explain (Q7โ€“Q12)

Q7

Why does DMA improve system performance compared to programmed I/O?

  1. DMA uses faster memory chips
  2. DMA bypasses the CPU during data transfer, freeing it for other tasks
  3. DMA increases the clock speed of the processor
  4. DMA eliminates the need for I/O devices
Understand
โœ… Answer: (B) โ€” DMA transfers data directly between device and memory. The CPU only initiates and handles the completion interrupt, leaving it free to execute other instructions during the transfer.
Q8

In memory-mapped I/O, I/O devices are treated as:

  1. Separate I/O ports with special instructions
  2. Memory locations accessible through regular memory instructions
  3. CPU registers
  4. External interrupt sources only
Understand
โœ… Answer: (B) โ€” I/O ports occupy addresses in the same address space as memory. Any instruction that can access memory (MOV, ADD, etc.) can also access I/O ports.
Q9

What is the purpose of the parity bit in a UART frame?

  1. To increase data transfer speed
  2. To detect single-bit transmission errors
  3. To encrypt the data
  4. To synchronize sender and receiver clocks
Understand
โœ… Answer: (B) โ€” Parity adds a bit to make the total number of 1s even (even parity) or odd (odd parity). If the received parity doesn't match, an error is detected.
Q10

In cycle stealing DMA, the CPU is:

  1. Completely halted during the entire transfer
  2. Slowed down slightly as DMA steals one bus cycle at a time
  3. Not affected at all
  4. Powered off to save energy
Understand
โœ… Answer: (B) โ€” DMA takes the bus for one word transfer, returns it, then steals again. The CPU experiences slight slowdown but is never fully blocked.
Q11

Why is handshaking necessary in asynchronous data transfer?

  1. To encrypt data between devices
  2. To ensure the receiver is ready before the sender transmits
  3. To increase the clock speed
  4. To convert serial data to parallel
Understand
โœ… Answer: (B) โ€” Without a common clock, sender and receiver use control signals (strobe, ACK) to coordinate. Handshaking prevents data loss when devices operate at different speeds.
Q12

In a daisy chain priority interrupt, the device closest to the CPU:

  1. Has the lowest priority
  2. Has the highest priority
  3. Has no priority advantage
  4. Cannot generate interrupts
Understand
โœ… Answer: (B) โ€” The acknowledge signal passes through each device sequentially. The first device in the chain intercepts it, giving it highest priority.

Apply / Calculate (Q13โ€“Q18)

Q13

A UART with 9600 baud, 8 data bits, no parity, and 1 stop bit can transmit at most _____ characters per second.

  1. 9600
  2. 960
  3. 1200
  4. 800
Apply
โœ… Answer: (B) 960 โ€” Frame = 1 start + 8 data + 0 parity + 1 stop = 10 bits. Characters/sec = 9600/10 = 960.
Q14

A DMA controller with a 16-bit word count register can transfer a maximum of:

  1. 32 KB
  2. 64 KB words
  3. 65,536 words
  4. 16 words
Apply
โœ… Answer: (C) 65,536 words โ€” 2ยนโถ = 65,536. The actual byte count depends on word size (e.g., 65,536 ร— 4 = 256 KB for 32-bit words).
Q15

If a disk transfers at 4 MB/s and DMA cycle stealing steals 1 cycle per word (word = 4 bytes), how many cycles are stolen per second?

  1. 4,000,000
  2. 1,000,000
  3. 16,000,000
  4. 500,000
Apply
โœ… Answer: (B) 1,000,000 โ€” Words/sec = 4 MB/s รท 4 B/word = 1,000,000 words/sec = 1M cycles stolen/sec.
Q16

In a system with 20-bit address space and memory-mapped I/O, 256 addresses are reserved for I/O. How much memory is available?

  1. 1 MB
  2. 1 MB โˆ’ 256 bytes
  3. 1,048,320 bytes
  4. Both B and C
Apply
โœ… Answer: (D) โ€” 2ยฒโฐ = 1,048,576 bytes total. Memory available = 1,048,576 โˆ’ 256 = 1,048,320 bytes = 1 MB โˆ’ 256 bytes. Both B and C express the same value.
Q17

A priority encoder with 8 inputs requires how many output bits to represent the highest-priority active input?

  1. 2
  2. 3
  3. 4
  4. 8
Apply
โœ… Answer: (B) 3 โ€” โŒˆlogโ‚‚(8)โŒ‰ = 3 bits needed to encode 8 different device IDs (000 to 111).
Q18

A DMA burst transfer of 256 words on a bus with 50 ns cycle time takes:

  1. 12.8 ฮผs
  2. 5.12 ฮผs
  3. 256 ฮผs
  4. 0.05 ฮผs
Apply
โœ… Answer: (A) 12.8 ฮผs โ€” 256 words ร— 50 ns/word = 12,800 ns = 12.8 ฮผs.

Analyze / Compare (Q19โ€“Q24)

Q19

Which data transfer mode would be most appropriate for a high-definition video camera streaming at 300 MB/s?

  1. Programmed I/O
  2. Interrupt-driven I/O
  3. DMA with burst mode
  4. Software polling
Analyze
โœ… Answer: (C) โ€” At 300 MB/s, neither programmed I/O nor interrupt-driven can keep up (CPU overhead too high). DMA burst mode transfers large video frames directly to memory at full bus speed.
Q20

Compared to daisy chain, parallel priority interrupt has:

  1. Lower hardware cost but slower response
  2. Higher hardware cost but faster response
  3. Same cost and same speed
  4. Lower cost and faster speed
Analyze
โœ… Answer: (B) โ€” Parallel priority uses a hardware encoder (more gates, flip-flops, mask register) but resolves priority in one clock cycle. Daisy chain is cheaper but the acknowledge must propagate through the chain sequentially.
Q21

Memory-mapped I/O is preferred over isolated I/O when:

  1. The system needs maximum memory address space
  2. The system needs to perform arithmetic operations on I/O data
  3. The system has very few I/O devices
  4. Both B and C
Analyze
โœ… Answer: (D) โ€” Memory-mapped I/O allows any ALU instruction on I/O data (not just IN/OUT). It's preferred when few I/O ports are needed (so memory loss is minimal) and when flexible I/O manipulation is required.
Q22

A selector channel differs from a multiplexer channel in that:

  1. Selector handles one device at a time; multiplexer handles many simultaneously
  2. Selector handles many devices; multiplexer handles one
  3. Both handle the same number of devices
  4. Selector is slower than multiplexer
Analyze
โœ… Answer: (A) โ€” A selector channel is dedicated to one high-speed device until the transfer completes. A multiplexer channel interleaves bytes from multiple low/medium-speed devices.
Q23

In DMA cycle stealing vs burst mode, which statement is TRUE?

  1. Burst mode gives better CPU utilization
  2. Cycle stealing gives better CPU utilization but slower total transfer
  3. Both give equal CPU utilization
  4. Cycle stealing blocks the CPU completely
Analyze
โœ… Answer: (B) โ€” Cycle stealing lets the CPU use the bus between stolen cycles, so CPU utilization is better. But the total transfer takes longer because of the interleaving overhead.
Q24

Strobe-based handshaking vs full handshaking: which is more reliable and why?

  1. Strobe โ€” because it uses fewer signals
  2. Full handshaking โ€” because both sides confirm every phase of transfer
  3. Both are equally reliable
  4. Neither is reliable for high-speed transfers
Analyze
โœ… Answer: (B) โ€” Full handshaking has 4 phases with mutual confirmation. Strobe only sends a pulse โ€” if the receiver misses it, data is lost. Full handshaking guarantees delivery at the cost of slightly more time.

Evaluate & Create (Q25โ€“Q30)

Q25

A system designer must choose between DMA burst mode and cycle stealing for a network card receiving 100 Mbps Ethernet. Which is more suitable and why?

  1. Burst mode โ€” to transfer each Ethernet frame in one shot
  2. Cycle stealing โ€” to avoid blocking CPU during continuous network traffic
  3. Programmed I/O โ€” network speeds are manageable
  4. No DMA needed โ€” interrupt-driven is sufficient
Evaluate
โœ… Answer: (B) โ€” Network traffic is continuous and bursty. Cycle stealing allows the CPU to handle TCP/IP processing between DMA transfers. Burst mode would block the CPU during each frame, causing unacceptable latency for real-time networking.
Q26

An embedded system has a temperature sensor (1 reading/sec), a motor controller (100 commands/sec), and an SD card logger (1 MB/min). Assign optimal data transfer modes.

  1. All three use DMA
  2. Sensor: Polling, Motor: Interrupt, SD card: DMA
  3. All three use interrupts
  4. Sensor: DMA, Motor: Polling, SD card: Interrupt
Evaluate
โœ… Answer: (B) โ€” Sensor at 1/sec is so slow that polling is fine. Motor at 100/sec benefits from interrupts (timely response without polling waste). SD card at 1 MB/min involves large block transfers best suited for DMA.
Q27

If you're designing a UART for an IoT device that must work at extreme distances (200m+), which modification would improve reliability?

  1. Increase baud rate to 1 Mbps
  2. Use differential signaling (RS-485) instead of single-ended UART
  3. Remove parity bit to reduce overhead
  4. Reduce data bits to 5
Evaluate
โœ… Answer: (B) โ€” RS-485 uses differential signaling (two wires, comparing voltage difference) which is resistant to noise over long distances. Standard UART (single-ended) is limited to ~15m.
Q28

Design a priority scheme for 4 devices: Keyboard (slow), Disk (fast, bulk), Network (medium, real-time), Timer (critical). What is the optimal priority order?

  1. Timer > Network > Disk > Keyboard
  2. Keyboard > Timer > Network > Disk
  3. Disk > Network > Timer > Keyboard
  4. Network > Disk > Keyboard > Timer
Create
โœ… Answer: (A) Timer > Network > Disk > Keyboard โ€” Timer interrupts are critical for OS scheduling and must never be missed. Network needs real-time response for packet processing. Disk is fast but can buffer. Keyboard is the slowest and most tolerant of delay.
Q29

You're building an Arduino-based weather station. Which I/O concepts from this chapter would you use for: (1) reading a temperature sensor every 5 seconds, (2) logging data to an SD card, (3) sending data over Bluetooth (HC-05)?

  1. All polling
  2. (1) Timer interrupt, (2) SPI with DMA, (3) UART interrupt
  3. All DMA
  4. (1) DMA, (2) Polling, (3) DMA
Create
โœ… Answer: (B) โ€” Timer interrupt triggers sensor reading at precise intervals. SD card uses SPI protocol with DMA for efficient block writes. Bluetooth HC-05 communicates via UART with interrupt-driven reception for incoming commands.
Q30

A company needs an I/O system for an ATM machine: card reader, keypad, receipt printer, screen, network module, and cash dispenser motor. Which combination of transfer modes and priority interrupts would you recommend?

  1. All devices on programmed I/O with round-robin polling
  2. Network & card reader on DMA; keypad & screen on interrupt; printer & motor on programmed I/O; Priority: Network > Card > Keypad > Motor > Screen > Printer
  3. All devices on DMA with daisy chain
  4. All devices on interrupt with no priority
Create
โœ… Answer: (B) โ€” Network requires fast, reliable data transfer (DMA). Card reader transfers magnetic stripe/chip data blocks (DMA). Keypad and screen are event-driven (interrupt). Printer and motor are slow, sequential operations (programmed I/O). Priority reflects criticality: network transaction > card security > user input > physical actuators.
Section G

Short Answer Questions (8 Questions)

SA1

Differentiate between Memory-Mapped I/O and Isolated I/O with one example each. (4 marks)

Memory-Mapped I/O: I/O ports share the same address space as memory. CPU uses regular instructions (MOV, ADD) to access devices. Example: ARM-based Raspberry Pi โ€” GPIO registers are mapped to memory addresses like 0x3F200000. Advantage: Any instruction works. Disadvantage: Reduces available memory addresses.

Isolated I/O: I/O ports have a separate address space. CPU uses special IN/OUT instructions. Example: Intel x86 PCs โ€” keyboard port at I/O address 0x60. Advantage: Full memory space preserved. Disadvantage: Limited to IN/OUT instructions only.

SA2

Explain the handshaking mechanism in asynchronous data transfer with a timing diagram. (5 marks)

Handshaking is a protocol where sender and receiver exchange control signals to synchronize data transfer without a common clock. The 4-phase handshake: (1) Source places data and raises DATA_VALID, (2) Destination reads data and raises DATA_ACK, (3) Source sees ACK, removes data, lowers DATA_VALID, (4) Destination sees DV low, lowers DATA_ACK. Each phase waits for the other side's response, ensuring reliable transfer regardless of speed mismatch. See timing diagram in Section C.7.

SA3

What are the three modes of DMA transfer? Compare them briefly. (4 marks)

Burst Mode: DMA holds bus for entire block. CPU fully blocked. Fastest total transfer. Used for disk reads.

Cycle Stealing: DMA takes one bus cycle per word, then returns bus to CPU. CPU slightly slowed. Best for streaming devices like network cards.

Transparent/Interleaved: DMA uses bus only during CPU idle cycles. Zero CPU impact. Slowest overall but no CPU interference.

SA4

Draw and explain the UART frame format for transmitting 'Z' (ASCII 90) with even parity. (5 marks)

ASCII 'Z' = 90 = 0x5A = 01011010 binary. LSB first: 0,1,0,1,1,0,1,0. Count of 1s = 4 (even). For even parity, parity bit = 0 (already even). Frame: Start(0) + Data(01011010 LSB first) + Parity(0) + Stop(1) = 0-01011010-0-1 = 11 bits. At 9600 baud, transmission time = 11/9600 = 1.146 ms.

SA5

List the registers in a DMA controller and state the function of each. (4 marks)

Address Register (AR): Holds the memory address where data is to be transferred. Incremented after each word transfer.

Word Count Register (WC): Holds the number of words to transfer. Decremented after each transfer. When WC=0, transfer complete.

Data Register (DR): Temporary buffer holding one word during transit between device and memory.

Control Register: Specifies direction (read/write), DMA mode (burst/cycle stealing), enable/disable, and interrupt enable.

SA6

Compare daisy chain and parallel priority interrupt mechanisms. Which is faster? (4 marks)

Daisy Chain: Devices connected in series. Acknowledge signal cascades through chain. Priority = physical position (closest to CPU = highest). Simple hardware (just PI/PO wires). Fixed priority. Slower for many devices.

Parallel Priority: All devices connect to a priority encoder simultaneously. Resolves priority in one clock cycle using combinational logic. Requires more hardware (encoder, mask register). Programmable priority via mask. Much faster โ€” O(1) vs O(n) for daisy chain.

SA7

Explain the concept of cycle stealing in DMA with a timing example. (4 marks)

In cycle stealing, the DMA controller "steals" one bus cycle from the CPU to transfer one word, then returns bus control. Example: CPU clock = 100 MHz (10 ns cycle). DMA needs to transfer 1 word every 1 ฮผs (device rate). In 1 ฮผs = 100 CPU cycles, DMA steals 1 cycle. CPU slowdown = 1/100 = 1%. The CPU continues executing instructions during the 99 unstolen cycles, making cycle stealing nearly transparent.

SA8

What is an I/O Processor (IOP)? How does it differ from a DMA controller? (5 marks)

IOP is a dedicated processor that handles all I/O operations independently. It has its own instruction set (channel commands), can execute I/O programs, manage multiple devices, perform error handling, and make decisions โ€” all without CPU intervention.

Key differences: DMA transfers data blocks passively (no decision-making). IOP can execute programs, handle errors, manage device queues, and perform data formatting. DMA is simpler and cheaper; IOP is a full processor dedicated to I/O. DMA needs CPU to initialize each transfer; IOP needs CPU only for high-level commands.

Section H

Long Answer Questions (3 Questions)

LA1

Explain the complete working of a DMA controller with a neat block diagram. Describe the DMA transfer sequence (initialization, request, acknowledge, transfer, completion). Discuss burst mode vs cycle stealing with timing diagrams and calculate the CPU slowdown for a given configuration: disk at 10 MB/s, 32-bit bus, 200 MHz clock. (15 marks)

Block Diagram: DMA controller contains AR, WC, DR, Control Logic. Connected to CPU via BR/BG lines, to system bus (Address + Data + Control), and to device via DRQ/DACK. See Section C.4 for complete diagram.

Transfer Sequence: (1) CPU loads AR, WC, direction into DMA registers. (2) Device raises DRQ when data ready. (3) DMA raises BR (Bus Request) to CPU. (4) CPU completes current cycle, sends BG (Bus Grant). (5) DMA places AR on address bus, transfers data between device and memory. (6) AR incremented, WC decremented. (7) Repeat until WC=0. (8) DMA sends interrupt to CPU โ€” transfer complete.

Burst vs Cycle Stealing: Burst holds bus for all N transfers continuously. Cycle stealing takes bus for 1 transfer, returns, repeats. Burst is faster total but blocks CPU. Cycle stealing has better CPU utilization.

Calculation: Disk = 10 MB/s = 10ร—10โถ bytes/s. Bus width = 32 bits = 4 bytes. Words/sec = 10M/4 = 2.5M. CPU clock = 200 MHz = 200M cycles/s. If each DMA transfer = 1 bus cycle, cycles stolen = 2.5M/s. Slowdown = 2.5M/200M = 1.25%.

LA2

Compare and contrast the three methods of data transfer: Programmed I/O, Interrupt-driven I/O, and DMA. For each method, draw the data flow path, explain the algorithm, discuss advantages and disadvantages, and provide real-world examples. Include a comprehensive comparison table. (15 marks)

Programmed I/O: Data path: Device โ†’ CPU โ†’ Memory. Algorithm: CPU reads status in loop โ†’ reads data โ†’ stores to memory. Advantage: Simple hardware. Disadvantage: CPU stuck in polling loop. Example: Old dot-matrix printer, simple embedded keypad.

Interrupt-Driven I/O: Data path: Device โ†’ CPU (via ISR) โ†’ Memory. Algorithm: Device raises interrupt โ†’ CPU saves context โ†’ executes ISR โ†’ reads data โ†’ stores to memory โ†’ restores context. Advantage: CPU free between interrupts. Disadvantage: Context switch overhead. Example: Mouse, UART serial port, keyboard.

DMA: Data path: Device โ†’ Memory (bypasses CPU). Algorithm: CPU initializes DMA โ†’ DMA requests bus โ†’ transfers data โ†’ interrupts CPU on completion. Advantage: Highest throughput, minimal CPU load. Disadvantage: Complex hardware, DMA controller cost. Example: Disk, SSD, network card, video capture.

See comparison table in Section C.3 for detailed feature-by-feature comparison.

LA3

Explain the priority interrupt system in detail. Describe (a) Daisy Chain priority with diagram, (b) Parallel priority using priority encoder, (c) Software polling method. Compare all three methods and design a priority interrupt system for a computer with 6 peripheral devices. (15 marks)

(a) Daisy Chain: Devices connected in series via PI/PO lines. Common INT line (wired-OR) goes to CPU. When CPU sends acknowledge, it passes through chain. First device with pending interrupt captures it, blocks propagation. Priority = position. Diagram shows CPU โ†’ Dev0(PIโ†’PO) โ†’ Dev1(PIโ†’PO) โ†’ Dev2 โ†’ ... with common INT line.

(b) Parallel Priority: All 6 devices connect to a priority encoder. Encoder outputs 3-bit vector of highest-priority active device. Mask register enables/disables individual interrupts. Interrupt status register stores pending interrupts. Resolution time = 1 clock cycle. Hardware: 8-to-3 encoder, 8-bit mask register, AND gates, comparator.

(c) Software Polling: CPU sequentially reads each device's status register. First device found with interrupt flag set is serviced. Priority = order of polling. No extra hardware. Slowest method.

Design for 6 devices: Use parallel priority encoder (8-input, 6 used). Assign priorities based on urgency: Timer(0) > Network(1) > Disk(2) > Serial(3) > Keyboard(4) > LED Display(5). Mask register allows runtime priority changes.

Section I

Industry Spotlight โ€” A Day in the Life

๐Ÿ‘ฉโ€๐Ÿ’ป Meera Nair, 27 โ€” Embedded Systems Engineer at Texas Instruments, Bangalore

Background: B.Tech ECE from NIT Calicut. Fascinated by microcontrollers in 3rd year. Built an IoT weather station using Arduino and ESP32 as her final-year project. Got placed at TI through campus recruitment after acing the hardware design round.

A Typical Day:

8:30 AM โ€” Morning stand-up with the MSP430 microcontroller team. Review yesterday's Verilog simulation results for a new DMA controller IP block.

9:30 AM โ€” Write RTL (Register Transfer Level) code in Verilog for a priority interrupt controller that supports 16 interrupt sources with programmable priority and nested interrupts.

11:00 AM โ€” Run gate-level simulations. Check timing analysis โ€” does the DMA controller meet the 100 MHz clock target? Fix a setup time violation on the address register path.

12:30 PM โ€” Lunch at TI's campus cafeteria in Outer Ring Road, Bangalore. Chat about upcoming tapeout deadline.

1:30 PM โ€” Debug a UART module that's dropping characters at 921600 baud. Root cause: FIFO buffer overflow. Fix: increase FIFO depth from 16 to 64 bytes.

3:30 PM โ€” Code review with senior architect. Discuss trade-offs between cycle-stealing DMA and burst DMA for the new industrial sensor interface.

5:00 PM โ€” Write test vectors for the I/O subsystem. Simulate multiple devices raising interrupts simultaneously โ€” verify priority encoding works correctly.

6:00 PM โ€” Learning hour: study AXI bus protocol (ARM's advanced I/O bus used in modern SoCs).

DetailInfo
Tools Used DailyVerilog/SystemVerilog, Synopsys VCS, Cadence Genus, Logic Analyzers, Oscilloscopes
Entry Salary (2025)โ‚น8โ€“12 LPA + benefits (TI is among the best-paying for fresh grads)
Mid-Level (3โ€“5 yrs)โ‚น15โ€“25 LPA
Senior (7+ yrs)โ‚น30โ€“50 LPA
Key SkillsVerilog, VHDL, I/O architecture, DMA design, interrupt handling, UART/SPI/I2C protocols
Companies HiringTexas Instruments, Qualcomm, Intel, Samsung, MediaTek, ISRO, DRDO, Analog Devices, Microchip, NXP
Meera's advice to students: "I/O Organization was the most boring chapter in my textbook. But when I actually designed a DMA controller in my first week at TI, I realised it's the most practical chapter in all of COA. Every chip we design has I/O ports, interrupts, and DMA. Learn the concepts, then build something โ€” even a blinking LED with interrupts on Arduino counts."
Section J

Earn With It โ€” IoT & Embedded Projects

๐Ÿ’ฐ Your Earning Path After This Chapter

Portfolio Pieces You Can Build:

โ€ข UART Communication Logger โ€” Arduino reads sensors, sends data via UART to a PC dashboard โ€” โ‚น2,000โ€“โ‚น5,000 freelance projects

โ€ข DMA Transfer Simulator โ€” Python/C visualization of DMA with performance graphs โ€” Portfolio showcase for TI/Qualcomm interviews

โ€ข Priority Interrupt Controller โ€” Verilog project on GitHub โ€” โ‚น6โ€“12 LPA job applications in VLSI design

Project IdeaSkills NeededEarning Potential
IoT Sensor StationArduino + UART + I2C + WiFiโ‚น3,000โ€“โ‚น10,000/project on Freelancer.in
Home Automation SystemESP32 + GPIO interrupts + relay controlโ‚น5,000โ€“โ‚น15,000/installation
Industrial Data LoggerRS-485 (UART variant) + SD card (DMA) + sensorsโ‚น10,000โ€“โ‚น30,000/project for factories
Verilog IP Blocks on OpenCoresVerilog/VHDL + I/O controller designResume gold for โ‚น8โ€“12 LPA VLSI jobs
PCB Design with I/OKiCad + UART/SPI/I2C headers + DMA-capable MCUโ‚น5,000โ€“โ‚น20,000/board design on Fiverr
India's IoT market is expected to reach $15 billion by 2027 (NASSCOM). Every IoT device uses UART, DMA, and interrupts. If you can build a working sensor-to-cloud pipeline using an ESP32 and demonstrate it on YouTube/LinkedIn, you become instantly hireable for IoT roles at Bosch India, Honeywell, ABB, or L&T Technology Services.

โฑ๏ธ Time to First Earning: 3โ€“4 weeks (build an IoT project + create a portfolio on GitHub + apply on Internshala for embedded systems internships)

Section K

Chapter Summary

๐Ÿ“‹ Key Takeaways โ€” Unit 5: I/O Organization

  • Peripheral Devices communicate with the CPU through I/O interfaces that handle speed matching, format conversion, and device selection.
  • I/O Interface sits between CPU bus and device. Two addressing schemes: Memory-Mapped I/O (shared address space, any instruction) and Isolated I/O (separate space, IN/OUT instructions).
  • Three Data Transfer Modes:
    • Programmed I/O โ€” CPU polls device status in a loop (simplest, least efficient)
    • Interrupt-Driven I/O โ€” Device signals CPU when ready (better efficiency)
    • DMA โ€” Hardware controller transfers data directly to memory (best for high-speed devices)
  • DMA Controller has AR, WC, DR, and Control registers. Supports burst mode (fastest transfer, CPU blocked), cycle stealing (interleaved, CPU slightly slowed), and transparent mode (uses idle cycles).
  • I/O Processor (IOP) is a dedicated processor for complex I/O operations. Types: Multiplexer Channel, Selector Channel, Block Multiplexer Channel.
  • Priority Interrupts resolve simultaneous device requests. Methods: Daisy Chain (hardware, simple, fixed priority), Parallel Priority (fast, encoder-based), Software Poll (flexible, slow).
  • Asynchronous Transfer uses handshaking (strobe + ACK) for devices without a common clock.
  • UART transmits serial data with Start + 8 Data + Parity + Stop bits. Common config: 9600 baud, 8N1.
Everything in this chapter powers India's digital infrastructure: Aadhaar biometric scanners (DMA), UPI payment terminals (UART + interrupts), ISRO satellites (priority interrupts), Vande Bharat train control systems (real-time I/O), and the 600,000+ ATMs across India (DMA + interrupt-driven I/O).
Section L

Earning Checkpoint

Skill LearnedTool / MethodPortfolio ArtifactCan You Earn?
I/O Addressing (Mem-mapped vs Isolated)Conceptual + ARM/x86 comparisonโ€”โœ… Yes โ€” interview topic for embedded jobs
Data Transfer ModesConceptual comparisonComparison chart / notesโœ… Yes โ€” GATE + interview essential
DMA ArchitectureBlock diagrams + numericalsDMA Simulator (C/Python)โœ… Yes โ€” portfolio for TI/Qualcomm roles
UART ProtocolPython simulation + ArduinoUART Frame Generator programโœ… Yes โ€” IoT freelance projects
Priority InterruptsVerilog / LogisimInterrupt Controller on GitHubโœ… Yes โ€” VLSI design jobs โ‚น8โ€“12 LPA
Handshaking ProtocolTiming diagramsโ€”โœ… Yes โ€” embedded systems interviews
IOP / Channel ArchitectureConceptual (mainframe focus)โ€”โฌœ Niche โ€” relevant for IBM/HCL mainframe roles
IoT IntegrationArduino/ESP32 + sensors + UARTIoT Weather Station projectโœ… Yes โ€” โ‚น3,000โ€“โ‚น15,000/project
Minimum Viable Earning Setup after this chapter: An Arduino/ESP32 IoT project on GitHub + a UART simulator in Python + an Internshala profile listing "Embedded Systems / IoT" = you can earn โ‚น3,000โ€“โ‚น10,000/month from IoT freelance projects while still in college. For VLSI roles, add a Verilog interrupt controller and apply to TI, Qualcomm, Intel campus placements.

โœ… Unit 5 complete. You've mastered I/O Organization!

[QR: Link to EduArtha video tutorial โ€” I/O Organization]