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).
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.
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 |
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.
Step through the handshake process. Notice how the synchronizer flops delay the signals as they cross boundaries.
Here is a generic synthesizable Verilog implementation of both the sender and receiver.
// ----------------------------------------------------
// 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// ----------------------------------------------------
// 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
endmoduleClosed-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.