5.1.7 · D1 · HinglishInstruction Set Architecture (ISA)

FoundationsRISC-V base ISA (RV32I - RV64I)

2,790 words13 min read↑ Read in English

5.1.7 · D1 · Hardware › Instruction Set Architecture (ISA) › RISC-V base ISA (RV32I - RV64I)

Pehle aap parent RISC-V base ISA (RV32I - RV64I) note ki ek bhi line padh sakein, aapko ek toolbox chahiye. Yeh page har tool ko scratch se banata hai. Har item mein hai: plain words mein kya matlab hai, uski picture, aur kyun yeh topic uske bina nahi chal sakta.


1. Ek bit — har cheez ka atom

Topic ko yeh kyun chahiye? Kyunki RV32I ka har instruction literally "32 switches ek specific pattern mein set hain" hota hai. Poora chapter isi ke baare mein hai ki un switches ka matlab kya hai.


2. Bit-string aur uski width — boxes ginana

Toh ek 4-bit string jaise 1011 ka matlab hai, place by place:

Ek bit-string sirf wahi hai jo parent ka data kabhi bhi hota hai: ek register ek rakhta hai (uski width ko XLEN kehte hain, §7 mein bana hai), aur ek instruction 32-wide wala hota hai. Aage hum seekhenge ki aisi string ke part ko kaise point karein.


3. Notation inst[31:20] — ek bit-string ko slice karna

Topic ko yeh kyun chahiye: cheh instruction formats (R, I, S, B, U, J) sirf named rules hain ki kaunsa slice opcode hai, kaunsa rd hai, kaunsa instruction mein baka hua constant hai. Slice notation seekh lo aur formats padhne layak ho jaate hain. (Un field names ke meanings aur bit-widths §10 mein milte hain.)


4. Hexadecimal — bits ko bite-sized groups mein

Topic ko yeh kyun chahiye: parent 0xDEADBEEF aur 0xEEF jaisi constants likhta hai. Hex ke bina aap 32-digit binary mein doob jaoge.


5. Unsigned vs signed — kya ek number negative ho sakta hai?

Lekin computers ko negative numbers bhi represent karne hote hain, aur unke paas sirf 0s aur 1s hain — koi minus-sign switch nahi. Trick hai Two's Complement.

Topic ko yeh kyun chahiye: parent ka poora "kyun 0xDEADC na ki 0xDEADB" argument tabhi sense banata hai jab aap jaante ho ki 0xEEF (top bit set) two's complement ke under ek negative number hai.


6. Sign-extension aur sext notation — ek number ko bina badle bada karna

Topic ko yeh kyun chahiye: RV32I mein har immediate narrow store hota hai (12 ya 20 bits) aur register width XLEN tak sign-extend hota hai (aage define). Yeh miss karo toh aadhe worked examples toot jaate hain.


7. XLEN — "kitna wide" ke liye ek symbol


8. Register, register file, aur x0

Topic ko yeh kyun chahiye: instructions apne inputs aur output ko register number se name karte hain (fields rs1, rs2, rd), toh pehle jaanna zaroori hai ki register kya hota hai, format decode karne se pehle.


9. pc — "aap yahan hain" ka marker


10. opcode, funct3/funct7, rd/rs1/rs2, immediate — field vocabulary (widths ke saath)

Topic ko yeh kyun chahiye: yeh woh words hain jo parent ke har format diagram pe hain. funct7 | rs2 | rs1 | funct3 | rd | opcode sirf yeh vocabulary hai, bit order mein upar ke widths ke saath laid out.


Prerequisite map

Neeche ke arrows kehte hain "tail wale box ko pehle samajhna zaroori hai, tabhi head wala box sense banega," aur har edge label batata hai ki kya flow ho raha hai — taaki aap trace kar sako, jaise ki "powers of two" woh single idea hai jo hex aur signed range dono ko unlock karta hai.

line them up

weight each box

group by four

largest value

top bit goes negative

copy the sign bit

point at a chunk

widen to XLEN

name each chunk

fixed field layout

how wide is a register

32 boxes of storage

an address register

decoded operands

decoded fields

control flow

readable constants

Bit: one 0 or 1

Bit-string and width

Place values powers of two

Hexadecimal

Unsigned range

Two's complement

Sign-extension sext

Slice notation

Immediate fields

Formats R I S B U J

XLEN

Register file and x0

pc and branch target

RISC-V base ISA

Saare raaste parent RISC-V base ISA (RV32I - RV64I) mein drain hote hain. Related big-picture context Instruction Set Architecture (ISA), RISC vs CISC, Pipelining, aur Assembler & Pseudo-instructions mein milta hai.


Equipment checklist

Reveal karne se pehle har ek ka answer dene ki koshish karo. Agar koi stumps kare, toh upar woh section dobara padho.

Ek sentence mein bit kya hai?
Ek single box jo do values mein se ek rakhta hai, 0 ya 1.
Bit number (right se, 0 se ginkar) ka place value kya hai?
.
bits kitne distinct patterns rakh sakte hain?
.
Slice ka kya matlab hai?
String inst ke box 31 se box 20 tak ke 12 bits.
0xE ko 4 bits aur decimal number mein convert karo.
1110, jo hai.
Two's complement mein kaunsa bit sign batata hai, aur 1 wahan kya matlab rakhta hai?
Sabse left (most significant) bit; 1 matlab number negative hai.
4-bit 0001 ko invert-and-add-one se negate karo; kaunsa pattern aur value milti hai?
Flip karke 1110, add 1 → 1111, jo hai.
12-bit two's-complement field ki signed range kya hai?
.
kya karta hai?
Narrow signed bit-string ko 32 bits tak widen karta hai uska sign bit leftward copy karke, value same rakhte hue.
Jab aap ek negative number ko wider width tak sign-extend karte ho, toh aap kya pad karte ho?
Sign bit ki copies, yaani 1s (0s agar number positive ho).
XLEN ka kya matlab hai, aur uski do values kya hain?
Register width in bits; RV32I ke liye 32, RV64I ke liye 64.
RISC-V mein kitne registers hain, aur kaunsa special hai?
32 (x0x31); x0 hardwired to zero hai.
rd field exactly 5 bits wide kyun hai?
Kyunki , 32 registers mein se ek ko name karne ke liye just enough.
opcode, funct3, funct7, aur ek I-type immediate kitne wide hain?
Krama se 7, 3, 7, aur 12 bits.
pc kya rakhta hai?
Current instruction ka address.
Destination register kaunsa field hai, aur sources kaunse hain?
rd destination hai; rs1, rs2 sources hain.