RISC-V SRAW Instruction Details
Instruction ManualR-typeShift lower 32 bits of rs1 right arithmetically by rs2[4:0], sign-extend 32-bit result to 64 bits
Instruction Syntax
Instruction Behavior
SRAW (R-type, opcode=0111011, funct7=0100000, funct3=101) performs an arithmetic right shift on the lower 32 bits of rs1 (original sign bit copied into vacated upper bits) by the shift amount in rs2[4:0]. The 32-bit result is sign-extended to 64 bits.
SRAW 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 «sraw x10, x11, x12 # x10 = sign-extend((x11[31:0] >>> x12[4:0])[31:0])».
Pre-Use Checklist
- Verify rd, rs1, rs2 (and rs3) are valid GPRs.
- Confirm funct3 and funct7 encoding is correct.
- Check if the result affects subsequent branches or address calculations.
- Ensure the rd register is not overwritten by another instruction.