A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

CPU Datapath

College Depth 92 in the knowledge graph ☐ I know this ☆ Set as goal
60topics build on this
355prerequisites beneath it
See this on the map →
Arithmetic Logic Unit (ALU)Multiplexers and Demultiplexers+5 more→→CPU Control UnitCPU Pipelining+4 more
datapath CPU fetch-decode-execute microarchitecture

Core Idea

The CPU datapath is the collection of functional units and interconnects that carry data during instruction execution: the register file, ALU, program counter, instruction register, and data/address buses. Instructions follow a fetch-decode-execute cycle — the program counter addresses instruction memory, the fetched instruction is decoded into control signals, and operands flow through the ALU to produce a result that is written back to a register or memory. The datapath layout determines which operations can be performed and how control signals must be routed.

How It's Best Learned

Trace a simple MIPS single-cycle datapath for ADD, LOAD, STORE, and BEQ instruction types. Draw the data flow for each and identify which MUX selections and control signals are needed. Build a datapath in a hardware simulator like Logisim.

Common Misconceptions

Explainer

The CPU datapath is best understood as a carefully arranged set of wires and functional units through which data travels on its way to becoming a result. The key components are the program counter (PC), which holds the address of the current instruction; instruction memory, which supplies the instruction bits; a register file, which stores operand values; the ALU, which performs arithmetic and logic; and data memory, which handles loads and stores. Multiplexers (MUXes) sit at critical junctions, selecting which data source to forward at any given moment.

Every instruction travels through a common sequence called the fetch-decode-execute cycle. In fetch, the PC's value is sent to instruction memory and the returned instruction bits are loaded into the instruction register; simultaneously, the PC increments (PC + 4 in a 32-bit word machine). In decode, the instruction bits are broken apart — the opcode identifies the operation type, and register numbers are extracted and sent to the register file to retrieve operand values. In execute, the ALU processes those operands. For R-type arithmetic instructions, the cycle ends with a write-back of the ALU result to the destination register.

Different instruction types diverge after the execute stage. A LOAD instruction uses the ALU to compute a memory address, then reads from data memory at that address, then writes the loaded value into a register — three distinct stages after decode. A STORE sends both an address (from the ALU) and a value (from a register) to data memory and writes nothing back. A branch instruction uses the ALU to test a condition and also computes the branch target address; if the condition is true, the PC is updated to the branch target instead of PC+4.

This is where MUXes become essential. The register file's write-data port might receive either an ALU result (for arithmetic) or data from memory (for loads) — a MUX selects between them based on the instruction type. The PC update might go to PC+4 or a branch target — another MUX. All of these selection signals come from the control unit, which decodes the opcode and drives every MUX and write-enable signal in the datapath. The datapath moves data; the control unit decides where it goes.

Understanding the single-cycle datapath is the foundation for understanding pipelining. In the single-cycle design, every instruction occupies the full clock period — even a simple ADD waits while the combinational logic settles through every stage. Pipelining overlaps these stages so that while one instruction is in the ALU, the next is being decoded and a third is being fetched. The same datapath hardware is reused, but now divided into pipeline registers that hold intermediate values between stages. The hazards that arise (data hazards, control hazards) are the direct consequence of trying to share this datapath across overlapping instructions.

Practice Questions 3 questions

Prerequisite Chain

Understanding Zero → The Number Zero → Counting to Five → Counting to 10 → Counting to 20 → Counting a Set of Objects Up to 20 → Cardinality: The Last Number Counted → Matching Numerals to Quantities → Subitizing Small Quantities → Addition Within 10 → Number Bonds to 10 → Addition Within 20 → Doubles and Near Doubles → Doubles Facts Within 10 → Near Doubles Facts Within 20 → Mental Math Strategies for Addition → Mental Math: Adding and Subtracting Tens → Addition Within 100 → Repeated Addition as Multiplication → Multiplication as Equal Groups → Multiplication: Arrays → Basic Multiplication Facts (0s, 1s, 2s, 5s, 10s) → Multiplication Facts Within 100 → Division as Equal Sharing → Division as Grouping (Measurement Division) → Division: Grouping (Repeated Subtraction) Model → Division: Fair Sharing Model → Division as Equal Sharing → Division as Grouping → Basic Division Facts → Division Facts Within 100 → Multiplication and Division Fact Families → Relationship Between Multiplication and Division → Division Facts as Inverse of Multiplication → Remainders and Quotients in Division → Division Word Problems → Multi-Step Word Problems → Solving Multi-Step Word Problems → Multiplication Word Problems → Division Word Problems → Introduction to Long Division → Factors and Multiples → Prime and Composite Numbers → Equivalent Fractions → Relating Fractions and Decimals → Decimal Place Value → Integers and the Number Line → Comparing and Ordering Integers → Absolute Value → Adding Integers → Subtracting Integers → Multiplying Integers → Introduction to Exponents → Order of Operations → Integer Order of Operations → Variable Expressions → The Distributive Property → Variables and Expressions Review → Introduction to Polynomials → Adding and Subtracting Polynomials → Multiplying Polynomials → Factorial → Permutations → Combinations → Counting Principles: Addition and Multiplication Rules → Introduction to Graph Theory → Propositional Logic Foundations → Logical Equivalences → Boolean Algebra → Boolean Type and Truth Values → Comparison Operators and Boolean Tests → Logical Operators and Boolean Algebra → Boolean Algebra and Fundamental Laws → Logic Gates Fundamentals → Implementing Boolean Functions with Gates → Karnaugh Map Simplification → Combinational Circuit Design → Flip-Flops and Latches → Binary Counters: Design and Analysis → Binary Arithmetic → Fixed-Point Number Representation → Two's Complement Representation → Overflow and Underflow Detection → Binary Adders: Half-Adders and Full-Adders → Full Adder and Carry Propagation → Carry Lookahead Adder Design → Half Adder Circuit Design → Multiplication Circuit Design → Sequential Circuit Design → Registers and Register Files → Instruction Set Architecture (ISA) → Assembly Language Basics → CPU Datapath

Longest path: 93 steps · 355 total prerequisite topics

Prerequisites (7)

Leads To (6)