RISC-V ADDIW Instruction Details
Instruction ManualI-typeAdd a sign-extended 12-bit immediate to rs1, then sign-extend the low 32-bit result to 64 bits in rd.
Instruction Syntax
Instruction Behavior
ADDIW (I-type, opcode=0011011, funct3=000) adds the sign-extended 12-bit immediate to rs1, ignores overflow, and writes the sign-extended low 32-bit result to rd. With an immediate of 0 it is the SEXT.W pseudoinstruction. Exists only in RV64I.
ADDIW Decode And Execute Animation
Starts with machine-code field decoding, then shows operand reads, instruction-specific execution, and ISA-visible state update.
Concept Step: receive the 32-bit instruction encoding
The machine code is split by the current instruction format; the animation starts from encoding/decode.
This animation shows ISA-visible decode and state changes, not any specific CPU pipeline, cache, prediction, or timing implementation.
Common Usage Scenarios
Understand this scenario with real code like «addiw x10, x11, 42 # x10 = sign-extend((x11 + 42)[31:0])».
Understand this scenario with real code like «addiw x10, x11, 42 # x10 = sign-extend((x11 + 42)[31:0])».
Understand this scenario with real code like «addiw x10, x11, 42 # x10 = sign-extend((x11 + 42)[31:0])».
Pre-Use Checklist
- Verify the immediate field is within the valid range.
- Confirm source register rs1 points to the correct operand.
- Check if the immediate sign-extension matches expectations.
- Ensure the result register rd has a clear purpose.