### A good answer might be:

Yes. If the characters to be compared are loaded in the low-order byte of two registers, and the rest of the bits are zero, either instruction could be used.

# Set on Less Than Immediate

The other two set instructions compare an operand register with an immediate value in the instruction. There is a version for two's complement:

                       #  $s and imm contain
                       #  two's comp. integers
                       #
    slti  d,s,imm      #  if ( $s < imm )
                       #    d <-- 1
                       #  else
                       #    d <-- 0

And a version for unsigned integers:

                       #  $s and imm contain
                       #  unsigned integers
                       #
    sltiu  d,s,imm     #  if ( $s < imm )
                       #    d <-- 1
                       #  else
                       #    d <-- 0

In both, the immediate field of the machine instruction is 16 bits wide.

### QUESTION 4:

How is the 16-bit immediate field extended to 32 bits for the comparison? By sign extention or by zero extension?

- `slti:`
- `sltiu:`