SLL

Shift Left Logical

SLL rd, rs1, rs2

Shifts a register left by the number of bits specified in another register.

Details

SLL performs a logical left shift of the value in rs1 by the shift amount held in the lower 5 bits of rs2 (or 6 bits in RV64I), writing the result to rd. Zeros are shifted into the low-order bits.

Pseudocode Operation

R[rd] = R[rs1] << (R[rs2] & 0x1F);

Example

SLL x10, x11, x12

Encoding

Binary Layout
0000000
31:25
rs2
24:20
rs1
19:15
001
14:12
rd
11:7
0110011
6:0
 
Format R-Type
Opcode 0x33
Extension RV32I

Operands

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