Is the immediate zero-extended?
No. Its encodable range is −2048 through 2047 and it is sign-extended to XLEN. For example, ori x5, x6, -1 writes all XLEN bits of x5 as ones.
Bitwise OR rs1 with a sign-extended 12-bit immediate and write rd.
ORI is a 32-bit I-type instruction in RV32I/RV64I. Sign-extend the immediate, from −2048 through 2047, to XLEN, OR it with the old rs1, and write rd; rd=x0 discards the write. Nonnegative immediates can set low mask bits. Negative immediates also OR upper bits with ones, so the operand is not an arbitrary zero-extended 12-bit mask.
Starts with machine-code field decoding, then shows operand reads, instruction-specific execution, and ISA-visible state update.
This example uses fixed initial register values and PC=0x2000; instruction fetch succeeds, with no asynchronous interrupt or extra extension checks. Exception branches stop ordinary commit; post-trap PC and handler state are EEI-dependent.
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.
Bitwise OR rs1 with a sign-extended 12-bit immediate and write rd.
RV32I/RV64I, old x6=20: ori x5, x6, 15 writes x5=31 (0x1f). Immediate 15 is encodable and its positive sign extension adds zero upper bits.
RV32I/RV64I, old x6=20: ori x5, x6, 15 writes x5=31 (0x1f). Immediate 15 is encodable and its positive sign extension adds zero upper bits.
RV32I/RV64I, old x6=20: ori x5, x6, 15 writes x5=31 (0x1f). Immediate 15 is encodable and its positive sign extension adds zero upper bits.
No. Its encodable range is −2048 through 2047 and it is sign-extended to XLEN. For example, ori x5, x6, -1 writes all XLEN bits of x5 as ones.
Yes. Read the old rs1 before writeback when they overlap. With rd=x0 the write is discarded and x0 remains zero.