Which bit does SRAI copy on RV64?
SRAI copies the original most-significant bit of rs1: bit31 on RV32 and bit63 on RV64.
Shift rs1 right arithmetically by shamt bits (sign-bit into MSBs), result in rd
SRAI is the I-type immediate arithmetic right-shift form. It shifts rs1 right by shamt, fills high bits with the original most-significant bit of rs1, 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=1 distinguish SRAI from SRLI.
Starts with machine-code field decoding, then shows operand reads, instruction-specific execution, and ISA-visible state update.
This example uses fixed initial register values and PC=0x2000; instruction fetch succeeds, with no asynchronous interrupt or extra extension checks. Exception branches stop ordinary commit; post-trap PC and handler state are EEI-dependent.
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.
SRAI shifts rs1 right arithmetically, filling high bits with its original sign bit. Negative results round down, unlike DIV rounding toward zero.
Understand this scenario with real code like «srai x5, x6, 2 # x5 = x6 >> 2 (signed, sign-extended)».
Understand this scenario with real code like «srai x5, x6, 2 # x5 = x6 >> 2 (signed, sign-extended)».
SRAI copies the original most-significant bit of rs1: bit31 on RV32 and bit63 on RV64.
For the same XLEN, yes: 0..31 on RV32 and 0..63 on RV64. The fixed high bits/bit30 choose arithmetic sign-fill versus logical zero-fill.