ISA & Assembly
Which describes the general-purpose integer registers of RISC-V RV32I (the 32-bit base integer instruction set)?
- A32 registers (x0-x31), each 32 bits wide
- B8 registers (x0-x7), each 32 bits wide
- C64 registers (x0-x63), each 64 bits wide
Show answer and explanation
Answer: A. 32 registers (x0-x31), each 32 bits wide
RV32I has 32 integer registers, x0 to x31, each 32 bits wide (the 64-bit RV64I widens them to 64 bits but keeps 32 registers). The register field in an instruction is 5 bits, which can name 2^5 = 32 registers. They also have aliases such as ra, sp and a0, whose roles are set by the calling convention. For embedded use there is RV32E with only 16 registers.
- A. Correct. x0-x31, with x0 always 0.
- B. Eight is close to the count of general registers in 32-bit x86.
- C. Even the 64-bit RV64I has 32 registers.