Sequential Circuit Design
By Notes Vandar
5.1. Flip-flops: RS, JK, D, and T, Latches
5.3 Master slave flip flop
The Master-Slave flip-flop is a type of edge-triggered flip-flop that helps eliminate race conditions, which can occur when outputs change state unpredictably due to input changes during the clock cycle. It achieves this by splitting the flip-flop into two stages: the master and the slave. The master stage responds to the clock during one phase, and the slave stage responds during the opposite phase. This structure ensures that the output changes only once per clock cycle.
Structure and Working of Master-Slave Flip-Flop
The Master-Slave flip-flop typically consists of two identical flip-flops (usually SR, JK, or D flip-flops) connected in series:
- The master flip-flop is active when the clock is in one phase (typically the rising edge or high level of the clock).
- The slave flip-flop is active when the clock is in the opposite phase (typically the falling edge or low level of the clock).
This arrangement ensures that any input to the flip-flop is first stored in the master flip-flop and then transferred to the slave flip-flop during the next clock phase. The output is taken from the slave flip-flop, ensuring the circuit is stable and free of glitches.
Key Components:
- Master Flip-Flop: This flip-flop is triggered during the first phase of the clock and captures the input data.
- Slave Flip-Flop: This flip-flop is triggered during the second phase of the clock, and it outputs the data captured by the master.
Operation of the Master-Slave Flip-Flop
- Clock High (Master Enabled, Slave Disabled):
- During the high phase of the clock (positive edge or high level), the master flip-flop is enabled, and it captures the input state.
- The output of the master flip-flop is passed to the slave flip-flop, but the slave remains disabled during this phase.
- The slave flip-flop does not change its state during this clock phase.
- Clock Low (Master Disabled, Slave Enabled):
- During the low phase of the clock (negative edge or low level), the master flip-flop is disabled, locking its state.
- The slave flip-flop becomes enabled and takes the output from the master flip-flop as its input.
- The slave flip-flop’s output is updated and becomes the final output of the entire master-slave flip-flop.
- The output of the master-slave flip-flop changes only during this phase, ensuring that the flip-flop output remains stable throughout the clock cycle.
This setup ensures that the flip-flop changes its output only once per clock cycle, making it a synchronous circuit.
Types of Master-Slave Flip-Flops
- Master-Slave SR Flip-Flop: Uses SR flip-flops in both the master and slave stages.
- Master-Slave JK Flip-Flop: Uses JK flip-flops for the master and slave stages. It resolves the invalid state issue seen in the SR flip-flop and is commonly used due to its toggling capability.
- Master-Slave D Flip-Flop: The D flip-flop form simplifies the design, ensuring that the output follows the input with one clock delay.
Master-Slave JK Flip-Flop Example
The Master-Slave JK Flip-Flop is a popular configuration due to its versatility. It operates as follows:
- When the clock is high:
- The master flip-flop is active, and its output depends on the J and K inputs.
- If J = 1 and K = 0, the master flip-flop sets the output to 1.
- If J = 0 and K = 1, the master flip-flop resets the output to 0.
- If J = K = 1, the master flip-flop toggles its state.
- When the clock goes low:
- The master flip-flop is disabled, and the slave flip-flop becomes active.
- The slave flip-flop takes the state from the master flip-flop as its input and outputs it.
This mechanism prevents any glitches from affecting the output, as inputs are only processed during specific phases of the clock.
Advantages of the Master-Slave Flip-Flop
- Race Condition Avoidance: In circuits without proper synchronization, changes in inputs can cause the output to oscillate or race between 0 and 1 states. The master-slave configuration ensures that input changes are registered in an orderly, controlled manner, reducing race conditions.
- Stable Output: The slave flip-flop holds the output stable during the clock phase when the master flip-flop is capturing the input. This ensures that the output only changes at a specific time during the clock cycle, preventing erratic behavior.
- Synchronous Operation: The master-slave flip-flop operates synchronously with the clock, ensuring that changes happen in alignment with the clock signal and thus preventing unwanted timing errors.
- Controlled Timing: The master-slave design ensures that changes in the flip-flop’s output occur only once per clock cycle, making it ideal for sequential circuits where precise timing is important.
Disadvantages of the Master-Slave Flip-Flop
- Complexity: The master-slave flip-flop involves two flip-flops for each state change, making it more complex than a simple edge-triggered flip-flop.
- Propagation Delay: Since the output changes only after the clock’s second phase (after the slave stage), there is a delay in the output response compared to single flip-flop designs.
Master-Slave Flip-Flop vs. Edge-Triggered Flip-Flop
Feature | Master-Slave Flip-Flop | Edge-Triggered Flip-Flop |
---|---|---|
Structure | Two flip-flops (master and slave) | Single flip-flop |
Clock Dependency | Changes output during opposite clock phase | Changes output on clock edge |
Delay | Introduces an extra clock phase delay | Faster, immediate response |
Race Condition | Avoids race conditions due to two-stage design | May suffer race conditions without careful design |
5.4 Flip-flop excitation table and design procedure.
Flip-flops are fundamental building blocks in digital electronics, and their design often involves determining how to transition from one state to another. This section will cover the excitation table for various types of flip-flops and the design procedure to implement them in circuits.
1. Flip-Flop Excitation Table
The excitation table defines the input conditions required to transition a flip-flop from its current state to its next state. Each type of flip-flop has its own excitation table based on its characteristics. Below are the excitation tables for the most common types of flip-flops: SR, JK, D, and T.
1.1 SR Flip-Flop Excitation Table
Present State (Q) | Next State (Q<sub>next</sub>) | S | R |
---|---|---|---|
0 | 0 | 0 | 0 |
0 | 1 | 1 | 0 |
1 | 0 | 0 | 1 |
1 | 1 | 0 | 0 |
- Notes:
- S = Set input, R = Reset input.
- The state (Q) can only change when the corresponding S or R inputs are active.
1.2 JK Flip-Flop Excitation Table
Present State (Q) | Next State (Q<sub>next</sub>) | J | K |
---|---|---|---|
0 | 0 | 0 | 0 |
0 | 1 | 1 | 0 |
1 | 0 | 0 | 1 |
1 | 1 | 1 | 1 |
- Notes:
- J = Input to set the flip-flop.
- K = Input to reset the flip-flop.
- J = K = 1 results in toggling the state.
1.3 D Flip-Flop Excitation Table
Present State (Q) | Next State (Q<sub>next</sub>) | D |
---|---|---|
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 0 |
1 | 1 | 1 |
- Notes:
- D = Data input; the next state directly follows the D input.
1.4 T Flip-Flop Excitation Table
Present State (Q) | Next State (Q<sub>next</sub>) | T |
---|---|---|
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 0 |
- Notes:
- T = Toggle input; T = 1 causes the flip-flop to toggle its state.
2. Design Procedure for Flip-Flops
Designing a flip-flop circuit involves several steps, including defining the required state transitions, creating the excitation table, deriving the input equations, and implementing the circuit. Here’s a step-by-step guide:
2.1 Define the Requirements
- Determine the State Transitions: Identify the current state and the desired next state for each clock cycle.
- Create a State Diagram: Visualize the states and transitions to understand the behavior of the system.
2.2 Construct the Excitation Table
- Choose the Flip-Flop Type: Based on the requirements, select an appropriate flip-flop type (e.g., D, JK, or T).
- Create the Excitation Table: Fill in the excitation table based on the current and next states, as shown in the previous section.
2.3 Derive Input Equations
- Use Karnaugh Maps: Simplify the excitation conditions to derive the input equations for the selected flip-flop type using Karnaugh maps or Boolean algebra.
- Generate Logic Expressions: Create logic expressions for each input based on the excitation table and the derived equations.
2.4 Implement the Circuit
- Choose Logic Gates: Based on the logic expressions, select the appropriate logic gates (AND, OR, NOT) to construct the flip-flop.
- Draw the Circuit Diagram: Create a schematic diagram of the circuit using the chosen gates and flip-flops.
2.5 Simulation and Testing
- Simulate the Circuit: Use simulation software to verify the functionality of the circuit and check the state transitions against the expected behavior.
- Debugging: If the simulation does not match the expected results, debug the circuit, focusing on the input conditions and logic gate arrangements.
Example: Designing a JK Flip-Flop
Let’s say we want to design a JK flip-flop that transitions from states as follows:
Current State (Q) | Next State (Q<sub>next</sub>) |
---|---|
0 | 1 |
1 | 0 |
Step 1: State Transition
- From Q = 0 to Q<sub>next</sub> = 1 requires J = 1, K = 0.
- From Q = 1 to Q<sub>next</sub> = 0 requires J = 0, K = 1.
Step 2: Excitation Table
Using the JK excitation table, we can determine the required inputs:
Present State (Q) | Next State (Q<sub>next</sub>) | J | K |
---|---|---|---|
0 | 1 | 1 | 0 |
1 | 0 | 0 | 1 |
Step 3: Derive Input Equations
- From the excitation table, we can derive:
- J = Q’ (where Q’ is NOT Q)
- K = Q
Step 4: Implement the Circuit
- Using the derived logic:
- Connect an inverter to the Q output to obtain Q’.
- Use Q and Q’ as inputs to the JK flip-flop.
Step 5: Testing
- Simulate the circuit to verify the state transitions and ensure the flip-flop operates as intended.
5.5 state diagram and simple sequential circuits
In digital design, state diagrams and sequential circuits are crucial for representing and implementing systems that depend on past states (memory). This section covers the concept of state diagrams and their application in designing simple sequential circuits.
1. State Diagram
A state diagram is a graphical representation of a finite state machine (FSM). It shows the various states of the system, the transitions between these states, and the conditions (inputs) that cause these transitions. State diagrams help visualize the behavior of sequential circuits.
Key Components of a State Diagram:
- States: Represented as circles, each state indicates the status of the system at a given time.
- Transitions: Arrows connecting states indicate how the system moves from one state to another. Each transition is triggered by specific input conditions.
- Inputs/Outputs: Labels on the arrows can indicate the inputs that trigger the transitions or the outputs produced as a result of being in a state.
Example of a State Diagram:
Consider a simple state diagram for a binary counter that counts from 0 to 3 (00 to 11 in binary):
- States:
- State 00 (S0)
- State 01 (S1)
- State 10 (S2)
- State 11 (S3)
- Transitions: The counter increments on each clock pulse:
- From S0 to S1 on input (clock).
- From S1 to S2 on input (clock).
- From S2 to S3 on input (clock).
- From S3 to S0 on input (clock).
- State Diagram:
| S0 | ——–> | S1 |
+—-+ +—-+
^ |
| |
| clock | clock
| |
+—-+ clock +—-+
| S3 | <——– | S2 |
+—-+ +—-+
2. Simple Sequential Circuits
A sequential circuit is a type of digital circuit whose output depends not only on the present input but also on the past sequence of inputs (i.e., the current state). Sequential circuits typically consist of flip-flops, logic gates, and sometimes combinational logic.
Basic Design Procedure for Sequential Circuits:
- Define Requirements:
- Determine the desired behavior of the circuit, including inputs, outputs, and state transitions.
- Create a State Diagram:
- Construct a state diagram to visualize the states and transitions based on the requirements.
- Construct the State Table:
- Create a state table that lists the current state, next state, inputs, and outputs.
- Derive Excitation Conditions:
- Using the excitation table for the chosen flip-flop type, derive the conditions needed to transition between states.
- Implement Logic Circuits:
- Design the logic circuits required to create the flip-flops and combinational logic based on the derived equations.
- Simulate and Test:
- Simulate the circuit to verify its operation and ensure it meets the specified requirements.
Example of a Simple Sequential Circuit:
Design a 2-bit Johnson Counter:
- Define Requirements:
- A 2-bit Johnson counter will count in a specific sequence (00, 01, 11, 10) and then repeat.
- Create a State Diagram:
- The states and transitions would be as follows:
- S0 (00) to S1 (01)
- S1 (01) to S3 (11)
- S3 (11) to S2 (10)
- S2 (10) to S0 (00)
- The states and transitions would be as follows:
- Construct the State Table:
Present State (Q1 Q0) | Next State (Q1′ Q0′) | Input | Output |
---|---|---|---|
00 | 01 | Clock | 00 |
01 | 11 | Clock | 01 |
11 | 10 | Clock | 11 |
10 | 00 | Clock | 10 |
- Derive Excitation Conditions:
- Using D flip-flops for the implementation:
- Q1′ = D1 = Q0 (for Q1)
- Q0′ = D0 = Q1′ (for Q0)
- Using D flip-flops for the implementation:
- Implement Logic Circuits:
- Connect the D flip-flops based on the excitation conditions.
- Create a circuit using AND, OR gates as necessary to generate the clock pulses.
- Simulate and Test:
- Use simulation tools to verify the counter counts correctly through its states.