SRAIW

Shift Right Arithmetic Immediate Word

SRAIW rd, rs1, shamt

Arithmetically shifts the lower 32 bits of rs1 right by a constant, sign-extending the result.

Encoding

Binary Layout
0100000
31:25
shamtw
24:20
rs1
19:15
101
14:12
rd
11:7
0011011
6:0
 
Format I-Type (Shift)
Opcode 0x4000501B
Extension RV64I

Operands

  • rd
    Destination register (integer)
  • rs1
    Source
  • shamt
    Shift Amount

Example

SRAIW x10, x11, 4

// Arithmetic right shift of lower word.

Related

More in RV64I

Description

SRAIW performs an arithmetic right shift of the lower 32 bits of rs1 by the 5-bit immediate, sign-extends the 32-bit result to 64 bits, and writes it to rd.

Operation

R[rd] = sext((R[rs1][31:0] >>s shamt));