Skip to content
BetterDL

Datapath

Also called: data path

The part of a CPU that holds and transforms data: registers, the ALU, multiplexers and the connections to memory.

A CPU has two halves. The datapath is the part that does the work: it stores values and moves and transforms them. The control unit is the part that decides what the datapath does in each clock cycle.

In Tiny8, the datapath contains:

  • the registers: PC, IR, MAR, MDR and the accumulator (plus the zero flag);
  • the ALU, which adds or subtracts;
  • a multiplexer in front of every register that can be loaded from more than one place;
  • the wires to and from memory.

One way to picture it: the datapath is a rail yard. Wires are tracks, registers are sidings where values wait, and multiplexers are switches that choose which track a value takes. The yard moves nothing by itself; the control signals are the signal operator setting every switch before each clock edge.

If a transfer you need has no wire from source to destination, the datapath must change. That's the first thing to check when adding an instruction.

Worked example

Example

Following an ADD through the datapath

Tiny8 executes ADD 9 with ACC = 4 and M[9] = 6. Which datapath parts take part in the execute steps?

  1. 1.

    E1, MDR ← M[MAR]: memory's address comes from the MAR (which holds 9), and the MDR's mux picks memory. MDR = 6.

  2. 2.

    E2, ACC ← ACC + MDR: the ALU's inputs are ACC and MDR, and it adds them: 4 + 6 = 10.

  3. 3.

    The ACC's mux picks the ALU output, so ACC = 10. Z = 0 because the result isn't zero.

  4. 4.

    The control unit took part only by setting signals. Every value moved through the datapath.

Common mistakes

  • Putting the control FSM in the datapath. It decides; it doesn't hold or transform data.

  • Assuming any register can feed any other. Only the wires that exist can carry a transfer.

Practice Datapath

Interactive questions with instant feedback and a worked solution for every wrong answer.

Learn it step by step

Datapath is taught in Basic CPU / Computer Architecture.