Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 32

Counters and Shift Registers: Design and Analysis

Recommended resources

Welcome back! In our previous lesson, we laid the groundwork for memory in digital circuits by mastering the fundamental building blocks: latches and flip-flops. You learned to analyze the behavior of SR, JK, D, and T flip-flops using their characteristic and excitation tables. This knowledge is about to pay off.

Today, we will assemble these individual flip-flops into more complex and practical sequential circuits. Our goal is to design and analyze counters and shift registers, two cornerstone components of any digital system. You will learn the critical differences between synchronous and asynchronous counters, how to design them from scratch, and how to analyze their behavior—a frequent task in GATE questions. We will then explore how shift registers store and manipulate data, culminating in the versatile universal shift register.

1. Counters: Sequencing Through States

A counter is a sequential circuit that cycles through a predetermined sequence of states. The most common type is a binary counter, which counts in binary order (0, 1, 2, 3...). Counters are broadly classified into two categories based on how their flip-flops are clocked: synchronous and asynchronous.

1.1. Synchronous Counters: A Unified Approach

In a synchronous counter, all flip-flops share a single, common clock signal. This means all state changes occur simultaneously on the active clock edge, making the circuit's behavior predictable and easy to analyze. Designing a synchronous counter is a systematic process, which is a valuable skill for GATE.

Let's walk through the design of a 3-bit binary up-counter using T flip-flops. This example will solidify the design methodology.

11 Top Questions on Counters | Digital Electronics | GATE 2024 EE/ECE/CSE | BYJU'S GATE

The video "11 Top Questions on Counters" from BYJU'S Exam Prep provides an excellent, detailed walkthrough of this design process. We will follow its steps closely.

Please watch the segment from the beginning. As you watch, focus on the four key steps the instructor follows: State Diagram and Table: The process begins by defining the desired sequence (000 → 001 → ... → 111 → 000). This is translated into a state table showing the Present State and the Next State for each count. Excitation Table: This is where our previous lesson becomes crucial. For each flip-flop (e.g., Q2, Q1, Q0), we look at the transition from its present state to its next state (e.g., for Q2: 0→0, 0→0, 0→0, 0→1, ...) and use the T flip-flop's excitation table to determine the required input (T_in). Remember, for a T-flop: If state holds (0→0 or 1→1), T=0. If state toggles (0→1 or 1→0), T=1. K-Map Simplification: With the excitation table complete, we now have the required inputs for each flip-flop (T2, T1, T0) for every present state. We treat these inputs as Boolean functions of the present state variables (Q2, Q1, Q0) and simplify them using K-maps. This gives us the logic expressions: T_2 = Q_1 Q_0, T_1 = Q_0, and T_0 = 1. Circuit Implementation: The final step is to draw the circuit. We use three T flip-flops and implement the logic for their inputs using an AND gate, direct connections, and a logic HIGH signal, all driven by a common clock.

This four-step process (State Diagram → Excitation Table → K-Maps → Circuit) is the standard method for designing any synchronous sequential circuit and is a powerful tool for your GATE preparation.

1.2. Asynchronous (Ripple) Counters

In an asynchronous or ripple counter, only the first flip-flop (usually the LSB) is connected to the external clock. The clock input of each subsequent flip-flop is driven by the output of the preceding flip-flop. This creates a "ripple" effect, as the state change propagates through the chain of flip-flops one by one.

11 Top Questions on Counters | Digital Electronics | GATE 2024 EE/ECE/CSE | BYJU'S GATE

Let's see how this works in practice. The same video explains the operation of a 3-bit ripple up-counter.

Watch the segment explaining the ripple counter. Key points to note are: Clocking: Only the first flip-flop (for Q0) receives the main clock. The clock for the Q1 flip-flop is the output Q0, and the clock for the Q2 flip-flop is the output Q1. Toggle Mode: All flip-flops are kept in toggle mode (e.g., T=1 or J=K=1). Propagation: A flip-flop toggles only when its clock input sees an active edge. In this example (negative-edge triggered), the Q1 flip-flop toggles only when Q0 transitions from 1 to 0. Similarly, Q2 toggles when Q1 goes from 1 to 0. You can trace this propagation to see how the binary count sequence is generated.

This design is simpler in terms of hardware (no combinational logic for inputs), but it comes with a performance penalty.

1.3. Synchronous vs. Asynchronous: Speed and Complexity

The choice between synchronous and asynchronous counters involves a trade-off.

  • Hardware Complexity: Ripple counters are simpler, requiring only N flip-flops for an N-bit counter. Synchronous counters require N flip-flops plus additional logic gates to implement the excitation functions.
  • Speed: This is the major drawback of ripple counters. Since the state change has to propagate through the flip-flops, the total propagation delay (T_total) is the sum of the delays of all flip-flops: , where is the propagation delay of one flip-flop. This limits the maximum clock frequency at which the counter can operate reliably. In a synchronous counter, all outputs change roughly one propagation delay after the clock edge.

