Courses / Computer Science I
Basic Digital Design

Sequential Logic and State

Computer Science I 335 words Free to read

Circuits That Remember

Combinational circuits are memoryless — the same inputs always give the same outputs. But a computer must remember: a register holds a value, a counter tracks a count. Sequential logic adds state — the circuit's output depends not only on current inputs but on stored information about the past.

Memory in hardware comes from feedback: an output is wired back to an input, so the circuit can hold a value. The simplest memory element is a latch, which can store one bit. Left alone, it keeps its stored bit; with the right inputs, it can be set to 1 or reset to 0.

Uncontrolled feedback is chaotic, so real designs are synchronous: governed by a clock, a signal that ticks at a fixed rate. State updates happen only at a clock edge (the rising or falling transition), so the whole system advances in lock-step, one well-defined step per tick. Between edges, combinational logic settles; at each edge, the new state is captured. This discipline is what makes complex digital systems predictable.

The general shape of a sequential system is a finite state machine (FSM): a set of states, plus rules that, given the current state and inputs, determine the next state and the outputs. A traffic light, a vending machine, and a CPU's control unit are all finite state machines. The state register (built from flip-flops, next lesson) holds the current state; combinational logic computes the next state; the clock advances it.

Common pitfall: thinking a sequential circuit responds to its inputs continuously, like combinational logic. In a synchronous design, state changes only at clock edges — inputs are sampled and the state advances one step per tick. Reasoning about a sequential circuit means reasoning tick by tick, not moment by moment.

A finite state machine drawn as labeled state circles with transition arrows; an accent "current state" token hops from state to state on each clock-edge pulse, showing state advancing one step per tick.

next state=f(state,input)\text{next state} = f(\text{state}, \text{input})

Sequential Logic and State

Practise this lesson

The explanation above is free to read. The graded practice for this lesson lives in the Tryals app.

10practice questions
2interactive scenes
Start Computer Science I free

Basic Digital Design