Part of Curriculum: CDC, RDC and Low-Power RTL (Module 2: Pulse Synchronizers (Fast-to-Slow & Slow-to-Fast))
View Full Roadmap →
Level 4 Hard ★ Flagship #34 50 pts ✓ Solved

Pulse Synchronizer — Clock-Domain Crossing

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

Design a Toggle-based Pulse Synchronizer to transfer a single-cycle pulse from a fast clock domain (clk_src) to a slow destination 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)pulse_srcpulse_dst
⚡ Timing & Synthesizability Constraints

Timing Contract: Input `pulse_src` is a single-cycle strobe in `clk_src`. Output `pulse_dst` asserts for exactly 1 cycle in `clk_dst`.

RTL Constraints: Consecutive pulses must be spaced far enough apart to allow toggle completion in the slow domain.

Objective: Understand toggle pulse conversion, 2-flop synchronization across differing frequencies, and edge detection in the destination domain.

Prerequisites: Two-flop synchronizers, toggle flip-flops, rising/falling edge detection.
NameDirWidthDescription
clk_srcinput1Source clock domain (fast)
areset_src_ninput1Source domain reset
pulse_srcinput1Single-cycle pulse in source domain
clk_dstinput1Destination clock domain (slow)
areset_dst_ninput1Destination domain reset
pulse_dstoutput1Single-cycle pulse in destination domain
Expected Waveform (Golden Timing Contract)
💡 Need Guidance? Progressive Hints (3 Levels)
Hint 1: Conceptual Direction & Hardware Primitives
A fast pulse cannot be sampled directly by a slow clock because the pulse might vanish between slow clock edges.
Hint 2: Implementation Architecture & Approach
Solution: Convert the pulse into a level toggle: `src_toggle <= ~src_toggle;`.
Hint 3: Edge Cases, Timing & Verilog Syntax
Synchronize `src_toggle` into `clk_dst` with a 2-flop synchronizer, then detect transitions with an XOR edge detector (`dst_q2 ^ dst_q3`).
🔒 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_src,
  input   areset_src_n,
  input   pulse_src,
  input   clk_dst,
  input   areset_dst_n,
  output  pulse_dst
);
  reg src_toggle;

  // Step 1: In source domain, toggle on each pulse
  always @(posedge clk_src or negedge areset_src_n) begin
    if (!areset_src_n)
      src_toggle <= 1'b0;
    else if (pulse_src)
      src_toggle <= ~src_toggle;
  end

  // Step 2: Synchronize toggle level across CDC into clk_dst using 2 flops
  reg dst_q1, dst_q2, dst_q3;
  always @(posedge clk_dst or negedge areset_dst_n) begin
    if (!areset_dst_n) begin
      dst_q1 <= 1'b0;
      dst_q2 <= 1'b0;
      dst_q3 <= 1'b0;
    end else begin
      dst_q1 <= src_toggle;
      dst_q2 <= dst_q1;
      dst_q3 <= dst_q2;
    end
  end

  // Step 3: Edge detector (XOR detects both 0->1 and 1->0 toggle transitions)
  assign pulse_dst = dst_q2 ^ dst_q3;
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 Pulse Synchronizer — Clock-Domain Crossing, 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 Toggle-based Pulse Synchronizer to transfer a single-cycle pulse from a fast clock domain (clk_src) to a slow destination 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 toggle pulse conversion, 2-flop synchronization across differing frequencies, and edge detection in the destination domain.

Prerequisites: Two-flop synchronizers, toggle flip-flops, rising/falling edge detection.

Port List & Interface Timing

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

NameDirWidthDescription
clk_srcinput1Source clock domain (fast)
areset_src_ninput1Source domain reset
pulse_srcinput1Single-cycle pulse in source domain
clk_dstinput1Destination clock domain (slow)
areset_dst_ninput1Destination domain reset
pulse_dstoutput1Single-cycle pulse in destination domain

Timing Constraints & Synthesizable RTL Rules

⚡ Synthesizable Implementation Guidelines

Timing Contract: Input `pulse_src` is a single-cycle strobe in `clk_src`. Output `pulse_dst` asserts for exactly 1 cycle in `clk_dst`.

Synthesis Constraints: Consecutive pulses must be spaced far enough apart to allow toggle completion in the slow domain.

Architectural Deep Dive & Implementation Walkthrough

If a pulse in a 500 MHz domain is 2 ns wide, a 50 MHz clock (20 ns period) would easily miss it. By toggling a register on every pulse, the level stays persistent indefinitely until the slow clock samples it. An XOR gate across the synchronized delayed stages detects both rising and falling toggle transitions, reconstructing an exact 1-cycle pulse in the destination domain.

Common RTL Designer Pitfalls

⚠️ Common Mistakes to Avoid

['Sending a second pulse before the first pulse has been sampled in the destination domain, causing pulse collision/loss.', 'Using a simple edge detector (`dst_q2 & ~dst_q3`) instead of XOR (`dst_q2 ^ dst_q3`), which misses every alternate pulse.']

Silicon & Hardware Engineering Notes

🛠️ ASIC vs FPGA Hardware Considerations

Ensure the pulse rate in the fast domain is less than twice the period of the slow clock domain, or use an asynchronous handshake/FIFO.

Starter RTL Code

module top_module(
  input   clk_src,
  input   areset_src_n,
  input   pulse_src,
  input   clk_dst,
  input   areset_dst_n,
  output  pulse_dst
);

  // Toggle Pulse Synchronizer across clock domains

endmodule

Verified Reference Solution

🔒 Reveal Verified Reference RTL Solution
module top_module(
  input   clk_src,
  input   areset_src_n,
  input   pulse_src,
  input   clk_dst,
  input   areset_dst_n,
  output  pulse_dst
);
  reg src_toggle;

  // Step 1: In source domain, toggle on each pulse
  always @(posedge clk_src or negedge areset_src_n) begin
    if (!areset_src_n)
      src_toggle <= 1'b0;
    else if (pulse_src)
      src_toggle <= ~src_toggle;
  end

  // Step 2: Synchronize toggle level across CDC into clk_dst using 2 flops
  reg dst_q1, dst_q2, dst_q3;
  always @(posedge clk_dst or negedge areset_dst_n) begin
    if (!areset_dst_n) begin
      dst_q1 <= 1'b0;
      dst_q2 <= 1'b0;
      dst_q3 <= 1'b0;
    end else begin
      dst_q1 <= src_toggle;
      dst_q2 <= dst_q1;
      dst_q3 <= dst_q2;
    end
  end

  // Step 3: Edge detector (XOR detects both 0->1 and 1->0 toggle transitions)
  assign pulse_dst = dst_q2 ^ dst_q3;
endmodule

Related RTL Problems in Level 4

Frequently Asked Questions

What does Pulse Synchronizer — Clock-Domain Crossing require?

Design a Toggle-based Pulse Synchronizer to transfer a single-cycle pulse from a fast clock domain (clk_src) to a slow destination 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, pulse-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 Pulse Synchronizer — Clock-Domain Crossing to assess real-world synthesizability and race-condition awareness.