Back Home
RV32 / RV64

RV32 vs RV64

Focus on register width, load/store behavior, 32-bit word operations, and common ABI data models so beginners can avoid the most common pitfalls at a glance.

Cheat Sheet — Key Differences

The 6 most critical differences in one glance.

DimensionRV32RV64
Register Width32-bit64-bit
Common ABI Data ModelILP32: int/long/pointer usually 4 bytesLP64: long/pointer usually 8 bytes
lw BehaviorLoads a 32-bit value; the result width remains 32 bitsLoads a 32-bit value and sign-extends it to 64 bits
Common Pointer Loadlw rd, offset(rs1)ld rd, offset(rs1)
Common Pointer Storesw rs2, offset(rs1)sd rs2, offset(rs1)
RV64 32-bit Word Opsadd, sub, sll…addw, subw, sllw… (w suffix)

Key Comparisons

RV32
# 32-bit additionadd a0, a1, a2
RV64
# XLEN-wide add (64-bit on RV64)add   a0, a1, a2# add low 32 bits, sign-extend to 64addw  a0, a1, a2# add immediate to low 32 bits, sign-extendaddiw a0, a1, 1
Watch out: On RV64, add is XLEN-wide; use addw/addiw for 32-bit int/word result semantics. Do not use addw for ordinary 64-bit pointer address arithmetic.
RV32
# t0 = 32-bit value from memorylw t0, 0(sp)
RV64
# t0 = sign-extended (32 → 64 bit)lw  t0, 0(sp)# t0 = zero-extended (32 → 64 bit)lwu t0, 0(sp)
Watch out: On RV64, lw copies bit31 into the upper 32 bits. Use lwu for zero-extension when you expect the upper bits to stay zero.
RV32
# load a 32-bit pointer/addresslw t0, 0(sp)# store a 32-bit pointer/addresssw t0, 0(sp)
RV64
# load a 64-bit pointer/addressld t0, 0(sp)# store a 64-bit pointer/addresssd t0, 0(sp)
Watch out: Under common ILP32/LP64 psABI data models, RV32 pointers are usually 4 bytes and RV64 pointers are usually 8 bytes. On RV64, lw reads only 4 bytes and sign-extends; it is not a substitute for ld when loading a 64-bit pointer.
Further Reading
Official References

This page is organized with reference to the official RISC-V documents below for architecture, ABI, CSR, and pseudo-instruction notes; platform or OS ABI differences still need to be checked against their own specifications.