Home/Instructions/Shift Left Logical Immediate Word
SLLIW

RISC-V SLLIW Instruction Details

Instruction ManualI-type

Shift 32-bit value in rs1 left logically by immediate, sign-extend 32-bit result to 64 bits

Instruction Syntax

slliw rd, rs1, shamt
Operand Breakdown
Destination rd: general-purpose register receiving the result.
Source rs1: register holding the first operand.
Immediate imm: 12-bit signed value, sign-extended before operation with rs1.
RV64IArithmetic32-bit Shift

Instruction Behavior

SLLIW is an I-type instruction with opcode=0011011, funct3=001, and imm[11:5]=0000000. It logically shifts the low 32 bits of rs1 by imm[4:0], fills low bits with zero, and sign-extends the 32-bit result to 64 bits in rd. Encodings with imm[5] equal to 1 are reserved.

SLLIW Decode And Execute Animation

Starts with machine-code field decoding, then shows operand reads, instruction-specific execution, and ISA-visible state update.

rd
rs1
shamt
slliw
,
,
Execution Context
t1(x6)
0x0000000000000014
31..25
24..20
19..15
14..12
11..7
6..0
0000000
fixed imm[11:5]
00010
shamt[4:0]
00110
rs1
001
funct3
00101
rd
0011011
opcode
Execution Data Path
instruction
0x0023129B
opcode
0011011 -> OP-IMM-32
funct3
001 -> SLLIW
imm[11:5]
imm[11:5]=0000000 fixed; shamt[4:0]=00010
rd / rs1
t0(x5) / t1(x6)
imm[11:5] + shamt[4:0]
imm[11:5]=0000000 fixed; shamt[4:0]=00010
32-bit logical shift
0x00000014 << 2 -> low 32 bits 0x00000050 -> sext.w 0x0000000000000050
x5
t0(x5) = 0x0000000000000050
Current Step

Concept Step: receive the 32-bit instruction encoding

The machine code is split by the current instruction format; the animation starts from encoding/decode.

encoding: 0x0023129B
syntax : slliw t0(x5), t1(x6), 2
result : t0(x5) = 0x0000000000000050
Architectural Result
t0(x5) = 0x0000000000000050

This animation shows ISA-visible decode and state changes, not any specific CPU pipeline, cache, prediction, or timing implementation.

Common Usage Scenarios

Bit Operations & Masks

Understand this scenario with real code like «slliw x10, x11, 3 # x10 = sign-extend((x11[31:0] << 3)[31:0])».

Multiplication & Division

Understand this scenario with real code like «slliw x10, x11, 3 # x10 = sign-extend((x11[31:0] << 3)[31:0])».

Pre-Use Checklist

Syntax Check
  • Verify the immediate field is within the valid range.
  • Confirm source register rs1 points to the correct operand.
Semantic Check
  • Check if the immediate sign-extension matches expectations.
  • Ensure the result register rd has a clear purpose.

Pitfalls / Common Confusions

SLLIW encodes shamt only in 0..31; SLLIW encodings with imm[5] not equal to 0 are reserved.
Result is sign-extended, upper 32 bits follow bit 31
W-suffix instructions produce a 32-bit result and sign-extend bit 31 to XLEN; do not treat them as ordinary 64-bit operations.
These W-suffix forms belong to RV64I or RV64 extension instructions; RV32 has no corresponding forms.