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 moreCPU 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 ZeroThe Number ZeroCounting to FiveCounting to 10Counting to 20Counting a Set of Objects Up to 20Cardinality: The Last Number CountedMatching Numerals to QuantitiesSubitizing Small QuantitiesAddition Within 10Number Bonds to 10Addition Within 20Doubles and Near DoublesDoubles Facts Within 10Near Doubles Facts Within 20Mental Math Strategies for AdditionMental Math: Adding and Subtracting TensAddition Within 100Repeated Addition as MultiplicationMultiplication as Equal GroupsMultiplication: ArraysBasic Multiplication Facts (0s, 1s, 2s, 5s, 10s)Multiplication Facts Within 100Division as Equal SharingDivision as Grouping (Measurement Division)Division: Grouping (Repeated Subtraction) ModelDivision: Fair Sharing ModelDivision as Equal SharingDivision as GroupingBasic Division FactsDivision Facts Within 100Multiplication and Division Fact FamiliesRelationship Between Multiplication and DivisionDivision Facts as Inverse of MultiplicationRemainders and Quotients in DivisionDivision Word ProblemsMulti-Step Word ProblemsSolving Multi-Step Word ProblemsMultiplication Word ProblemsDivision Word ProblemsIntroduction to Long DivisionFactors and MultiplesPrime and Composite NumbersEquivalent FractionsRelating Fractions and DecimalsDecimal Place ValueIntegers and the Number LineComparing and Ordering IntegersAbsolute ValueAdding IntegersSubtracting IntegersMultiplying IntegersIntroduction to ExponentsOrder of OperationsInteger Order of OperationsVariable ExpressionsThe Distributive PropertyVariables and Expressions ReviewIntroduction to PolynomialsAdding and Subtracting PolynomialsMultiplying PolynomialsFactorialPermutationsCombinationsCounting Principles: Addition and Multiplication RulesIntroduction to Graph TheoryPropositional Logic FoundationsLogical EquivalencesBoolean AlgebraBoolean Type and Truth ValuesComparison Operators and Boolean TestsLogical Operators and Boolean AlgebraBoolean Algebra and Fundamental LawsLogic Gates FundamentalsImplementing Boolean Functions with GatesKarnaugh Map SimplificationCombinational Circuit DesignFlip-Flops and LatchesBinary Counters: Design and AnalysisBinary ArithmeticFixed-Point Number RepresentationTwo's Complement RepresentationOverflow and Underflow DetectionBinary Adders: Half-Adders and Full-AddersFull Adder and Carry PropagationCarry Lookahead Adder DesignHalf Adder Circuit DesignMultiplication Circuit DesignSequential Circuit DesignRegisters and Register FilesInstruction Set Architecture (ISA)Assembly Language BasicsCPU Datapath

Longest path: 93 steps · 355 total prerequisite topics

Prerequisites (7)

Leads To (6)