RISC-V SRAIW Instruction Details
Instruction ManualI-typeShift 32-bit value in rs1 right arithmetically by immediate, sign-extend 32-bit result to 64 bits
Instruction Syntax
Instruction Behavior
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.
SRAIW Decode And Execute Animation
Starts with machine-code field decoding, then shows operand reads, instruction-specific execution, and ISA-visible state update.
Concept Step: receive the 32-bit instruction encoding
The machine code is split by the current instruction format; the animation starts from encoding/decode.
This animation shows ISA-visible decode and state changes, not any specific CPU pipeline, cache, prediction, or timing implementation.
Common Usage Scenarios
Understand this scenario with real code like «sraiw x10, x11, 2 # x10 = sign-extend((x11[31:0] >>> 2)[31:0])».
Pre-Use Checklist
- Verify the immediate field is within the valid range.
- Confirm source register rs1 points to the correct operand.
- Check if the immediate sign-extension matches expectations.
- Ensure the result register rd has a clear purpose.