Handshakes are how RTL blocks agree that a transfer happened. Valid-ready (AXI-stream style) and req-ack (classic bus) are the two you'll see everywhere. Get the rules wrong and you get dropped data, deadlock, or combinational loops that synthesis rejects.
Valid-ready: valid && ready on a clock edge (or combo handshake).
Req-ack: req asserted, ack returned — timing defined by protocol (level vs pulse).
Handshakes are the contract between RTL blocks. AXI-Stream, TileLink, and internal FIFO interfaces all boil down to valid-ready or req-ack semantics. Violating independence rules creates combinational loops that synthesis rejects and simulation may hide until silicon.
| Rule | Sender (valid) | Receiver (ready) |
|---|---|---|
| 1 | valid may rise anytime | ready may rise anytime |
| 2 | Once valid high, data must stay stable until transfer | Once ready high, receiver must accept if valid |
| 3 | Transfer = valid && ready | Same |
| 4 | Sender drops valid after transfer (unless back-to-back) | Receiver may deassert ready after transfer |
Transfer occurs when valid && ready are both high.
// Sender: assert valid when data available; hold until xfer
always @(posedge clk or negedge rst_n) begin
if (!rst_n) begin
valid <= 1'b0;
data <= 8'h00;
end else if (valid && ready) begin
valid <= 1'b0; // transfer complete
// load next beat if available
end else if (!valid && has_data) begin
valid <= 1'b1;
data <= next_data;
end
// else: hold valid and data (rule 2)
end
// Receiver: ready when internal buffer has space
assign ready = !fifo_full; // ★ ready NOT a function of valid!
// Capture on transfer
always @(posedge clk) begin
if (valid && ready)
fifo_push(data);
end
NEVER: assign ready = !valid; or assign valid = ready; — this creates a combinational loop. ready must depend only on receiver internal state (FIFO space). valid only on sender state.
When both sides are ready, valid-ready supports one transfer per cycle without gaps. The sender keeps valid high and updates data each cycle while ready stays high.
AXI-Stream alignment: This is exactly AXI-Stream beat behavior — TVALID/TREADY with no mandatory gap between beats. Req-ack level protocols usually need an IDLE cycle between transactions.
Deadlock happens when both sides wait on each other: sender won't assert valid until ready, receiver won't assert ready until valid. Classic combo-loop variant at the protocol level.
Always-ready sink (assign ready = 1) is fine for testbenches. In real designs, ready must reflect back-pressure. Never tie ready to valid — even indirectly through a long combo chain.
When the receiver's ready logic is slow, a skid buffer (2-entry FIFO) lets the sender see ready=1 one cycle earlier. Full design in Module 7.1 — here's the concept:
Without skid: ready = f(slow_logic) → long combo path. With skid: ready = !skid_full (fast). The skid absorbs one cycle when sink hiccups.
| Signal | Direction | Meaning |
|---|---|---|
req | Requester → Servicer | "I need a transfer / service" |
ack | Servicer → Requester | "Transfer accepted / done" |
// Requester FSM — level req until ack
localparam IDLE = 2'd0, WAIT = 2'd1;
reg [1:0] state;
always @(posedge clk or negedge rst_n) begin
if (!rst_n) begin
state <= IDLE;
req <= 1'b0;
end else case (state)
IDLE: if (want_xfer) begin
req <= 1'b1;
state <= WAIT;
end
WAIT: if (ack) begin
req <= 1'b0;
state <= IDLE;
end
default: state <= IDLE;
endcase
end
| Protocol | Strength | Common in |
|---|---|---|
| Valid-ready | Back-pressure native; pipelined; burst-friendly | AXI-Stream, TileLink, internal NoC |
| Req-ack | Simple FSM mapping; clear transaction boundary | Register bus, config ports, legacy IPs |
valid&ready or req&ackready never depends combinationally on validdata stable while valid asserted (until xfer)valid && ready — both sides independent.ready to valid — combo loop trap.