srai

Shift right arithmetic immediate

Arithmetic shift (the original sign bit is copied into the vacated upper bits) the value in xs1 right by shamt, and store the result in xd.

This instruction must have data-independent timing when extension Zkt is enabled.

Assembly format

srai xd, xs1, shamt

Decode Variables

  • RV32

  • RV64

Bits<5> shamt = $encoding[24:20];
Bits<5> xs1 = $encoding[19:15];
Bits<5> xd = $encoding[11:7];
Bits<6> shamt = $encoding[25:20];
Bits<5> xs1 = $encoding[19:15];
Bits<5> xd = $encoding[11:7];

Execution

X[xd] = X[xs1] >>> shamt;

Encoding

This instruction has different encodings in RV32 and RV64.
RV32
svg
RV64
svg

Defining extension

I

Access

M

Always

Containing profiles

  • Mandatory: RVA20S64, RVA20U64, RVA22S64, RVA22U64, RVA23S64, RVA23U64, RVB23S64, RVB23U64, RVI20U32, RVI20U64

  • Optional: None