Course contentsShow
← Embedded Systems & Computer Architecture
Lesson 25 of 9361. Foundations of Digital Logic and Computer ArchitectureFree lesson

Sequential Circuit Timing Analysis

You will calculate setup and hold time margins to ensure that state transitions occur reliably within the constraints of the system clock.

In this lesson, you will learn how to calculate setup and hold time margins to ensure your sequential circuits operate reliably without timing violations.

The Timing Challenge

In a synchronous system, every flip-flop depends on the clock signal to capture data correctly. For this to happen, the signal arriving at the input of a flip-flop must be stable for a specific window of time around the clock edge. If the signal changes too close to that edge, the flip-flop might enter a "metastable" state, causing your system to fail unpredictably.

Setup and Hold Constraints

To prevent errors, we define two critical constraints:

  1. Setup Time (tsetupt_{setup}): The minimum time the input data must be stable before the clock edge arrives.
  2. Hold Time (tholdt_{hold}): The minimum time the input data must remain stable after the clock edge passes.

If your combinational logic path (the path from one flip-flop output to the next flip-flop input) is too slow, you violate the Setup Time. If the logic path is too fast, you violate the Hold Time.

Calculating Margins

Let TclkT_{clk} be your clock period, tcqt_{cq} be the time a flip-flop takes to output data, and tpdt_{pd} be the propagation delay of your combinational logic.

  • Setup Margin: We need to ensure the data reaches the next flip-flop before the next clock pulse. Margin_setup = T_clk - (t_cq + t_pd + t_setup) If this value is negative, your circuit is running too fast for the logic delay!

  • Hold Margin: We need to ensure the data doesn't change so quickly that it "overtakes" the clock edge. Margin_hold = (t_cq + t_pd) - t_hold If this value is negative, your logic path is too short and the new data will overwrite the current data too early.

Practical Rule

Imagine you are playing a game of "Red Light, Green Light." The setup time ensures you stop early enough before the "Red Light" (clock edge), while the hold time ensures you don't start moving until the signal has safely passed. In digital design, we use these margins to verify that our clock frequency isn't too high for our physical components.

Key Takeaway: A robust sequential circuit must satisfy both setup and hold margins; a setup violation usually means the clock is too fast, while a hold violation means the logic path is too short.