Part of Curriculum: CDC, RDC and Low-Power RTL (Module 1: Metastability & Two-Flop Synchronizers)
View Full Roadmap →
Level 4 Hard ★ Flagship #33 50 pts ✓ Solved

Two-Flop Synchronizer — Single-Bit CDC

Clock Domain Crossing (CDC) · cdc, industry-rtl, arbiters, clock-domain-crossing, hard, bit-synchronizers

Design a 2-flip-flop synchronizer to safely pass a single-bit control signal from an asynchronous source into the destination clock domain clk_dst.

Write a synthesizable Verilog module named top_module matching the ports below exactly.
📐 Circuit Schematic Diagram
SRC REGDOMAIN ASYNC 1METASTABLESYNC 2RESOLVEDDOMAIN A (clk_src)DOMAIN B (clk_dst)async_insync_out
⚡ Timing & Synthesizability Constraints

Timing Contract: Asynchronous input `async_in` is sampled by stage 1 (`sync_q1`), and resolved by stage 2 (`sync_q2`). Total latency = 2 destination clock cycles.

RTL Constraints: Never apply 2-flop synchronizers to multi-bit buses without Gray coding or handshakes. Synthesizable sequential RTL.

Objective: Understand metastability resolution, MTBF (Mean Time Between Failures), two-stage flip-flop cascades, and CDC synthesis constraints (set_false_path / ASYNC_REG).

Prerequisites: Flip-flop setup/hold times, metastability basics, clock domain crossings.
NameDirWidthDescription
clk_dstinput1Destination clock domain
areset_ninput1Destination domain active-low reset
async_ininput1Asynchronous single-bit input signal
sync_outoutput1Synchronized output in clk_dst domain
Expected Waveform (Golden Timing Contract)
💡 Need Guidance? Progressive Hints (3 Levels)
Hint 1: Conceptual Direction & Hardware Primitives
Cascade two flip-flops: `q1 <= async_in; q2 <= q1;` inside `always @(posedge clk_dst)`.
Hint 2: Implementation Architecture & Approach
Drive `assign sync_out = q2;`.
Hint 3: Edge Cases, Timing & Verilog Syntax
In commercial RTL, tag the flops with synthesis attribute `(* ASYNC_REG = "TRUE" *)`.
🔒 Reveal Verified Reference RTL Solution (Click to expand)
⚠️ Self-Discovery Warning: Try solving and simulating first! Viewing the verified reference implementation will bypass the real debugging experience.
Verified Synthesizable RTL
module top_module(
  input   clk_dst,
  input   areset_n,
  input   async_in,
  output  sync_out
);
  (* ASYNC_REG = "TRUE" *) reg q1;
  (* ASYNC_REG = "TRUE" *) reg q2;

  always @(posedge clk_dst or negedge areset_n) begin
    if (!areset_n) begin
      q1 <= 1'b0;
      q2 <= 1'b0;
    end else begin
      q1 <= async_in;
      q2 <= q1;
    end
  end

  assign sync_out = q2;
endmodule
Verilog-2001 / SV Saved
Font: |
// Click Run Tests (or press Ctrl+Enter) to compile your RTL and simulate against hidden testbenches.
Simulation Timing Diagram (VCD Waveform)
100%
No simulation waveform yet. Run tests to simulate and generate VCD traces.
No compilation run yet. Syntax warnings and elaboration messages will appear here.
No simulation output yet. Raw stdout from vvp will appear here.

RTL Problems / Level 4 · Clock Domain Crossing (CDC)

What You Will Learn

By solving Two-Flop Synchronizer — Single-Bit CDC, you will acquire core industry skills:

  • Synthesizable hardware modeling in standard Verilog-2001 / SystemVerilog.
  • Correct handling of interface port contracts, edge-triggered clocks, and active-low/high resets.
  • Simulation waveform interpretation and debugging using timing diagrams (VCD traces).
  • Architectural avoidance of timing violations, glitching hazards, and synthesis warnings.

Problem Statement & Requirements

Design a 2-flip-flop synchronizer to safely pass a single-bit control signal from an asynchronous source into the destination clock domain clk_dst.

