Logic circuits use two different values of a physical quantity, usually voltage, to represent the boolean values true (or 1) and false (or 0). Logic circuits can have inputs and they have one or more outputs that are, at least partially, dependent on their inputs. In logic circuit diagrams, connections from one circuit's output to another circuit's input are often shown with an arrowhead at the input end.

In terms of their behavior, logic circuits are much like programming language functions or methods. Their inputs are analogous to function parameters and their outputs are analogous to function returned values. However, a logic circuit can have multiple outputs.

There are two basic types of logic circuitry: combinational circuitry and state circuitry.

These two types of circuitry work together to make up a processor datapath.

Processor Datapath

A processor's datapath is conceptually organized into two parts:

This diagram, like most diagrams on this web site, adheres to the following conventions:

Combinational Circuitry

The output of combinational circuitry depends only on the current values of its input. Combinational circuitry is conceptually constructed from basic logic gates: AND gates, OR gates, XOR gates, and inverters. The outputs of gates in combinational circuitry is never fed back directly to earlier inputs.

Basic logic gates can be combined to form a variety of higher-level units:

Adders, subtracters, and comparators are not described here. They are described in Integer Addition and Subtraction.

State Circuitry

The output of state circuitry does not just depend on its input — it also depends on the past history of its inputs. In other words, the circuitry has memory.

State circuitry includes anything that can "remember" bits of information. This includes memory, registers, and the program counter.

The basic element of state circuitry is a flip-flop. A flip-flop stores one bit of data. Multiple flip-flops can be combined to form a multi-bit state element called a register. Multiple registers can be combined into a register bank.

Flip-Flops

The flip-flop is the basic element of state circuitry. It has three inputs:

A flip-flop has a single output:

Flip-Flop Implementation

Registers

A register is just a multi-bit analog of flip-flop. It has three inputs:

A register has a single output:

These are the same inputs and output that a flip-flop has. The only difference is that the D input and the Q output are multi-bit signals.

As shown to the left, a register is implemented as a group of flip-flops that share their clock and enable signals.

Register Implementation

A register is implemented as a group of flip-flops that share their clock and enable signals.

Processor Datapath Control

Processor datapath control signals can be classified according to which part of the processor they control:

State Controls

All of the state elements are connected to the processor clock. Their state only changes at the start of a clock period. Control circuitry must generate the enable signals that control whether or not a state element changes state.

For example, many instructions write data to a destination register. The control signals need to enable a write to that register, but not enable a write to any of the other registers.

Combinational Logic Controls

The control signals for the combinational logic are frequently just controlling routing. Often these signals are applied to multiplexers.

For example, many instructions write a result to a register. A multiplexer is needed to select whether that data comes from a calculation (arithmetic and logic instructions) or from memory (load instructions).