Sequential Circuits
COS2621 - Computer Organisation · Digital Logic Design
Sequential Circuits
Sequential circuits are a type of digital circuit whose output depends not only on the current inputs but also on the history of past inputs. This characteristic distinguishes them from combinational circuits, where the output is determined solely by the current inputs. Sequential circuits use memory elements to store information about past inputs.
Types of Sequential Circuits
There are two main types of sequential circuits: synchronous and asynchronous circuits.
Synchronous Circuits
Synchronous circuits change their state based on a clock signal. The clock signal synchronises the changes in the circuit, allowing for predictable timing. Common memory elements used in synchronous circuits include flip-flops and registers.
Flip-Flops
A flip-flop is a basic memory element that can store one bit of information. The most common types of flip-flops are the D flip-flop, JK flip-flop, and T flip-flop.
D Flip-Flop
The D flip-flop (Data flip-flop) captures the value of the input (D) at a specific moment in time, defined by the clock signal. When the clock signal transitions from low to high (rising edge), the output (Q) takes the value of the input (D).
Remember: The output of a D flip-flop is Q = D at the rising edge of the clock signal.
Example of a D Flip-Flop
Consider a D flip-flop with the following input sequence:
- Clock: 0, 0, 1, 1, 0, 1
- D: 0, 1, 1, 0, 1, 0
The output (Q) will change as follows:
Clock: 0 0 1 1 0 1
D: 0 1 1 0 1 0
Q: 0 0 1 1 1 0At the rising edge of the clock (positions 3 and 5), the output Q takes the value of D.
JK Flip-Flop
The JK flip-flop is a more versatile memory element. It has two inputs, J and K, and can perform different operations based on their values:
- If J = 0 and K = 0, the output remains unchanged.
- If J = 0 and K = 1, the output resets to 0.
- If J = 1 and K = 0, the output sets to 1.
- If J = 1 and K = 1, the output toggles between 0 and 1.
Example of a JK Flip-Flop
Consider a JK flip-flop with the following inputs:
- Clock: 0, 0, 1, 1, 0, 1
- J: 0, 1, 1, 0, 1, 1
- K: 0, 0, 1, 1, 0, 1
The output (Q) will change as follows:
Clock: 0 0 1 1 0 1
J: 0 1 1 0 1 1
K: 0 0 1 1 0 1
Q: 0 0 1 1 0 1At the rising edge of the clock (positions 3 and 5), the output Q changes according to the values of J and K.
T Flip-Flop
The T flip-flop (Toggle flip-flop) changes its output state when the T input is high. If T = 0, the output remains the same. If T = 1, the output toggles.
Example of a T Flip-Flop
Consider a T flip-flop with the following inputs:
- Clock: 0, 0, 1, 1, 0, 1
- T: 0, 1, 1, 0, 1, 0
The output (Q) will change as follows:
Clock: 0 0 1 1 0 1
T: 0 1 1 0 1 0
Q: 0 0 1 0 1 1At the rising edge of the clock (positions 3 and 5), the output Q toggles based on the T input.
Registers
A register is a group of flip-flops used to store multiple bits of data. For example, an 8-bit register consists of 8 D flip-flops. Registers can hold values temporarily and are essential in digital systems for data manipulation.
Asynchronous Circuits
Asynchronous circuits do not rely on a clock signal for their operation. Instead, they change state based on the inputs' current values. These circuits can respond more quickly to input changes but may lead to unpredictable behaviour due to race conditions.
Race Conditions
A race condition occurs when the output depends on the sequence or timing of inputs. This can result in incorrect outputs if not managed properly. To avoid race conditions, careful design and timing analysis are necessary.
Watch out: Asynchronous circuits can be more challenging to design due to the potential for race conditions. Always verify timing to ensure correct operation.
Finite State Machines
Sequential circuits can be used to implement finite state machines (FSMs). An FSM is a model of computation that consists of a finite number of states, transitions between those states, and actions. FSMs can be classified into two categories: Mealy machines and Moore machines.
Mealy Machines
In a Mealy machine, the output depends on both the current state and the current inputs. This allows for faster response times since the output can change as soon as the inputs change.
Moore Machines
In a Moore machine, the output depends only on the current state. The output changes only when there is a state transition, which can lead to a more stable output but may introduce a delay in the response to input changes.
Example of a Finite State Machine
Consider a simple FSM that represents a traffic light system with three states: Green, Yellow, and Red. The transitions between states might be as follows:
- Green to Yellow (after a timer)
- Yellow to Red (after a timer)
- Red to Green (after a timer)
This FSM can be implemented using flip-flops to store the current state and combinational logic to determine the next state based on the current inputs.
Designing Sequential Circuits
The design of sequential circuits involves selecting appropriate memory elements, determining the state diagram, and creating the corresponding logic equations. The following steps are commonly used in designing sequential circuits:
- Define the problem and identify the required states.
- Create a state diagram to represent the transitions between states.
- Assign binary values to each state.
- Derive the next state and output equations using Karnaugh maps or other minimisation techniques.
- Implement the circuit using flip-flops and combinational logic.
Example of Designing a Sequential Circuit
Suppose you want to design a simple 2-bit binary counter. The counter will have four states: 00, 01, 10, and 11. The transitions will be as follows:
- 00 to 01
- 01 to 10
- 10 to 11
- 11 to 00
The state diagram can be represented as:
00 --> 01 --> 10 --> 11
^_________________|Next, assign binary values to each state:
- 00 = 0
- 01 = 1
- 10 = 2
- 11 = 3
Derive the next state equations:
- For state Q1Q0:
Next Q1 = Q1 XOR Q0
Next Q0 = NOT Q0Finally, implement the circuit using D flip-flops for Q1 and Q0, and combinational logic for the next state equations.
Tip: Always verify your design by simulating the circuit to ensure it behaves as expected.
Summary
- Sequential circuits use memory elements to store information about past inputs.
- Types of sequential circuits include synchronous and asynchronous circuits.
- Flip-flops are the basic building blocks of synchronous circuits.
- Finite state machines can be implemented using sequential circuits.
- Designing sequential circuits involves creating state diagrams and deriving next state equations.
Check your understanding
- What is the main difference between synchronous and asynchronous sequential circuits?
- Explain the operation of a D flip-flop.
- What are race conditions, and how can they affect asynchronous circuits?
- Describe the steps involved in designing a sequential circuit.