Webcentive RISC-V Reference

addiw

Add immediate word

Extension
RV32I/RV64I base integer
XLEN
RV64 only
Assembly (riscv-unified-db)
addiw xd, xs1, imm
Length
32-bit

Encoding

3120191514121176210
imm[11:0]rs1000rd0011011

Match 0x0000001b, mask 0x0000707f. Source: addiw rd rs1 imm12 14..12=0 6..2=0x06 1..0=3 in riscv-opcodes/extensions/rv64_i.

FieldBitsriscv-opcodes name
imm[11:0]31:20imm12
rs119:15rs1
rd11:7rd

Description

Add an immediate to the 32-bit value in xs1, and store the sign extended result in xd

Description from riscv-unified-db, reformatted.

Operation

X[xd] = $signed((X[xs1] + $signed(imm))[31:0]);

Pseudocode in riscv-unified-db’s IDL, quoted unchanged.

Specification and related pages