Sequential Circuits

definitions
computer-systems
digital-logic
sequential-logic

A sequential circuit is a circuit whose output depends not only on the current inputs but also on the values it is currently storing. The storage is done with flip-flops — see flip-flops-and-latches for the storage elements themselves.

Combinational vs sequential

Combinational Sequential
Contents Logic gates only (no flip-flops) Includes flip-flops as well as logic gates
Output determined by The inputs alone — uniquely Current inputs and current state
Repeatability Same inputs always give the same output Same inputs can give different outputs, depending on state
When output changes Whenever an input changes Only when the clock ‘ticks’
Examples Adders, multiplexers, decoders, demultiplexers, encoders (see combinational-logic-blocks) Counters, registers (see counters, shift-registers)

A combinational example from earlier in the course: \(A\) into one input of an AND gate, \(B\) and \(C\) into an OR gate whose output feeds the AND gate’s other input, giving \(X = A(B+C)\). Nothing in that circuit remembers anything — change \(A\), \(B\) or \(C\) and the output follows immediately (after propagation delay; see timing-diagrams).

The key contrast: if an input to a combinational circuit changes, the output can change too and the previous value is lost forever. A sequential circuit can hold onto a value even after the input that produced it has gone away.

State

  • State = the value stored in the flip-flops.
  • Output depends on the inputs and the state.
  • Next state depends on the inputs and the (present) state.

“Present state” is what the flip-flops hold right now; “next state” is what they will hold after the next clock edge. The combinational logic computes the next state from the present state and the inputs; the flip-flops only adopt it when the clock edge arrives.

General structure of a sequential circuit

The standard block diagram has two blocks and a feedback loop:

  • A combinational circuit block (just logic gates). It takes the external inputs plus the feedback from the flip-flops, and produces the external outputs plus the values to be loaded into the flip-flops.
  • A flip-flops block (the storage elements). Its data inputs come from the combinational circuit; it also takes clock pulses as a separate control input.
  • A feedback path runs from the flip-flops’ outputs back around into the combinational circuit’s inputs. That loop is what makes the circuit sequential — the stored state is fed back in and influences the next output and the next state.

Note that the clock pulses go only to the flip-flops, not to the combinational logic.

Synchronous sequential circuits

In a synchronous sequential circuit the storage elements can only change at discrete instants of time, set by a common clock signal:

  • Assume a clock signal — a regularly repeating square wave alternating between 0 and 1.
  • The outputs of the storage elements change only on the edges of that control signal.
  • Contrast with logic gates, whose outputs change whenever their inputs change.

Because every flip-flop shares the same clock, the whole circuit’s state changes in one step at each clock edge, which is what makes such circuits tractable to design and analyse.