SLTI

Set Less Than Immediate

SLTI rd, rs1, imm

Sets rd to 1 if rs1 < immediate (signed), otherwise 0.

Details

SLTI places 1 in rd if rs1 is less than the sign-extended 12-bit immediate when both are treated as signed numbers, else 0.

Pseudocode Operation

R[rd] = (R[rs1] <s sext(imm)) ? 1 : 0;

Example

SLTI x5, x6, 10

Encoding

Binary Layout
imm[11:0]
31:20
rs1
19:15
010
14:12
rd
11:7
0010011
6:0
 
Format I-Type
Opcode 0x13
Extension RV32I

Operands

  • rd
    Destination register (integer)
  • rs1
    Source
  • imm
    Signed immediate value