11 Top Questions on Counters | Digital Electronics | GATE 2024 EE/ECE/CSE | BYJU'S GATE

The video provides a concise comparison and discusses the performance implications.

First, review the hardware comparison discussed from this point. Next, watch the segment on maximum clock frequency for a ripple counter. The key formula is f_{max} \le \frac{1}{n \times T_{pd}}. Understanding this is vital for solving GATE problems on counter performance.

1.4. Counter Analysis: A Common GATE Problem Type

Besides designing counters, a very common task is to analyze a given counter circuit to determine its counting sequence and its modulus (the number of unique states in its cycle).

A frequent variation involves counters with additional logic connected to the asynchronous clear (CLR) or preset (PRE) inputs of the flip-flops. These inputs can force a flip-flop to 0 or 1 immediately, regardless of the clock, truncating the normal count sequence.

11 Top Questions on Counters | Digital Electronics | GATE 2024 EE/ECE/CSE | BYJU'S GATE

Let's examine two typical analysis problems from the BYJU'S video.

First, watch the detailed analysis of a ripple counter with asynchronous clear logic. This is a crucial example. Notice how the NAND gate logic detects when the count reaches 1010 (decimal 10). At that exact moment, the clear signal becomes active, immediately resetting all flip-flops to 0000. Because the reset is asynchronous, the state 1010 exists only for a transient moment and is not considered part of the stable count sequence. Thus, the counter counts from 0 to 9, making it a Mod-10 (or BCD) counter. If the clear were synchronous, it would wait for the next clock edge, making 10 a valid state and the counter Mod-11. Next, watch the analysis of a simple 2-bit synchronous counter. The process here is to start from an initial state (e.g., 00), determine the J and K inputs based on the current state, use the flip-flop's characteristic equation to find the next state, and repeat until the sequence repeats.


2. Shift Registers: Storing and Moving Data

A shift register is a cascade of flip-flops sharing a common clock, designed to store and shift binary data. D flip-flops are the most common choice for shift registers because their characteristic equation () is perfect for passing data from one stage to the next.

They are classified based on how data is loaded and retrieved: serially (one bit at a time) or in parallel (all bits at once).

This image illustrates the four main types of shift registers based on their input and output configurations.

Shift Register: SIPO, PISO and PIPO Shift Registers | What is Universal Shift Register?

The video "Shift Register" from ALL ABOUT ELECTRONICS provides a clear explanation of these different types.

Watch the following segments to understand the key architectures: Serial-In, Parallel-Out (SIPO): Data bits are shifted in one by one, but all stored bits are available simultaneously on parallel output lines. Parallel-In, Serial-Out (PISO): All data bits are loaded at once in a single clock cycle. The bits are then shifted out one by one. Notice the use of multiplexers to select between load and shift operations—a direct application of concepts from lesson 4.4. Parallel-In, Parallel-Out (PIPO): Data is loaded in parallel and read out in parallel. This is essentially a basic data register.

The fourth type, Serial-In, Serial-Out (SISO), is the simplest form where data enters one bit at a time and exits one bit at a time from the other end.

2.1. The Universal Shift Register

A universal shift register combines all functionalities into one device. Using multiplexers and control signals, it can be configured to hold data, shift it left, shift it right, or load it in parallel. This makes it an extremely flexible and powerful component.

This design elegantly demonstrates how combinational logic (MUXes) can be used to control the behavior of sequential circuits.


Conclusion

In this lesson, you have taken a major step in understanding sequential circuits. We've built upon our knowledge of flip-flops to construct practical, multi-bit components that are fundamental to computing.

Key Takeaways:

  • Synchronous vs. Asynchronous Counters: Synchronous counters use a common clock, are faster but more complex. Asynchronous (ripple) counters have a simpler structure but suffer from cumulative propagation delay.
  • Counter Design & Analysis: You can now follow a systematic process to design synchronous counters and analyze the behavior of given counter circuits, including those with truncating logic.
  • Shift Registers: These are chains of flip-flops for storing and moving data. You learned the four basic I/O modes (SIPO, PISO, PIPO, SISO).
  • Universal Shift Register: By using multiplexers to control the inputs to the flip-flops, a single register can be made to perform hold, shift left, shift right, and parallel load operations.

In our next lesson, we will shift gears slightly to another critical topic in digital logic: Number Systems and Representations. We will cover binary, octal, and hexadecimal conversions, and explore how computers represent signed integers using systems like 2's complement.