Lesson 3 — Beginner

Instruction Set Architecture (ISA)

CPU ko jo instructions samajh aati hain unke set ko ISA kehte hain — jaise insaan ki apni bhasha. Is lesson mein hum dekhenge instruction banti kaise hai (opcode + operands), kitne type ki instructions hoti hain, aur ISA design ke factors kya hain jo GATE aur interview dono mein aate hain.

⏱ 14 min• Beginner• Von Neumann

ISA kya hai

WHAT

Instruction Set Architecture (ISA) wo instructions, registers, data types aur addressing modes ka set hai jo processor directly samajhta hai. Ye CPU ka "bhasha-kosh" hai — compiler isi ke against code banata hai.

WHEN

Jab bhi tum koi code compile karo, koi processor khareedo, ya kisi platform pe program chalao — ISA decide karta hai chalega ya nahi.

WHERE

x86 (Intel/AMD, laptops), ARM (phones, Apple M-series), MIPS/RISC-V (padhai + embedded) — har processor kisi na kisi ISA ka hai.

Ek program likhna jaise Hindi mein likhna — lekin CPU ko sirf apni bhasha aati hai. Compiler/interpreter wo translator hai jo tumhari code ko ISA ki bhasha mein badalta hai. ISA alag hui toh binary alag — isi liye Windows x86 ke liye bana hai, phone ka app ARM ke liye.

Yaad rakho: ISA architecture ka hissa hai (programmer ko dikhta hai), lekin wo kitne cycle mein execute hogi (CPI, pipeline) — ye organisation. Exam mein isi par difference poochhte hain.

Instruction format — opcode + operands

Instruction = OPCODE + OPERAND field(s)

Opcode  : operation ka code (ADD, SUB, MOV, JMP) — kya karna hai
Operand : data ya address — kis pe karna hai

16-bit instruction example (4-bit opcode + 12-bit address):
| Opcode |     Address      |
  4 bits     12 bits
→ 2^4 = 16 alag instructions, 2^12 = 4096 memory locations

Address field ki jagah REGISTER bhi ho sakta hai :
| Opcode | Reg | Reg | Reg |  (register format — RISC ka style)

Addressing kaise : register direct, register indirect,
memory direct, immediate (operand instruction mein hi)

Ek instruction ka format ISA ka core hissa hai — kitne bits ka instruction, kitne bits opcode, kitne address field. Ye decide karta hai instruction kitni lambi hogi (fixed vs variable length) aur memory mein kitni jagah legi.

Instructions ke main types

1. Data Transfer  : MOV R1, R2 | LOAD R1, [addr] | STORE [addr], R1
                     (ALU ko data pahunchana — register/memory beech)
2. Arithmetic     : ADD, SUB, MUL, DIV, INC, DEC
3. Logical        : AND, OR, XOR, NOT, CMP (compare sets flags)
4. Shift/Rotate   : SHL, SHR, ROL, ROR — bit manipulation
5. Control Transfer : JMP, JZ, JNZ, BEQ, CALL, RET
                     (program counter badal ke flow kaatna/lena)
6. I/O & Misc     : IN, OUT (I/O mapped), NOP, HLT, HALT

Example flow :
LOAD  R1, [A]     ; data transfer
ADD   R1, R2      ; arithmetic
STORE [C], R1     ; result wapas memory
JMP   loop        ; control transfer

Har program — chahe game ho ya Excel — inhi 6 type ke instructions ke combinations se bana hai. Data transfer sabse zyada chalta hai (roughly aadhi instructions), isliye RISC mein isse alag category (load/store) banayi gayi.

Interview question: Q: "JUMP kis type ki instruction hai?" A: Control transfer — ye PC change karti hai, warna instruction sequence chalti rehti. Q: "CMP kya karta hai?" — sirf flags set karta hai (result store nahi), aage conditional jump usi par decide karta hai.

ISA design ke factors

ISA design ka balance :
  Instruction set BADA   → code chhota, lekin decode mushkil (CISC)
  Instruction set CHHOTA → CPU simple + tez, lekin code bada (RISC)
  Registers zyada        → memory traffic kam, lekin instruction mein
                           register numbers encode karne padte hain

Ek exam fact : instruction count badhega toh program size badhega,
lekin CPI kam ho sakta hai — final time = IC × CPI × T dekhna padta hai
Concept link: Isi lesson ke aage RISC vs CISC poora module hai (lesson 14). Yahan ka format, address field aur types ka knowledge wahin ka foundation hai — usse pehle mat bhoolna.

Exercise

Question: Instruction mein jo operation ka code hota hai usse kya kehte hain? (opcode / operand / address)

Question: JMP, BEQ, CALL kis type ki instructions hain? (control transfer / arithmetic / data transfer)

Question: LOAD aur STORE kis type ke instructions hain? (data transfer / logical / shift)

Common mistakes

Desi example: Tumhari apni bhasha = ISA

Tum jaise Hindi mein sochte ho, CPU apni ISA bolta hai. Tumhare paas jo shabd hain wahi tum bol sakte ho — utne hi instructions CPU kar sakta hai:

text
Tumhare shabd  = instruction set (ADD, MOV, JMP)
Naya shabd     = invalid instruction (CPU reject)
Compiler       = translator (tumhari bhasha → CPU ki bhasha)
x86 vs ARM     = Hindi vs English — do alag bhashayein
Exam mapping (GATE / TCS / UGC)
  • GATE: instruction format (opcode + address bits) par memory/number of instructions numerical.
  • UGC-NET: instruction ke parts aur types — definitions poochhi jaati hain.
  • TCS NQT: "Operand kya hai?" aur instruction type classification classic hai.
  • Trap: "Operand = operation code" — galat, operand data/address hai.
Lesson complete?

Instruction format clear. Agla lesson — Addressing Modes — mein dekhenge operand ko memory se kaise dhoondha jaata hai (immediate, direct, indirect aur bhi).

Popular courses: Data Science Course in Lucknow · AI Course in Lucknow · Python Course in Lucknow · Power BI Course · Data Analytics Course