⚡ Recurring Silicon Engineering Drills

Challenge of the Week

Sharpen your microarchitectural instincts. Every Monday, a new tapeout-inspired design or verification challenge drops with automated testbenches and verified synthesizable RTL solutions.

Week 5 Challenge · Active Now ⏱️ Closes: Sunday 23:59 UTC

Zero-Latency Multi-Bit CDC Handshake Controller

Transfer an 8-bit data payload data_in[7:0] from a fast source clock domain (clk_src = 250 MHz) to an asynchronous destination clock domain (clk_dst = 80 MHz) using a 4-phase request-acknowledge handshake. The controller must hold the bus stable, guarantee zero metastability at destination flip-flops, and acknowledge back to the source before accepting new data.

Interface Signal Specification

PortDirectionClock DomainDescription
clk_srcInputclk_srcFast source clock (250 MHz)
rst_src_nInputclk_srcActive-low source reset
src_validInputclk_srcAsserted when src_data is valid
src_data[7:0]Inputclk_src8-bit data word
src_readyOutputclk_srcHigh when ready for new write
clk_dstInputclk_dstSlow destination clock (80 MHz)
rst_dst_nInputclk_dstActive-low destination reset
dst_validOutputclk_dst1-cycle strobe when dst_data is captured
dst_data[7:0]Outputclk_dstSynchronized 8-bit data word
💡 View Engineering Hint & Timing Rules

Rule 1: Never synchronize src_data directly with multi-bit flip-flops. Instead, capture src_data in a holding register in clk_src, then toggle a single-bit req signal.
Rule 2: Synchronize req into clk_dst using a 2-stage synchronizer. When detected, latch the holding register and return an ack toggle to clk_src.

🔍 View Verified Reference Solution & RTL
module cdc_handshake_sync #(
  parameter WIDTH = 8
)(
  // Source Domain
  input  wire             clk_src,
  input  wire             rst_src_n,
  input  wire             src_valid,
  input  wire [WIDTH-1:0] src_data,
  output wire             src_ready,

  // Destination Domain
  input  wire             clk_dst,
  input  wire             rst_dst_n,
  output reg              dst_valid,
  output reg  [WIDTH-1:0] dst_data
);
  // Source holding register & req flag
  reg [WIDTH-1:0] hold_data;
  reg             src_req;

  // 2-FF synchronizer: req to dst domain
  (* ASYNC_REG = "TRUE" *) reg req_dst_d1, req_dst_d2;
  reg req_dst_d3;

  // 2-FF synchronizer: ack to src domain
  (* ASYNC_REG = "TRUE" *) reg ack_src_d1, ack_src_d2;
  reg ack_dst;

  assign src_ready = (src_req == ack_src_d2);

  always @(posedge clk_src or negedge rst_src_n) begin
    if (!rst_src_n) begin
      src_req   <= 1'b0;
      hold_data <= 0;
    end else if (src_valid && src_ready) begin
      hold_data <= src_data;
      src_req   <= ~src_req; // Toggle request
    end
  end

  // Synchronize req into dst domain
  always @(posedge clk_dst or negedge rst_dst_n) begin
    if (!rst_dst_n) begin
      req_dst_d1 <= 0; req_dst_d2 <= 0; req_dst_d3 <= 0;
      ack_dst    <= 0; dst_valid  <= 0; dst_data   <= 0;
    end else begin
      req_dst_d1 <= src_req;
      req_dst_d2 <= req_dst_d1;
      req_dst_d3 <= req_dst_d2;

      // Pulse detection on edge
      if (req_dst_d2 ^ req_dst_d3) begin
        dst_data  <= hold_data;
        dst_valid <= 1'b1;
        ack_dst   <= ~ack_dst; // Toggle ack back
      end else begin
        dst_valid <= 1'b0;
      end
    end
  end

  // Synchronize ack into src domain
  always @(posedge clk_src or negedge rst_src_n) begin
    if (!rst_src_n) begin
      ack_src_d1 <= 0; ack_src_d2 <= 0;
    end else begin
      ack_src_d1 <= ack_dst;
      ack_src_d2 <= ack_src_d1;
    end
  end
endmodule
⚡ Test in Verilog Simulator → Points: +50 XP · Verified Solution Available

8-Week Master Challenge Schedule

Week Core Discipline Challenge Title Difficulty Status Action
Week 1 Combinational Logic Glitches in Carry-Select vs Lookahead Adders Medium Archived View Spec & Solution →
Week 2 Sequential Logic Self-Correcting Johnson Counter with Recovery State Easy Archived View Spec & Solution →
Week 3 FSM Design One-Hot Traffic Light with Emergency Preemption Medium Archived View Spec & Solution →
Week 4 FIFO Design Dynamic Watermark Calculation for Burst Memory Hard Archived View Spec & Solution →
Week 5 CDC & RDC Zero-Latency Multi-Bit CDC Handshake Controller Medium Active Now Active Above ↑
Week 6 Bus Protocols Zero-Wait-State APB3 Register Bank with Byte-Strobes Medium Upcoming Opens Next Monday
Week 7 Streaming Protocols AXI4-Stream Dynamic Width Converter with TKEEP Hard Upcoming In Preparation
Week 8 Static Timing (STA) False Path Identification in Clock Multiplexed Domains Hard Upcoming In Preparation