RISC-V
Course: Computer Architectures
Type: Concept
Definition
RISC-V is an instruction set architecture built around a small set of simple instructions and regular instruction formats.
For RV32, general-purpose registers hold 32-bit values.
Key ideas
- Registers are named
x0throughx31. x0always contains0.- Some registers also have ABI names, such as:
x1 = rax2 = sp
- Many convenient assembly instructions are pseudo-instructions that the assembler expands into real instructions.
Examples
addi x1, x2, 5means:
x1 = x2 + 5li x5, 100may be translated by the assembler into:
addi x5, x0, 100Important rules
- Arithmetic instructions normally operate on registers.
- Immediate instructions encode a constant directly in the instruction.
- Loads and stores access memory using
offset(base_register). - Branches and jumps modify the program counter.