Skip to content
Tutorials Center
My learning

Topics

Lesson 56 of 67 ยท Real-World Machines and Performance

Inside Modern Processors: x86, ARM and RISC-V

Tour real microarchitecture: how x86, ARM and RISC-V cores differ, what a system-on-chip contains, why accelerators multiply, and where chip design is heading.

You have now met every major idea in a processor: instruction sets, datapaths, pipelines, branch prediction, out-of-order execution, caches, virtual memory and parallelism. A real chip is all of these ideas working together, tuned by thousands of engineers. This lesson is a guided tour of how they show up in the three instruction set families you will meet most: x86-64, ARM (AArch64) and RISC-V, and in the system-on-chip (SoC) that surrounds the cores.

The lesson is mostly read-only, because you cannot run an x86 or ARM chip's internals in the browser. The two examples are honest stand-ins: one decodes real machine code bytes, the other makes a simple growth projection. Exact figures for specific products change every year, so the focus is on the structure. It builds on Instruction Set Architecture and Superscalar, Out-of-Order and Speculative Execution.

ISA versus microarchitecture, again

Recall the distinction from the start of this track. The ISA is the contract with software: registers, instructions, memory model. The microarchitecture is the hardware design that implements the contract: pipeline depth, issue width, cache sizes, predictors. Two chips from different companies can run the same ISA with very different microarchitectures, and one company can ship several microarchitectures for the same ISA. A program compiled for x86-64 runs on an Intel chip, an AMD chip, or a very old design, because they all honor the same contract, yet their speed and power can differ widely.

The three families

x86-64

x86 started with Intel's 8086 in 1978 and has been extended for decades while staying backward compatible. The 64-bit version, x86-64, was introduced by AMD and adopted by Intel. It is a CISC design: instructions have variable length (from 1 to 15 bytes), many can read memory directly as an operand, and there are 16 general-purpose registers. Intel and AMD (and a few others) make x86 chips, mostly for PCs, laptops and servers.

Variable-length instructions make decoding hard, because you only find where one instruction ends by examining it. So modern x86 cores contain a complicated front end that translates each instruction into simple, fixed-size internal operations called micro-ops. Everything after the front end looks much like a RISC machine. Many cores also keep a small micro-op cache, so frequently run loops skip the decoders and save power.

ARM (AArch64)

ARM chips use the 64-bit AArch64 instruction set: a RISC design with fixed 32-bit instructions, 31 general-purpose registers, and a clean load/store model (only load and store instructions touch memory). ARM Ltd. mostly licenses designs instead of making chips. Some customers license ready-made core designs; others, like Apple and Qualcomm, license the architecture and build their own cores. That is why ARM chips appear in phones, tablets, laptops, cars and servers, with very different performance levels.

Fixed-length instructions make wide decoding easy: the hardware knows where every instruction starts without looking at it. That helps very wide designs which can decode and issue many instructions per cycle.

RISC-V

RISC-V began as a university project at UC Berkeley around 2010 and is now an open standard: anyone can build a RISC-V processor without paying license fees. It is deliberately small and modular. A base integer set (such as RV32I or RV64I) is the same everywhere, and optional extensions add features: M (multiply and divide), A (atomics), F and D (floating point), C (16-bit compressed instructions) and V (vectors). It has 32 integer registers, regular instruction formats, and no flags register. RISC-V is used in microcontrollers, storage controllers, research and teaching, and is growing in embedded, accelerator and server products.

x86-64 ARM AArch64 RISC-V
Style CISC RISC RISC
Instruction length 1 to 15 bytes 4 bytes 4 bytes (2 with compressed)
General registers 16 31 plus zero/stack register 31 plus the zero register x0
Memory operands in arithmetic Allowed No (load/store) No (load/store)
Condition flags Yes Yes No (branches compare registers)
Who can build chips Few companies Licensees Anyone
Typical use PCs, servers Phones, laptops, servers Embedded, emerging servers

The old argument "RISC is faster than CISC" has faded. What matters today is the quality of the microarchitecture, the manufacturing process and the software ecosystem. x86 pays an extra cost in decoder complexity and power; ARM and RISC-V benefit from simpler decoding, but the compilers, operating systems and applications must also be ported.

Reading real machine code

Because a fixed-length ISA is so regular, decoding it takes a few bit operations. Variable-length code needs sequential steps. The next example shows both with real encodings: first it walks through genuine x86-64 bytes of a small function (the standard frame setup, a load, an add and a return), where it must work out each instruction's length from its first byte; then it encodes and decodes RISC-V instructions by slicing fixed fields.

Python Variable length versus fixed length decoding

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The RISC-V decoder reads the same bit positions for every word, so a wide core can decode eight words at once. The x86 loop has to find instruction boundaries one by one (real decoders use clever tricks to guess boundaries in parallel, which is part of the cost). Also compare density: the six x86 instructions take 13 bytes here, while the same count of fixed-length instructions takes 24 bytes. Variable-length encoding can be compact, but it is harder to decode.

Inside a high-performance core

Whatever the ISA, a modern big core has the same stages you saw in earlier lessons, only wider and deeper:

flowchart LR
  BP["Branch predictor<br/>+ fetch"] --> DEC["Decode<br/>(to micro-ops)"]
  DEC --> REN["Rename<br/>+ reorder buffer"]
  REN --> SCH["Schedulers"]
  SCH --> EX["Execution units<br/>ALUs, FP, vector,<br/>load/store"]
  EX --> L1["L1 data cache"]
  L1 --> L2["L2 cache"]
  L2 --> L3["Shared L3 / memory"]
  EX --> RET["Retire in order"]

