Define Instruction Set
Instruction Set kya hota hai? (Short)
Instruction Set ek complete collection hota hai un sab machine-level instructions ka jo microprocessor/CPU samajh sakta hai aur execute kar sakta hai. In instructions se CPU ko bataya jaata hai ki kya operation karna hai, kaunse data par karna hai aur result kahan store karna hai.
Simple Words Me
Instruction Set = CPU ki rule book ya dictionary. Agar koi command is list me nahi hai, to CPU usko nahi samjhega aur execute nahi karega.
Instruction Set kyun important hai?
- Ye decide karta hai ki processor kya-kya kaam kar sakta hai.
- Programmer ka likha hua program CPU instruction set ke basis par hi execute hota hai.
- Har processor architecture (jaise 8085, 8086, ARM, MIPS, Intel x86) ka apna instruction set hota hai — isliye software compatibility pe bhi farq padta hai.
Instruction Set me kya-kya shamil hota hai?
General categories —
- Data Transfer Instructions — (MOV, MVI) : Data ko ek jagah se dusri jagah transfer karna.
- Arithmetic Instructions — (ADD, SUB, MUL, DIV) : Numerical calculations.
- Logical Instructions — (AND, OR, XOR, NOT) : Bitwise logical operations.
- Branching / Control Transfer Instructions — (JMP, JZ, JNZ, CALL, RET) : Program flow change karna.
- Control Instructions — (HLT, NOP) : CPU ko control dene waale commands.
- I/O Instructions — Input/output operations for devices.
Instruction Cycle — Fetch → Decode → Execute (Deep)
Har ek instruction CPU me ek cycle se guzarta hai. Teen main steps hain:
- Fetch: Program Counter (PC) se next instruction memory se laayi jaati hai.
- Decode: Instruction ko decode karke CPU samajhta hai kaunsa operation karna hai aur kin registers/operands ki zarurat hai.
- Execute: Actual operation perform hota hai — arithmetic, memory access, branch, etc. Fir result register/memory me store hota hai. PC update hota hai next instruction ke liye.
Instruction Format aur Encoding (Deep)
Instruction format batata hai ki ek instruction ke andar kya-kya fields hoti hain. Common fields:
- Opcode: Operation code — batata hai kya operation karna hai (e.g., ADD, MOV).
- Operand fields: Kahan se data lena hai ya kahan store karna hai (registers, memory address, immediate value).
- Addressing mode bits: Batate hain ki operands ko kaise interpret karein.
Instruction encoding binary me hoti hai. Kuch CPUs fixed-length instructions use karte hain (jaise many RISC designs — 32-bit per instruction), kuch variable-length (jaise x86) — jiska effect complexity aur decoding time pe padta hai.
Addressing Modes — Kya hota hai? (Examples ke saath)
Addressing mode batata hai ki operand ka address instruction me kaise specify kiya gaya hai. Common modes:
- Immediate: Operand value instruction ke andar hi hoti hai. (e.g., MOV A, #5)
- Register: Operand CPU register me hota hai. (e.g., ADD R1, R2)
- Direct (Absolute): Memory ka fixed address diya hota hai. (e.g., MOV A, 2000H)
- Indirect: Register ke andar jo address hai, usko use karke memory access hoti hai. (e.g., MOV A, (R1))
- Indexed: Base address + offset — arrays ke liye useful.
RISC vs CISC (Important Concept)
RISC (Reduced Instruction Set Computer): Simple aur fixed-length instructions, har instruction fast hoti hai, pipeline-friendly. Example: ARM, MIPS.
CISC (Complex Instruction Set Computer): Complex/variable-length instructions, ek instruction me multiple low-level operations ho sakte hain. Example: x86 family.
Exam me ya real world me: RISC designs generally simpler decode aur pipeline ke liye ache; CISC ka fayda backward compatibility aur complex single-instruction functionality me hota hai.
Assembly vs Machine Code (Short)
Machine code = Binary instructions jo CPU directly execute karta hai.
Assembly = Human-readable symbolic form (mnemonics) — assembler se machine code me convert hota hai.
Example — Simple 8085/ARM style (Samajhne ke liye)
8085 (example):MVI A, 05H — A register me immediate value 05H store karo.
ARM (example):ADD R0, R1, R2 — R0 = R1 + R2.
Advantages & Disadvantages (Short list)
- Advantages: Instruction set clear hone se software-hardware interaction predictable hota hai; optimized instructions performance improve kar sakte hain.
- Disadvantages: Complex instruction set decoding slow kar sakta hai; compatibility issues agar different instruction sets ho.
✍️ Exam Tips — Kya likhna chahiye?
- Short definition shuru me likho (1-2 lines), phir examples aur categories batao.
- Instruction cycle (Fetch-Decode-Execute) zaroor explain karo — diagram space ho to draw kar lo.
- RISC vs CISC ka basic difference 2-3 lines me likho.
- Ek chhota example (assembly mnemonic) zaroor do.
Frequently Asked (Short FAQ)
- Q: Kya har processor ka instruction set same hota hai?
- A: Nahi. Har architecture ka apna instruction set hota hai. Isliye ek processor ka machine code dusre par nahi chalega bina translation ke.
- Q: Instruction set aur ISA me farq kya hai?
- A: ISA (Instruction Set Architecture) me instruction set ke alawa registers, memory model, addressing modes, data types bhi include hote hain — basically hardware-software interface ka full definition.
Comments
Post a Comment