Skip to main content
Be Bitwise

RISC-V Extensions & Modularity

RISC-V Architecture Deep Dive · CPU Architectures track

4 min read

In this module

Build What You Need

RISC-V's most original feature is its modular extension system. Instead of defining one massive instruction set that every implementation has to support (as x86 does), RISC-V defines a minimal base and lets designers bolt on exactly the extensions they need. A tiny microcontroller in a thermostat and a high-performance server processor can both be RISC-V; they just ship different extensions.

Extension Naming Convention

RISC-V extensions are identified by single letters. The base is I (integer). Common extensions include M (multiply/divide), A (atomic operations), F (single-precision float), D (double-precision float), and C (compressed 16-bit instructions). A processor's capability is described by concatenating these letters: RV64GC means a 64-bit processor implementing the "G" (general) set plus compressed instructions. The "G" shorthand equals I+M+A+F+D plus the small Zicsr and Zifencei extensions - the combination expected for general-purpose computing.

The Standard Extensions

ExtensionLetterWhat It Adds
Integer Multiply/DivideMMUL, DIV, REM instructions
Atomic OperationsALoad-reserved/store-conditional, atomic memory operations for multi-core synchronisation
Single-Precision FloatF32 floating-point registers (f0-f31), float arithmetic
Double-Precision FloatDDouble-precision floating-point operations (extends F)
Compressed InstructionsC16-bit encodings for common instructions, improving code density
VectorVScalable vector processing for SIMD workloads

Why Modularity Matters

Look at the range of devices that need processors:

  • A smart light bulb needs nothing more than basic integer operations. RV32I on its own might be enough. No multiply, no float, no atomics. The chip can be tiny and cheap.
  • A microcontroller running a motor needs integer maths with multiplication. RV32IM adds exactly that.
  • A smartphone processor wants general-purpose computing with floating-point and multi-core support. RV64GC covers it.
  • A server processor wants all of the above plus vector operations. That's RV64GCV.

With x86, every processor has to implement the full (enormous) instruction set. With ARM there's some configurability, but the base is still substantial. RISC-V lets each designer dial in precisely the right feature set for the target market.

The Compressed Extension (C)

The C extension deserves a closer look. It provides 16-bit encodings for the most common instructions: loads, stores, branches, and arithmetic on the most-used registers. The idea is similar to ARM's Thumb mode, but designed from day one to interleave freely with 32-bit instructions. No mode switching needed.

The payoff is code density competitive with x86 and Thumb-2, even though the base ISA is fixed 32-bit. The decoder just checks a 2-bit field to figure out whether the current instruction is 16 or 32 bits wide.

That field is the lowest two bits. Here's the same operation, add 1 to a0, in both sizes:

text
addi a0, a0, 1 00150513 ...0101 0001 0011 low bits 11: 32-bit instruction
c.addi a0, 1 0505 ...0000 0101 low bits 01: 16-bit instruction

Any value other than 11 in those two bits means a 16-bit instruction, so the decoder knows the length after looking at a single byte. Assemblers pick the short form automatically when the C extension is enabled, and it only exists for common cases: c.addi can only add a small immediate, between -32 and 31, to a register in place.

Custom Extensions

This is where RISC-V really stands alone among major ISAs. The specification reserves opcode space specifically for custom extensions. A company building an AI accelerator can add custom instructions for matrix multiplication. A cryptography vendor can ship hardware AES or SHA. A signal-processing house can drop in DSP instructions of its own.

These custom instructions run alongside standard RISC-V code in the same program. The compiler emits standard RISC-V for most things and slots in the custom instructions where the accelerator helps. Arm has since opened a narrow door of its own (Arm Custom Instructions, on some Cortex-M cores), but no other major ISA builds this kind of extensibility into the base design.

The "G" Shorthand

When you see RV64GC, the "G" stands for "general purpose" and is shorthand for I+M+A+F+D, plus Zicsr (control and status registers) and Zifencei (instruction-fetch fence), which were split out of the base in later versions of the spec. That's the combination you'd expect to run a general-purpose operating system like Linux. The "C" adds compressed instructions for better code density. RV64GC is roughly the RISC-V equivalent of what a modern ARM or x86 processor offers, instruction-set-wise.

All that choice has a cost: software can't assume much about a chip it hasn't seen. RISC-V International's answer is profiles, fixed bundles of extensions that operating systems and distributions can target. The RVA23 profile, ratified in 2024, requires vectors (V), the bit-manipulation extensions (Zba, Zbb, Zbs) and, for supervisor-level software, the hypervisor extension (H), on top of G and C.