What happens with a shift amount of zero?
Keep rs1[31:0], then sign-extend bit 31 to 64 bits. For rs1=0x1234567880000000 and rd!=x0, the result is 0xffffffff80000000.
Shift 32-bit value in rs1 right arithmetically by immediate, sign-extend 32-bit result to 64 bits
SRAIW is an I-type instruction with opcode=0011011, funct3=101, and fixed imm[11:5]=0100000. It arithmetically shifts the lower 32 bits of rs1 by imm[4:0], copying the original bit 31 into vacated upper bits, then sign-extends the 32-bit result to 64 bits. Encodings with imm[5] not equal to 0 are reserved.
RV64I; XLEN=64; 32-bit result → sign extension
sraiw 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.
0x4025D51BDecode 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.
SRAIW is RV64I-only: ignore the upper 32 bits of rs1, apply a 32-bit arithmetic right shift by shamt (0–31), then sign-extend to 64 bits.
Understand this scenario with real code like «sraiw x10, x11, 1 # RV64I: x11=0x1234567880000000 -> x10=0xffffffffc0000000».
Keep rs1[31:0], then sign-extend bit 31 to 64 bits. For rs1=0x1234567880000000 and rd!=x0, the result is 0xffffffff80000000.
SRAIW uses imm[4:0], range 0–31. Encodings with imm[5]=1 are reserved; arbitrary out-of-range inputs cannot be masked into a legal instruction.