What is RISC-V? It is an open instruction set architecture (ISA) — the public grammar a CPU uses, not a brand of chip. This guide shows how RISC-V works in plain language: the RISC-V register file (x0–x31), load-store memory, the program counter, and the fetch–decode–execute loop. Aimed at school students and first-year engineers, without the usual myths.
RISC-V is not a chip you buy, not an operating system, and not “free computers.” It is an instruction set architecture (ISA) — the list of instructions and registers a compatible CPU must provide. SiFive, Andes, Espressif, IIT Madras SHAKTI, and many others each build their own chips that speak RISC-V. Two RISC-V chips can both run the same simple program and still be totally different inside (speed, caches, extra features).
Software is a list of tiny orders: “add these two numbers,” “load a value from memory,” “if this is zero, jump elsewhere.” A processor can only obey orders it was built to understand. That shared vocabulary is the ISA.
English is not a novel. RISC-V is not a Raspberry Pi. English is the grammar; novels are what people write with it. RISC-V is the grammar; chips are the novels. Born at UC Berkeley and now maintained by RISC-V International, the spec is open: anyone may implement the standard instructions without paying a royalty for the ISA itself. (You still pay for engineers, tools, and the factory that prints silicon.)
RISC stands for Reduced Instruction Set Computer. The name is historical. It does not mean “this CPU has almost no instructions” or “it is weaker than Intel.” Modern RISC-V, with optional extensions, can have a large catalogue.
The useful meaning of RISC here is a style:
ARM is also a RISC family. x86 is a CISC family with a more irregular encoding. That comparison is a business and ecosystem story as much as a technical one. For this page we stay inside RISC-V.
A RISC-V hart (hardware thread — think “one core running one stream of instructions”) repeats three ideas forever until you cut power:
Read the next instruction from memory at the address in the program counter (PC).
Split the 32-bit word into opcode, register numbers, and immediates. Decide what the ALU and memory should do.
Add, compare, load, store, or jump. Then update the PC to the next instruction (usually PC + 4 for a 32-bit instruction).
A classroom drawing is a single-cycle core: one instruction finishes every clock. Fast chips use a pipeline (several instructions in flight) and caches. Those are implementation tricks. The ISA still says the same thing: “after this ADD, x7 holds the sum.” Students should learn the ISA first; pipelines come later in RISC-V from Scratch.
A register is a tiny, extremely fast box inside the processor that holds one number. In RV32I that number is 32 bits (XLEN = 32). In RV64I the same 32 names hold 64-bit values (XLEN = 64). Do not confuse “32 registers” with “32 bits of storage.” You have 32 boxes; each box is 32 or 64 bits wide.
Registers are the papers on your desk — few, instant to grab. Memory is the warehouse down the hall — huge, but you walk to get a box. CPUs are fast because they do homework on the desk and only visit the warehouse when they must.
The base integer ISA gives x0 … x31. Software also uses friendly ABI names from the standard calling convention (who keeps which register across a function call). Same silicon, two labels.
| Number | ABI name | Job (standard ABI) | Kept across a function call? |
|---|---|---|---|
x0 | zero | Always reads as 0. Writes are discarded. | — |
x1 | ra | Return address (where to jump back after a call) | No (caller-saved) |
x2 | sp | Stack pointer — top of the current stack | Yes (callee-saved) |
x3 | gp | Global pointer (tooling; not a general scratch pad) | — |
x4 | tp | Thread pointer | — |
x5–x7 | t0–t2 | Temporaries | No |
x8–x9 | s0–s1 | Saved registers; s0 may be the frame pointer | Yes |
x10–x17 | a0–a7 | Arguments and return values | No |
x18–x27 | s2–s11 | More saved registers | Yes |
x28–x31 | t3–t6 | More temporaries | No |
x0 is the clever trick. Hardware wires it to zero. Reading x0 always gives 0. Writing x0 does nothing useful (the write is ignored). That gives a free constant 0 and lets one encoding do several jobs: copy with add rd, rs, x0, or throw a result away by writing x0.
The embedded variant RV32E has only x0–x15 (16 integer registers) to save silicon. The ABI for that case is different (ILP32E). If a tutorial says “always 32,” that is RV32I/RV64I, not every possible RISC-V core.
add into the PC like a normal x-register. Jumps and branches change it.f0–f31. Only if the chip implements the F and/or D extensions. Integer RISC-V does not magically have IEEE floats.RISC-V memory is byte-addressed: address 0 is one byte, address 1 is the next byte, and so on. RV32I offers a 32-bit address space in the ISA (up to 4 GiB of addressable locations). A cheap microcontroller may only wire a few kilobytes of real RAM into part of that space. The rest of the map might be empty, or hold memory-mapped UART, timers, and flash. The spec calls this an execution environment question: the ISA says how loads work; the board says which addresses are legal.
add that takes a RAM address as an operand. You load, then add, then store if you must write back.Address = register rs1 plus a 12-bit signed offset. Then:
lw / sw — 32-bit word (RV32)lh / lhu / sh — 16-bit halfword (signed or zero-extended on load)lb / lbu / sb — 8-bit byteRV64 adds ld/sd for 64-bit values, and lwu for a 32-bit load zero-extended into a 64-bit register.
spThe stack is not a special RAM chip. It is a region of ordinary memory. Register x2/sp holds the current top. Function calls push return addresses and spilled registers, then pop them. Convention (not a transistor law) says the stack grows toward lower addresses on standard ABI RISC-V.
Here is a complete thought, first in friendly ABI names, then in the real instructions an assembler typically emits. li is a pseudo-instruction: the assembler may turn it into addi when the constant fits in 12 bits.
.text
.globl _start
_start:
li t0, 10 # t0 is x5; assembler → addi x5, x0, 10
li t1, 32 # t1 is x6
add t2, t0, t1 # t2 is x7; t2 = 42
# In a real board you would then ecall or store the result.
# This snippet only shows the ALU path.
addi x5, x0, 10
addi x6, x0, 32
add x7, x5, x6 # x7 = 42
What the hardware does, in order:
addi word from the address in the PC.rd = x5, rs1 = x0, immediate = 10.rd were x0.addi, then for add which reads two registers and writes x7.To put 42 into RAM you would add something like sw t2, 0(sp) after setting sp to a valid RAM address. Without a valid address, a real core raises an exception — another reason “it assembled” is not the same as “it ran.”
RV32I uses a few 32-bit layouts (R, I, S, B, U, J) so decode hardware stays regular. add is R-type (three registers). addi and lw are I-type. sw is S-type. Branches are B-type. You do not need to memorise bit numbers to understand the idea; you do need them if you build a decoder in Verilog.
RISC-V is modular. A name like RV32IMAC is a shopping list:
| Letter | What it adds | Do all chips have it? |
|---|---|---|
| I | Base integer (the heart: add, load/store, branches, jumps) | Required for “RV32I” / “RV64I” |
| M | Multiply and divide | No — tiny cores may omit it |
| A | Atomic memory operations (for locks between cores) | No |
| F / D | Single / double-precision floating point + f registers | No |
| C | Compressed 16-bit encodings of common ops (denser code) | Very common, still optional |
| V | Vector (SIMD-style) operations | No — mostly bigger / newer cores |
Companies may also add custom instructions for crypto or AI. That is allowed. Software that uses a custom opcode will not run on a core that lacks it. Portable teaching code sticks to I (and maybe M and C).
Privilege in one paragraph: Machine mode (M) is the “boss” mode every core has. User mode (U) is for apps. Supervisor mode (S) is what Linux needs. A microcontroller running a while-loop in M-mode is still honest RISC-V; it is just not a Linux laptop.
| Myth | Accurate version |
|---|---|
| “RISC-V is a processor like Snapdragon.” | RISC-V is the ISA. Snapdragon is a product family. Some SoCs include RISC-V cores; many phones are still ARM. |
| “Open means the chip is free.” | The spec is royalty-free. Silicon, verification, and software still cost real money. |
| “32 registers means 32 bits total.” | 32 boxes, each 32-bit (RV32) or 64-bit (RV64). |
| “Registers are a kind of RAM.” | Registers are on-core storage. RAM is a separate, much larger array of bytes. |
| “RISC-V has no multiply.” | The I base has no multiply. The M extension does. Check the chip’s string (RV32IM…). |
| “It will replace ARM and Intel next year.” | It is growing in MCUs, custom chips, and research. Dominant phone/PC ISAs do not vanish on a slogan. |
lw/sw (and friends) for memory.sp; caches are speed, not extra ISA registers.An open instruction set architecture: the public list of instructions and registers a compatible CPU must provide. Not a single brand of chip and not an OS.
The core fetches an instruction from the PC address, decodes it, then executes it. Maths uses registers. RAM is only touched by load and store. After a 32-bit instruction the PC usually adds 4.
The 32-bit RISC-V base integer ISA: 32 registers that are 32 bits wide, plus integer ALU, loads/stores, branches and jumps. Extra letters (M, F, C…) are optional kits.
RV32I/RV64I: 32 integer registers x0–x31 plus a separate PC. RV32E: 16 integer registers. Optional F/D add 32 floating-point registers.
It is hardwired. Reads return 0; writes are ignored. That gives a free constant and simplifies encodings (copy, compare to zero, discard results).
The ISA is an open royalty-free standard. A given chip’s RTL might be open or proprietary. Open spec ≠ free silicon.
As bytes in memory (often flash or RAM). The PC holds the address of the instruction being fetched. After a 32-bit instruction, the PC normally moves forward by 4 bytes.
Different question: RISC-V wins on an open, modular spec; ARM wins on a huge mature software and core ecosystem. See our RISC-V vs ARM article for a fair comparison.
Yes — the ISA is open. Our free course RISC-V from Scratch builds a teaching RV32I core in Verilog. That is a learning core, not a phone SoC.