Lesson 6 — Intermediate
Control Unit (Hardwired & Microprogrammed)
Instruction fetch ho gayi, decode ho gaya — ab kaun decide karega ki kaunsa register padhein, kaunsa bus enable ho, ALU kya kare? Control Unit. Is lesson mein hum dekhenge CU ke signals kaise bante hain, hardwired aur microprogrammed dono styles ka farak, aur microprogramming ka poora khel.
Control Unit kya hai
WHAT
Control Unit (CU) CPU ka conductor hai — instruction padh kar saare control signals (read, write, register load, ALU op, bus enable) generate karta hai taaki instruction sahi sequence mein execute ho. Khud data process nahi karta.
WHEN
Har instruction ke har step pe — fetch se lekar write-back tak. Jitne bhi control signals jaate hain, wo CU se hi nikalte hain.
WHERE
CPU ke andar, ALU ke saath. CU ke do tarike hain — hardwired (circuit) aur microprogrammed (stored program).
Ek line mein: ALU karta hai, CU batata hai kab kya karna hai. CU ke paas instruction ka decode hota hai aur wo timing ke saath control signals baantta hai — bilkul railway station master jaisa.
Control signals aur timing
Common control signals :
MemRead / MemWrite → memory padho ya likho
RegRead / RegWrite → register file access
ALUSrc, ALUOp → ALU ka input source aur operation
PCWrite, IorD, MtoReg → PC update, bus select, result select
BusRd/Wr, IRQAck → bus aur interrupt handshake
Instruction ADD R1, R2, R3 ka control sequence :
T1 : PC → MAR, MemRead (fetch ka address)
T2 : MDR → IR, PC = PC + 1 (instruction aayi)
T3 : decode → R2, R3 padho (register read)
T4 : ALU = R2 + R3 (execute)
T5 : result → R1 (write back)
Har step = ek clock cycle (single-cycle) ya pipeline stage
Hardwired control unit
- Control signals combinational logic circuits se bante hain (gates, decoders, flip-flops).
- Fast — kyunki koi memory access nahi, seedha circuit output.
- Rigid: design badalna = circuit badalna — naya instruction set aaya toh chip dobara.
- FSM-based: state machine (states = timing steps) control banati hai.
- Modern RISC processors isse chalte hain (simple instruction set, tez zaroorat).
Hardwired flow :
IR (opcode) → Decoder → Logic gates → Control signals
Timing counter → kaun sa step chal raha hai
Faida : SPEED (no lookup), Cost : flexibility
RISC style : simple fixed instructions → circuit manageable
Microprogrammed control unit
Idea : har machine instruction ko chhote MICRO-INSTRUCTIONS
mein tod do, wo control memory mein store karo
(jaise Von Neumann ne program memory mein rakha tha)
Control Memory (CSROM) : microprograms stored yahan
Microprogram : instruction → sequence of micro-operations
Microinstruction : ek step ke saare control signals (one line)
Microsequencer : agla microinstruction ka address decide
HORIZONTAL microprogramming :
- wide microinstruction — ek bit ek control signal (1-hot)
- bahut signals ek saath (parallel) — tez, par memory badi
VERTICAL microprogramming :
- narrow, encoded fields (jaise opcode bits)
- kam parallelism, chhoti microinstruction — sasta
Ex: x86 jaisa CISC = microprogrammed (complex instructions todne padte)
ARM/MIPS = hardwired (simple instructions)
Microprogrammed = flexible software-jaisa — naya instruction set = sirf control memory update. Isliye CISC processors mein use hua, jahan 200+ complex instructions ko handle karna tha.
Exercise
Question: Microprogrammed control unit mein microinstructions kahan store hote hain? (control memory / ram / general registers)
Question: Hardwired control unit kis se banti hai — combinational logic se ya microcode se?
Question: Micro-instruction ke chhote steps ko kya kehte hain? (micro-operations / macros / interrupts)
Common mistakes
- CU ko processing unit samajhna: CU khud calculate nahi karta — wo sirf control signals banata hai. Calculation ALU karta hai. Ye distinction har interview mein aata hai.
- Hardwired ko slow bolna: Hardwired FAST hai (direct circuit), microprogrammed thoda slow (control memory access). Order ulta mat karna.
- Microprogrammed ko compiler samajhna: Microprogram instruction ko todta hai micro-operations mein — ye hardware/control ka concept hai, software compiler nahi.
Station master train nahi chalata — sirf signal deta hai (control signals). Train = instruction, signal = CU output:
Instruction = train (ADD aa gaya)
CU (station master) : padha, decode kiya
Signals : platform do (register read), raasta khole (bus enable),
aage bhejo (ALU op) — har step ka signal
Hardwired = manual signal board (fast, fixed)
Microprogram = stored rulebook (flexible, slow)- GATE: hardwired vs microprogrammed comparison — short/direct question.
- UGC-NET: control memory, microinstruction, horizontal vs vertical definitions.
- Interview: "CU kya karta hai?" + "RISC mein kaunsa CU?" (hardwired).
- Trap: "Microprogrammed CU is faster than hardwired" — galat, flexibility ka price speed hai.
Control unit clear — ab tum jaante ho instructions convert kaise hote hain signals mein. Agla lesson — Memory Hierarchy — mein dekhenge itni saari memories kyun aur kaise organise hoti hain.