addi

Addition immediate

Adds a sign-extended 12-bit immediate to the second register and stores the sum in the first.

RISC-V manual: addi

Forms

  • addi , ,

Pseudo-instructions

The processor does not have these forms. The assembler replaces each of them with one or more real instructions. Open a row to see them.

  • Set t1 to t2 + lower 12-bit label's address

Operands

t1
Any integer register, x0 to x31, or its named alias, such as zero, t0 or t6.
t2
An integer register. It may be the same register as t1.
imm12
A signed 12-bit immediate, -2048 to 2047.
label
A named address in the program, such as the start of a loop or a variable in .data.
.text
li t0, 13
# t0=13, immediate 5; addi writes 18 to t2.
addi t2, t0, 5