The pipeline of a typical out-of-order core, from prediction to retirement.

  • Front end: a large branch predictor runs ahead of the pipeline, steering instruction fetch. A misprediction costs a pipeline flush, so predictors are among the most sophisticated parts of the chip.
  • Wide decode and rename: current high-end cores handle between four and eight instructions per cycle. Register renaming maps the few architectural registers onto a pool of hundreds of physical registers, removing false dependencies.
  • Out-of-order window: a reorder buffer with hundreds of entries lets the core look far ahead for independent work and hide cache-miss delays.
  • Execution units: several integer ALUs, floating-point and vector units, and multiple load and store ports.
  • Cache hierarchy: private L1 and L2 caches per core, a shared L3, and a TLB hierarchy for virtual memory. Hardware prefetchers guess the next addresses.
  • Security: speculative execution can leak data through caches (Spectre-style attacks), so modern cores include mitigations, and operating systems add more. These cost some performance.

From core to system-on-chip

A phone or laptop chip is rarely just a CPU. It is a system-on-chip (SoC): one piece of silicon, or several packaged together, that contains almost everything.

flowchart TB
  subgraph SoC
    subgraph CPUs
      P["Performance cores"]
      E["Efficiency cores"]
    end
    GPU["GPU"]
    NPU["Neural engine / NPU"]
    MEDIA["Video encode / decode"]
    ISP["Image signal processor"]
    SEC["Security / crypto"]
    CACHE["Shared cache"]
    MC["Memory controller"]
    IO["PCIe, USB, display, radios"]
  end
  CPUs --- CACHE
  GPU --- CACHE
  NPU --- CACHE
  MEDIA --- CACHE
  ISP --- CACHE
  CACHE --- MC
  MC --- DRAM["DRAM"]
  CACHE --- IO

Units on an SoC share a cache and a memory controller.

Several design ideas appear in almost every SoC:

  • Heterogeneous cores: performance and efficiency cores, as in the power lesson.
  • Unified memory: CPU, GPU and accelerators use the same DRAM, so data does not have to be copied between separate memories. Some designs go further and place the DRAM in the same package as the chip.
  • Accelerators: fixed-function or specialized blocks for video codecs, image processing, cryptography, machine-learning math (NPUs, tensor units) and signal processing. They do their job with a fraction of the energy of a general core, which is the best use of "dark silicon".
  • Chiplets: instead of one huge die, manufacturers connect several smaller dies inside one package. Small dies have higher manufacturing yield and can use different processes (for example, compute chiplets on the newest process and I/O chiplets on an older one). Some chips also stack extra cache vertically on top of the compute die.
  • Specialization over generality. With clock rates flat and power limited, performance gains come from adding the right unit for the job: matrix engines for AI, vector extensions (AVX-512, SVE2, RISC-V Vector), and codecs.
  • Packaging and memory. Chiplets, 3D stacking and high-bandwidth memory move the bottleneck from the transistor to the wire and the package. Newer interconnects such as CXL aim to share memory pools across devices.
  • Heterogeneous scheduling. Operating systems and hardware cooperate to place threads on the right core type.
  • Security and confidentiality. Hardware features isolate virtual machines and encrypt memory, and designs try to prevent speculation leaks.
  • Open hardware. RISC-V lowers the barrier for custom processors, especially for embedded and accelerator use.
  • Exponential growth, slowing. The number of transistors per chip still grows, but more slowly and more expensively than the classic doubling every two years.

The last example is a back-of-the-envelope projection. Start with Intel's first microprocessor, the 4004 (1971), which had about 2,300 transistors. If the count doubled every two years, what would 2023 look like?

Python Projecting the doubling of transistors

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The projection lands within the same order of magnitude as real products, which is why this pattern, known as Moore's law, guided the industry for so long. But note what changed: in the early decades the extra transistors became higher clock rates and bigger single cores, while today they become more cores, caches and accelerators.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. Why do x86 cores translate instructions into micro-ops?

    The front end decodes x86 instructions into simple fixed-size micro-ops; the rest of the pipeline works much like a RISC core.
  2. 2. Which feature makes AArch64 and RISC-V easier to decode in parallel than x86?

    With fixed 32-bit instructions the hardware knows where each one starts without decoding the previous ones.
  3. 3. What is the main difference in business model between ARM and RISC-V?

    ARM Ltd. licenses cores and the architecture to chip makers, while RISC-V is an open ISA managed by a non-profit organization.
  4. 4. What is an SoC?

    A system-on-chip puts most of a computer's components together, often with shared memory and heterogeneous cores.
  5. 5. Why are accelerators so common in modern chips?

    When power, not transistor count, is the limit, specialized units give more work per joule and use the otherwise dark silicon productively.

Summary

  • The ISA is the contract; microarchitecture is the implementation. Many designs can honor the same ISA.
  • x86-64 is variable-length CISC that decodes to micro-ops; AArch64 and RISC-V are fixed-length RISC with simple decoding. RISC-V is open and modular.
  • A modern big core has a large branch predictor, wide decode and rename, a big out-of-order window, several execution units and a three-level cache, plus mitigations for speculation attacks.
  • SoCs combine heterogeneous CPU clusters, GPU, accelerators, unified memory and I/O, increasingly built from chiplets and stacked dies.
  • Transistor counts keep growing but clock rates do not, so progress now comes from parallelism, specialization and packaging.

Continue with Writing Cache- and CPU-Friendly Code.