In digital circuit theory, sequential logic is a type of logic circuit whose output depends not only on the present input but also on the history of the input. This is in contrast to combinatorial logic, whose output is a function of, and only of, the present input. In other words, sequential logic has storage (memory) while combinatorial logic does not.
Sequential logic is therefore used to construct some types of computer memory, other types of delay and storage elements, and finite state machines. Most practical computer circuits are a mixture of combinatorial and sequential logic.
There are two types of finite state machine that can be built from sequential logic circuits:
- Moore machine: the output depends only on the internal state. (Since the internal state only changes on a clock edge, the output only changes on a clock edge).
- Mealy machine: the output depends not only on the internal state, but also on the inputs.
Synchronous sequential logic
Nearly all sequential logic today is 'clocked' or 'synchronous logic' logic: there is a 'clock' signal, and all internal memory (the 'internal state') changes only on a clock edge. The basic storage element in sequential logic is the flip-flop.
The main advantage of synchronous logic is its simplicity. Every operation in the circuit must be completed inside a fixed interval of time between two clock pulses, called a 'clock cycle'. As long as this condition is met (ignoring certain other details), the circuit is guaranteed to be reliable.
Synchronous logic also has two main disadvantages, as follows.
- The clock signal must be distributed to every flip-flop in the circuit. As the clock is usually a high-frequency signal, this causes power dissipation - in other words, heat. Even the flip-flops that are doing nothing consume a small amount of power, thereby generating waste heat.
- The maximum possible clock rate is determined by the slowest logic path in the circuit, otherwise known as the critical path. This means that every logical calculation, from the simplest to the most complex, must complete in one clock cycle. One way around this limitation is to split complex operations into several simple operations, a technique known as 'pipelining'. This technique is prominent within microprocessor design, and helps to improve the clock rate of modern processors.
Asynchronous sequential logic
Asynchronous sequential logic is the most general kind of sequential logic, but because of its flexibility it is also the most difficult kind to design. The basic storage element in asynchronous logic is the latch. Latches can change state at any time, depending on the transitions of other signals which may themselves be produced by other latches. The complexity of asynchronous circuits tends to rise very rapidly as the number of logic gates increases, so they tend to be used mostly in smaller applications. However, computer-aided design tools are appearing that can simplify the task, and permit more complex designs.
It is possible to build mixed circuits containing synchronous flip-flops and asynchronous latches.