Hardware design teams at leading semiconductor firms evaluate these exact port contracts, race-condition assertions, and corner cases during technical design reviews and ASIC engineer interviews.

Objective: Understand metastability resolution, MTBF (Mean Time Between Failures), two-stage flip-flop cascades, and CDC synthesis constraints (set_false_path / ASYNC_REG).

Prerequisites: Flip-flop setup/hold times, metastability basics, clock domain crossings.

Port List & Interface Timing

The hidden testbench instantiates top_module. Module port names and bit-widths must match the interface contract exactly:

NameDirWidthDescription
clk_dstinput1Destination clock domain
areset_ninput1Destination domain active-low reset
async_ininput1Asynchronous single-bit input signal
sync_outoutput1Synchronized output in clk_dst domain

Timing Constraints & Synthesizable RTL Rules

⚡ Synthesizable Implementation Guidelines

Timing Contract: Asynchronous input `async_in` is sampled by stage 1 (`sync_q1`), and resolved by stage 2 (`sync_q2`). Total latency = 2 destination clock cycles.

Synthesis Constraints: Never apply 2-flop synchronizers to multi-bit buses without Gray coding or handshakes. Synthesizable sequential RTL.

Architectural Deep Dive & Implementation Walkthrough

When an asynchronous signal transitions near a clock edge, the first flip-flop (FF1) can enter a metastable state where its output voltage hovers between valid logic levels. The second flip-flop (FF2) provides an entire clock period of settling time for FF1 to resolve to a stable 0 or 1, exponentially increasing the Mean Time Between Failures (MTBF).

Common RTL Designer Pitfalls

⚠️ Common Mistakes to Avoid

['Attempting to synchronize a multi-bit data bus with independent 2-flop synchronizers: skew causes different bits to arrive in different clock cycles, producing corrupted intermediate values.', 'Assuming functional RTL simulation proves metastability safety: simulators use ideal 0/1 binary states and CANNOT simulate analog metastability.']

Silicon & Hardware Engineering Notes

🛠️ ASIC vs FPGA Hardware Considerations

CRITICAL CDC NOTE: Passing functional simulation does not prove CDC safety! Static CDC verification tools (Synopsys SpyGlass CDC, Questa CDC) and physical placement constraints (`set_false_path`, `set_max_delay -datapath_only`) are mandatory in silicon design.

Starter RTL Code

module top_module(
  input   clk_dst,
  input   areset_n,
  input   async_in,
  output  sync_out
);

  // 2-Flip-Flop Synchronizer for single-bit CDC

endmodule

Verified Reference Solution

🔒 Reveal Verified Reference RTL Solution
module top_module(
  input   clk_dst,
  input   areset_n,
  input   async_in,
  output  sync_out
);
  (* ASYNC_REG = "TRUE" *) reg q1;
  (* ASYNC_REG = "TRUE" *) reg q2;

  always @(posedge clk_dst or negedge areset_n) begin
    if (!areset_n) begin
      q1 <= 1'b0;
      q2 <= 1'b0;
    end else begin
      q1 <= async_in;
      q2 <= q1;
    end
  end

  assign sync_out = q2;
endmodule
Advertisement

Related RTL Problems in Level 4

Frequently Asked Questions

What does Two-Flop Synchronizer — Single-Bit CDC require?

Design a 2-flip-flop synchronizer to safely pass a single-bit control signal from an asynchronous source into the destination clock domain clk_dst. Implement it as Verilog module top_module matching the listed ports.

Is this design combinational or sequential?

Tags: cdc, industry-rtl, arbiters, clock-domain-crossing, hard, bit-synchronizers. If a clock signal is present in the port table, implement it as sequential logic; otherwise, use continuous assignments or combinational blocks.

How is my solution graded?

A hidden SystemVerilog testbench simulates your module in the cloud judge. You pass when all directed corner cases match the golden model and the VCD timing waveform matches the contract.

How does this challenge help with semiconductor interviews?

Technical interviewers at NVIDIA, Qualcomm, Apple, and Intel routinely ask candidates to code, debug, and explain the timing waveforms of Two-Flop Synchronizer — Single-Bit CDC to assess real-world synthesizability and race-condition awareness.

Advertisement