Skip to main content

Instruction Set Architecture (ISA)

Overviewโ€‹

An Instruction Set Architecture is the set of instructions a CPU can execute, plus the rules for how they're encoded as bits, what registers exist, and how memory is addressed. It's a contract: software compiled for an ISA will run correctly on any chip implementing that ISA, no matter how different the internal microarchitecture is. x86-64, ARM64 (AArch64), and RISC-V are the three ISAs you'll encounter most often today.

Core Conceptsโ€‹

TermMeaning
OpcodeThe part of an instruction's encoding that identifies which operation to perform.
OperandA value an instruction acts on โ€” a register, a memory address, or a literal constant.
Addressing modeHow an instruction specifies where an operand lives (register, immediate, memory, memory+offset...).
Register fileThe set of named, fixed-size storage slots the ISA exposes (e.g., x86-64 has 16 general-purpose 64-bit registers).
Machine codeThe raw binary encoding of instructions โ€” what the CPU actually fetches and decodes.
Assembly languageA human-readable, near 1:1 text representation of machine code (see Assembly).

CISC vs. RISCโ€‹

AspectCISC (x86-64)RISC (ARM64 / RISC-V)
Instruction countLarge, with complex addressing modesSmall, orthogonal instruction set
EncodingVariable lengthFixed length (simpler to decode)
Memory accessMany instructions can touch memory directlyOnly explicit load/store instructions touch memory
Typical useDesktops, servers (x86-64)Mobile, embedded, and increasingly servers/desktops (Apple Silicon, AWS Graviton)
Design tradeoffDenser code, more complex decode hardwareSimpler decode, relies on the compiler to schedule instructions well
The distinction has blurred

Modern x86-64 chips decode CISC instructions into simpler internal micro-ops (ยตops) and execute those with a RISC-like pipeline internally. The CISC/RISC label today says more about the external instruction encoding than about the actual execution hardware.

Practical Usage: Reading an Instructionโ€‹

An x86-64 instruction like add rax, rbx (add register rbx into register rax) is encoded roughly as:

48 01 D8
โ”‚ โ”‚ โ””โ”€ ModRM byte: encodes operands (rax, rbx) and addressing mode
โ”‚ โ””โ”€โ”€โ”€โ”€ Opcode: 01 = ADD, operand direction registerโ†’register/memory
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€ REX prefix: 48 = 64-bit operand size

The CPU's decode stage reverses this: split the byte stream into prefix, opcode, and operand-encoding fields, then figure out which registers and which operation are involved. This is one reason variable-length CISC decoding is more complex than fixed-length RISC decoding โ€” the decoder doesn't know how many bytes the next instruction will need until it has decoded the current one.

Edge Cases & Pitfallsโ€‹

ISA extensions fragment the landscape

Not every x86-64 CPU supports every instruction. Extensions like AVX-512 (wide vector math) or AES-NI (hardware AES) must be feature-detected at runtime (CPUID on x86) before use, or the program will crash with an illegal-instruction fault on older/different hardware.

  • Endianness is part of the ISA contract: x86-64 and ARM64 are little-endian by default (least significant byte first in memory), which matters when reading raw memory dumps or writing cross-platform binary formats.
  • Cross-compiling for a different ISA (e.g., building ARM64 binaries on an x86-64 machine) fails at the instruction encoding level if you accidentally link against a library built for the wrong ISA.

Comparisonsโ€‹

ISABit widthTypical domainLicensing
x86-6464-bitDesktops, servers, gamingProprietary (Intel/AMD)
ARM64 (AArch64)64-bitMobile, Apple Silicon, AWS GravitonLicensed IP (Arm Holdings)
RISC-V32/64/128-bitEmbedded, academia, growing server interestOpen, royalty-free

Referencesโ€‹

Books & Videosโ€‹

  • David Patterson & Andrew Waterman, The RISC-V Reader โ€” a short, approachable book contrasting RISC-V's design decisions against x86 and ARM.
  • Compiler Explorer โ€” paste C/C++/Rust code and see the exact x86-64, ARM64, or RISC-V instructions it compiles to, side by side.