Do SRLI and SRAI differ by only one bit?
In base shift-immediate encoding, they share opcode and funct3; bit30 in the fixed high bits selects SRLI when 0 and SRAI when 1.
Shift rs1 right logically by shamt bits (zeros into MSBs), result in rd
SRLI is the I-type immediate logical right-shift form. It shifts rs1 right by shamt, fills high bits with zero, discards low bits shifted out, and writes rd. RV32 uses imm[4:0] as shamt, range 0..31; RV64 uses a 6-bit shamt with bit25 as shamt[5]. opcode=0010011, funct3=101; fixed high bits/bit30=0 distinguish SRLI from SRAI.
RV32I/RV64I; XLEN-bit logical right shift
srli rd, rs1, shamtAssume successful instruction fetch, no asynchronous interrupt or extra extension checks; one initial value per register.
This example fixes IALIGN=32 and a 32-bit instruction; PC must be 4-byte aligned.
0x0025D513Decode the current instruction fields and read sources before writeback; no result has been committed.
These are teaching steps for architectural effects, not processor pipeline stages or cycles.
SRLI logically shifts rs1 right by the shamt constant and fills high bits with zero. It is commonly used for unsigned right shifts, field extraction, or scaling after dropping low bits.
Understand this scenario with real code like «srli x5, x6, 8 # RV32I/RV64I: x6=0x1234 -> x5=0x12 (logical right shift)».
In base shift-immediate encoding, they share opcode and funct3; bit30 in the fixed high bits selects SRLI when 0 and SRAI when 1.
No. shamt is a nonnegative shift amount: 0..31 on RV32 and 0..63 on RV64.