Skip to content
DenseChip
Learn
PracticeCode labInterview

DenseChip

Navigate

Menu

LearnPracticeCode labInterview

Tools

All toolsSV editorCode repoResume
DenseChip

Practice, courses, and chip-design tools in one focused workspace.

LearnPracticeCode labInterviewToolsLearning paths

© 2026 DenseChip

AboutRoadmapCareersInternshipsFAQContactPrivacyTerms
Skip to lesson

Course contents

  • RTL Foundations36
  • Combinational Design25
  • Sequential Design27
  • FSM & Control27
  • Timing & Clocking39
  • Reset & CDC34
    • Reset Architecture
    • Metastability and Synchronisation
      • What Metastability Means in Practice
      • The Two-Flop Synchroniser
      • When to Use Three Flops
      • CDC Constraints and Implementation Hygiene
      • Do Not Synchronise Buses Bit by Bit
    • Asynchronous FIFO
    • CDC Protocols
    • Reset Domain Crossing
    • CDC Verification
  • Memory & Buses57
  • Advanced RTL28
  • Senior & Interview76
  • Glossary and Notation
Loading lesson

←Metastability and Synchronisation
  1. Topics
  2. RTL Design
  3. Reset & CDC
  4. Metastability and Synchronisation
  5. What Metastability Means in Practice
On this page

    Part 6 of 9, lesson 6 of 34Part 6 of 9/Reset & CDC/Lesson 6 of 34Intermediate

    What Metastability Means in Practice

    Setup-hold window, random resolution, MTBF formula, and a reusable simulation model.

    A flip-flop that samples an input just as it changes can hold a value that is neither 0 nor 1 for a while, and the logic behind it may read that value two different ways. It is rare, so it passes every test and shows up in the field.

    After this lesson you can: name the setup-hold window, explain why a longer settling time helps exponentially, and estimate MTBF from the clock rates and the flop's constants.

    The window

    A flip-flop needs D stable for t_su before the clock edge and t_h after it. A change inside that window can leave the output between 0 and 1 for an unbounded time.

    Long delays are exponentially unlikely. When the output resolves, it takes the old or the new value, effectively at random.

    Three data changes against one clock edge: only the change inside the shaded t_su to t_h window can leave Q wandering between the rails before it resolves to 0 or 1

    How to read it: time runs left to right, the shaded band is the setup and hold window around the capture edge, and each row shows data D above the flip-flop output Q.

    • Rows 1 and 3 are safe. D is either stable before t_su or changes after t_h, so Q is the old or the new value, cleanly.

    • Row 2 is the failure. Q may sit between 0 and 1 and later settle to either rail, and which one is effectively random.

    • t_r is the time Q has to settle before the next stage samples it. A synchroniser exists to make t_r long enough, as the next section explains.

    Resolution time and MTBF

    Mean time between failures grows exponentially with resolution time. A synchroniser gives the first flop a full clock period to settle.

    MTBF=TW​⋅fclk​⋅fdata​etr​/τ​

    Term

    Meaning

    t_r

    Resolution time: how long the flop output has to settle before the next stage samples it

    τ

    Time constant of the flop's regenerative feedback (technology dependent, tens of picoseconds)

    T_W

    Width of the vulnerable window (also technology dependent)

    f_clk, f_data

    Clock frequency of the sampling flop and rate of data changes

    The exponential in the numerator dominates. Each extra picosecond of settling multiplies MTBF.

    A simulation model

    The historical name meta_ff below denotes a sampling-uncertainty model, not an analogue metastability model. A setup/hold-window hit selects a random digital 0 or 1 after fixed TCQ. It illustrates uncertain capture; it has no late-resolution distribution, analogue voltage, or divergent downstream interpretation. The full listing sits under Testbench below.

    The counter meta_events counts model window hits, not metastability failures. An actual failure depends on resolution remaining unsafe at downstream sampling. A clean digital output or zero model errors cannot measure MTBF or prove those failures absent. Reliability needs library-characterised parameters, implemented interstage slack, activity assumptions, and physical signoff; none is supplied by this bench.

    Common mistakes

    Don't apply the formula's numbers to your design unless you have them from the library or characterisation. τ and T_W vary by orders of magnitude between nodes, and with voltage and temperature.

    Check yourself The first flop of a synchroniser has one clock period of resolution time. If the clock is doubled in speed, what happens to t_r and what is the effect on MTBF?

    With fixed overhead h, t_r changes from T - h to T/2 - h. At fixed source transition rate f_data, MTBF_new/MTBF_old = exp(-T/(2τ))/2. Only if source activity also doubles (for example f_data = f_clk/10) does the denominator contribute /4 instead. State the activity assumption and use actual implementation slack.

    Testbench

    meta_ff.sv
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    `timescale 1ns/1ps
    
    // Sampling uncertainty only: random digital capture at fixed TCQ after a window hit.
    // No analogue state, late-resolution tail, or downstream disagreement is modelled.
    module meta_ff #(parameter real TCQ = 0.3, TSU = 0.15, THD = 0.1) (
      input  logic clk, d,
      output logic q
    );
      realtime t_d = -100.0, t_clk = -100.0;
      int      meta_events = 0;
      initial q = 1'b0;
    
      always @(d) begin
        t_d = $realtime;
        if ($realtime - t_clk < THD) begin                    // changed just after the edge (hold window)
          meta_events++;  q <= #TCQ $urandom_range(0, 1);
        end
      end
      always @(posedge clk) begin
        t_clk = $realtime;
        if ($realtime - t_d < TSU) begin                      // changed just before the edge (setup window)
          meta_events++;  q <= #TCQ $urandom_range(0, 1);
        end else q <= #TCQ d;
      end
    endmodule
    

    Outside the window the model flop is exact. Inside it, the model picks the old or the new value at random: in one run, 230 of 400 captures took the new value and 170 the old.

    • Only a change inside the setup-hold window can cause it.

    • The output settles to the old or the new value at random, and more settling time makes a long delay exponentially less likely.

    • Simulation can model the random choice, but it cannot measure a real failure rate.

    Rule of thumb: treat the event as certain to happen, and make sure the second flop only ever sees a settled value.

    How this was checked

    Sampling-uncertainty source checker, run with Icarus Verilog 13.0 (2026-10-16): prints PASS. It checks exact capture outside the model window and random outcomes inside it. It is not a physical reliability experiment.

    Model run (Icarus Verilog 13.0, 2026-10-16): 230 new-value and 170 old-value captures out of 400. This shows the digital random choice only; it is not a measured physical failure rate.

    • Practice: Metastability in a CDC control path, analysed from a waveform

    • Practice: A 3-flop synchroniser that still causes glitches

    • Interview: run a mock interview on this topic

    Related topics

    • Two-flop synchroniser

    Previous

    160 / 350

    Next: The Two-Flop Synchroniser

    Up next

    Up nextThe Two-Flop Synchroniser

    Sign in to save progress

    Practice this lessonPrevious lessonReport an error

    See also

    • When to Use Three Flops
    • CDC Constraints and Implementation Hygiene
    • Do Not Synchronise Buses Bit by Bit