SLTU

Set Less Than Unsigned

SLTU rd, rs1, rs2

Sets rd to 1 if rs1 < rs2 (unsigned comparison), otherwise 0.

Details

SLTU performs an unsigned comparison of rs1 and rs2, writing 1 to rd if rs1 < rs2 (unsigned), and 0 otherwise. Note: SLTU rd, x0, rs2 sets rd to 1 if rs2 is non-zero (assembler pseudoinstruction SNEZ).

Pseudocode Operation

R[rd] = (R[rs1] <u R[rs2]) ? 1 : 0;

Example

SLTU t0, a0, a1

Encoding

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

Operands

  • rd
    Destination register (integer)
  • rs1
    Source register 1 (integer)
  • rs2
    Source register 2 (integer)