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.
Uses the same rhythm as the ADDI page: machine-code fields, fixed-field identification, operand reads, instruction-specific execution, and ISA-visible state update.
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 arithmetically shifts rs1 right by the shamt constant and fills new high bits with the original most-significant bit. It is a sign-preserving right shift, but negative results should not be simplified to truncating division 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)».
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.