GateMCQSCIENTIFIC PREP LAB
PlanSign Up
INTERMEDIATEFrequently Tested 4 min read 21 views

Addressing Modes, Hardwired vs Microprogrammed Control Unit & DMA I/O

Effective address computation for PC-relative and indexed modes, horizontal vs vertical microinstructions control store size, and DMA cycle-stealing CPU slowdown.

1. Machine Addressing Modes & Relocation

Addressing ModeEffective Address (EA)Primary Compiler / OS Use Case
ImmediateOperand inside instructionConstants (MOV R1, #42)
Register IndirectEA=[Ri]EA = [R_i]Pointers in C (*ptr)
Base + Displacement / IndexedEA=[Rb]+OffsetEA = [R_b] + \text{Offset}Array indexing A[i] & struct fields
PC-RelativeEA=PCnext+OffsetEA = \text{PC}_{\text{next}} + \text{Offset}Position-Independent Code (PIC) & short branches
Auto-Increment / DecrementEA=[Ri];  Ri←Ri±dEA = [R_i];\; R_i \leftarrow R_i \pm dStack PUSH / POP & loop traversal
Common Exam Mistake

Classic GATE PC-Relative Trap: If a 4-byte branch instruction sits at byte address 10001000 with signed offset −16-16, when the ALU computes the target, PC\text{PC} already equals 1000+4=10041000 + 4 = 1004. Thus Target =1004+(−16)=988= 1004 + (-16) = 988 (NOT 984984!).

2. Hardwired vs Microprogrammed Control Unit

  • Hardwired Control: Combinational logic gates driven by state counter + IR opcode; fastest clock rate, used in RISC processors.
  • Microprogrammed Control: Stores microinstructions in Control ROM.
    • Horizontal Microprogramming: 1 bit per control signal (NN signals = NN bits); maximum parallelism, zero decoder delay.
    • Vertical Microprogramming: Mutually exclusive micro-operations grouped into fields of ⌈log⁡2(mi+1)⌉\lceil \log_2(m_i + 1) \rceil bits (+1 for NO-OP!).

3. Interrupts vs Direct Memory Access (DMA)

In Cycle Stealing DMA, if a device generates data at RR bytes/sec, transfers ww bytes per bus cycle, and each DMA bus steal stalls the CPU for tstealt_{\text{steal}} seconds:

% CPU Slowdown ( Bus Utilization )=tstealtprep×100%,tprep=wR\%\text{ CPU Slowdown ( Bus Utilization )} = \frac{t_{\text{steal}}}{t_{\text{prep}}} \times 100\%, \quad t_{\text{prep}} = \frac{w}{R}
Key Formulas Summary
PC-Relative Branch Target Address
Target EA=(PCcurrent+Instruction Length)+Signed Offset\text{Target EA} = (\text{PC}_{\text{current}} + \text{Instruction Length}) + \text{Signed Offset}
Note: PC is ALWAYS incremented to point to the NEXT instruction before adding offset!
Control Memory Size (Microprogrammed CU)
Size=2k×W bits,W=Control Word Bits+Condition Bits+k\text{Size} = 2^k \times W \text{ bits}, \quad W = \text{Control Word Bits} + \text{Condition Bits} + k
Note: Horizontal = unencoded (fast, wide); Vertical = encoded decoders (compact, slower)
#COA#Addressing Modes#Microprogrammed Control#DMA#Interrupts#GATE CS

Practice Questions on This Chapter (4)

Q1GATE CS COAMCQMEDIUM
+2M • -0.67

A 4-byte PC-relative branch instruction is stored in memory starting at byte address 20002000. If the signed displacement field inside the instruction equals −24-24, what is the branch target byte address?

⚡ Click an option above to verify instantly
Q2UGC NET / GATE COAMCQEASY
+1M • -0.33

Which machine addressing mode is best suited for writing relocatable / position-independent code at runtime?

⚡ Click an option above to verify instantly
Q3GATE CS 2022MCQEASY
+1M • -0.33

Which machine addressing mode is ideal for implementing position-independent relocatable code and conditional BRANCH instructions at runtime?

⚡ Click an option above to verify instantly
Q4GATE CS 2017NATMEDIUM
+2M • 0 Neg

A horizontal microprogrammed control unit controls 4040 distinct single-bit control signals, supports 6464 microinstructions in control memory, and selects among 1515 status flags plus 11 unconditional input (1616-to-11 condition MUX). Using unencoded control signals, what is the width (in bits) of each microinstruction word?

Previous Topic5-Stage Instruction Pipelining, Hazards & Cache Mapping Bit MathNext Topic COA 2027 Rank-Decider: Write-Back Dirty Evictions, VIPT Cache Constraint & 2-Bit Branch Predictors