Instruction Set Architecture

The contract between hardware and software — instruction types, formats, addressing modes, registers, calling conventions, and how x86, ARM and RISC-V differ.

Intermediate 4 min readLesson 6 of 15

The instruction set architecture (ISA) is the interface between software and hardware: the instructions, registers, memory model and encodings a CPU promises to support. Compilers target the ISA; chip designers are free to implement it however they like. That's why the same binary runs on a cheap laptop chip and a server CPU.

Softwarecompilers, OS, applicationsISA (the contract)instructions · registers · memory model · encodingMicroarchitecturepipelines, caches, predictors — invisible to software

What an ISA defines

  • Instructions and what each does.
  • Registers: how many, how wide, special roles (stack pointer, zero register…).
  • Data types: integer widths, floating point, vectors.
  • Addressing modes: how instructions name memory locations.
  • Encoding: how instructions become bits.
  • Memory model: endianness, alignment, and ordering rules between cores.
  • Privilege levels, interrupts and exceptions.

Instruction categories

CategoryExamples (RISC-V)Does
Arithmetic / logicadd, sub, and, or, sllCompute on registers
Immediateaddi x5, x5, 1Use a constant in the instruction
Data transferlw (load word), sw (store word)Move between registers and memory
Control flowbeq, bne, jal, jalrBranch, jump, call, return
Systemecall, csrrwSystem calls, control registers

Instruction formats (RISC-V)

Fixed 32-bit instructions with fields in the same positions make decoding fast and simple.

00000000011000101000001010110011funct7rs2rs1funct3rdopcode
R-type: add x5, x5, x6
FormatUsed forFields
Rregister–register opsrd, rs1, rs2
Iimmediates, loadsrd, rs1, 12-bit immediate
Sstoresrs1, rs2, 12-bit offset
Bbranchesrs1, rs2, 13-bit offset
U / Jlarge constants, jumpsrd, 20-bit immediate

Addressing modes

ModeMeaningExample
ImmediateThe operand is in the instructionaddi x1, x0, 42
RegisterThe operand is in a registeradd x1, x2, x3
Base + offsetMemory at register + constantlw x1, 8(x2) → field at offset 8 of a struct
PC-relativeRelative to the current instructionBranches, position-independent code
Indexed / scaled (x86)base + index × scale + dispmov eax, [rbx + rcx*4 + 16] → arr[i]

Comparing the big three

x86-64ARM64 (AArch64)RISC-V
StyleCISCRISCRISC
Instruction length1–15 bytes4 bytes4 bytes (2 with the compressed extension)
General registers1631 + zero register31 + x0 hardwired to 0
Memory operands in ALU opsYesNo (load/store)No (load/store)
LicensingIntel/AMD onlyLicensed by ArmOpen, royalty-free
WherePCs, serversPhones, Apple M-series, cloudEmbedded, growing everywhere

Calling conventions

An ABI (application binary interface) extends the ISA with rules so separately compiled code can call each other: which registers hold arguments and return values, who saves which registers, and how the stack is laid out.

x86-64 System V (Linux/macOS)RISC-V
Integer argumentsrdi, rsi, rdx, rcx, r8, r9a0–a7
Return valueraxa0 (a1)
Callee-savedrbx, rbp, r12–r15s0–s11
Return addressPushed on the stack by callRegister ra

Extensions

ISAs grow through extensions: SIMD (x86 SSE/AVX/AVX-512, ARM NEON/SVE, RISC-V V) processes 4–64 values per instruction; there are also crypto instructions (AES-NI), atomics, and matrix extensions for ML (Intel AMX, ARM SME). A compiler flag like -march=native lets it use whatever your CPU supports.

Key takeaways
  • The ISA is the hardware/software contract; microarchitecture is the hidden implementation.
  • RISC: fixed-length instructions, load/store; CISC: variable-length instructions, memory operands.
  • Addressing modes map directly to code patterns (struct fields, arrays, PC-relative jumps).
  • The ABI/calling convention defines argument registers and who saves what.
  • RISC-V is open; ARM dominates mobile and is growing in servers; x86 dominates PCs.