CDC Course / Module 7: Passing Multiple CDC Signals
Lesson 7.4

Closed-Loop MCP with Acknowledge

In the previous lesson, we learned about Open-Loop Multi-Cycle Paths (MCP). While effective, open-loop requires the sender to blindly hold data stable for a pre-calculated number of cycles. If the clock ratio changes, or if the clocks drift, the design breaks. Closed-Loop MCP solves this by introducing a feedback signal: the Acknowledge (ack).

1 Why Closed-Loop?

With an open-loop design, the sender assumes the receiver has captured the data after a fixed timer expires. In a closed-loop system, the sender waits for explicitly confirmation. The receiver asserts an ack signal once it has safely registered the data. This creates a fully asynchronous, robust handshake that is immune to changes in clock frequencies or phase relationships.

2 The Full 4-Phase Handshake Protocol

The standard closed-loop MCP uses a 4-phase handshake (also known as return-to-zero). The protocol progresses through four distinct steps for every single data transfer:

Phase Action Signals
1. Request Asserts Sender places data on the bus and asserts req. tx_req = 1, rx_ack = 0
2. Acknowledge Asserts Receiver syncs req, captures data, and asserts ack. tx_req = 1, rx_ack = 1
3. Request De-asserts Sender syncs ack, de-asserts req. (Data can now change). tx_req = 0, rx_ack = 1
4. Acknowledge De-asserts Receiver syncs req falling edge, de-asserts ack. tx_req = 0, rx_ack = 0
Latency Equation:
Total Transfer Time ≈ 2 (Sync Tx→Rx) + 1 (Rx Logic) + 2 (Sync Rx→Tx) + 1 (Tx Logic) = 6 clock edges total (assuming matched clock frequencies).

3 Architecture Diagram

Notice how the multi-bit data bus requires no synchronizer—it relies on the MCP formulation. Only the 1-bit req and ack signals pass through 2-flop synchronizers.

TX Domain (clk_tx) RX Domain (clk_rx) TX FSM Sync RX FSM Data Reg Sync tx_data[N:0] tx_req rx_ack

4 Interactive Lab: 4-Phase Handshake Simulator

Step through the handshake process. Notice how the synchronizer flops delay the signals as they cross boundaries.

Phase 0: IDLE (Ready for Transfer)
TX Domain (Sender)
Data Bus Output: 0x00
tx_req: 0

rx_ack_sync1: 0
rx_ack_sync2: 0
RX Domain (Receiver)
tx_req_sync1: 0
tx_req_sync2: 0

rx_ack: 0
Captured Data: 0x00

5 RTL Implementation

Here is a generic synthesizable Verilog implementation of both the sender and receiver.

filename.v
// ----------------------------------------------------
// TX Domain Module
// ----------------------------------------------------
module mcp_tx #(
    parameter WIDTH = 32
)(
    input  wire             clk_tx,
    input  wire             rst_n_tx,
    input  wire [WIDTH-1:0] tx_data_in,
    input  wire             tx_start,
    output reg  [WIDTH-1:0] tx_data_out,
    output reg              tx_req,
    input  wire             rx_ack,      // Asynchronous input
    output reg              tx_ready
);

    // 2-flop synchronizer for ack
    reg ack_q1, ack_q2;
    always @(posedge clk_tx or negedge rst_n_tx) begin
        if (!rst_n_tx) {ack_q2, ack_q1} <= 2'b00;
        else           {ack_q2, ack_q1} <= {ack_q1, rx_ack};
    end

    // Simple FSM
    localparam IDLE = 0, REQ = 1, WAIT_ACK = 2;
    reg [1:0] state;

    always @(posedge clk_tx or negedge rst_n_tx) begin
        if (!rst_n_tx) begin
            state       <= IDLE;
            tx_req      <= 1'b0;
            tx_ready    <= 1'b1;
            tx_data_out <= 0;
        end else begin
            case (state)
                IDLE: begin
                    if (tx_start) begin
                        tx_data_out <= tx_data_in; // Hold data steady
                        tx_req      <= 1'b1;       // Assert Req
                        tx_ready    <= 1'b0;
                        state       <= WAIT_ACK;
                    end
                end
                WAIT_ACK: begin
                    if (ack_q2 == 1'b1) begin      // Phase 2 completed
                        tx_req <= 1'b0;            // De-assert Req (Phase 3)
                        state  <= IDLE;            // (Wait for ack_q2 to fall before next transfer implicitly handled by tx_ready)
                    end
                end
            endcase
            
            // Re-enable ready only when ack has returned to 0 (Phase 4 completed)
            if (state == IDLE && ack_q2 == 1'b0)
                tx_ready <= 1'b1;
        end
    end
endmodule
filename.v
// ----------------------------------------------------
// RX Domain Module
// ----------------------------------------------------
module mcp_rx #(
    parameter WIDTH = 32
)(
    input  wire             clk_rx,
    input  wire             rst_n_rx,
    input  wire [WIDTH-1:0] tx_data_in,  // Multi-cycle path data
    input  wire             tx_req,      // Asynchronous input
    output reg              rx_ack,
    output reg  [WIDTH-1:0] rx_data_out,
    output reg              rx_valid
);

    // 2-flop synchronizer for req
    reg req_q1, req_q2;
    reg req_q3; // Edge detection

    always @(posedge clk_rx or negedge rst_n_rx) begin
        if (!rst_n_rx) {req_q3, req_q2, req_q1} <= 3'b000;
        else           {req_q3, req_q2, req_q1} <= {req_q2, req_q1, tx_req};
    end

    wire req_rising  = (req_q2 && !req_q3);
    wire req_falling = (!req_q2 && req_q3);

    always @(posedge clk_rx or negedge rst_n_rx) begin
        if (!rst_n_rx) begin
            rx_ack      <= 1'b0;
            rx_valid    <= 1'b0;
            rx_data_out <= 0;
        end else begin
            rx_valid <= 1'b0; // pulse
            
            if (req_rising) begin
                rx_data_out <= tx_data_in; // Capture data safely!
                rx_valid    <= 1'b1;
                rx_ack      <= 1'b1;       // Assert Ack (Phase 2)
            end else if (req_falling) begin
                rx_ack      <= 1'b0;       // De-assert Ack (Phase 4)
            end
        end
    end
endmodule
Latency Warning: Because of the 4-phase handshake and double-flop synchronizers in both directions, a single transfer takes many clock cycles. Do not use this for streaming data! If you need high throughput, use an Asynchronous FIFO instead.

Key Takeaway

Closed-loop MCP is incredibly robust because the data remains perfectly stable while req is asserted, and the sender explicitly waits for ack before changing the data. This guarantees safe crossing regardless of clock skews or jitter.

Advertisement