| There are 31 general-purpose registers x1-x31
(called x registers), which hold integer values. Register x0 is hardwired to the constant zero. Each register is 32 bits wide. | ||
|---|---|---|
| x0 | zero | constant value 0 |
| x1 | ra | return address (caller saved) |
| x2 | sp | stack pointer (called saved) |
| x3 | gp | global pointer |
| x4 | tp | thread pointer |
| x5 | t0 | temporary registers (caller saved) |
| x6 | t1 | " |
| x7 | t2 | " |
| x8 | s0/fp | saved register or frame pointer (callee saved) |
| x9 | s1 | saved register (callee saved) |
| x10 | a0 | function arguments and/or return values (caller saved) |
| x11 | a1 | " |
| x12 | a2 | function arguments (caller saved) |
| x13 | a3 | " |
| x14 | a4 | " |
| x15 | a5 | " |
| x16 | a6 | " |
| x17 | a7 | " |
| x18 | s2 | saved registers (callee saved) |
| x19 | s3 | " |
| x20 | s4 | " |
| x21 | s5 | " |
| x22 | s6 | " |
| x23 | s7 | " |
| x24 | s8 | " |
| x25 | s9 | " |
| x26 | s10 | " |
| x27 | s11 | " |
| x28 | t3 | temporary registers (caller saved) |
| x29 | t4 | " |
| x30 | t5 | " |
| x31 | t6 | " |
|
The RISC-V Program Counter (pc) is a dedicated register that stores the memory address of the instruction currently being executed by the processor. | ||