A pipeline stage with registered outputs cannot accept a new beat the same cycle its downstream neighbor stalls — unless you add elasticity. The skid buffer is the smallest valid-ready elastic stage: one extra register slot that absorbs back-pressure without combinational loops between valid and ready.
A skid buffer (1-deep elastic buffer) sits between pipeline stages. It holds at most one extra beat when downstream is not ready, so upstream can still transfer on the stall cycle — preserving throughput for single-cycle bubbles.
Consider two registered stages connected by valid-ready:
Stage B registers its output on the clock edge. If Stage C deasserts m_ready on cycle N, Stage B cannot accept a new input on that same edge — its output register is still occupied. Without elasticity, Stage A must stall immediately, even if it had a valid beat ready.
Think of a conveyor belt with a single loading dock. If the next station's tray is full, the loader must stop — unless there's a side shelf (the skid) where one box can wait while the loader keeps working for exactly one more beat.
| Structure | Depth | Throughput when downstream stalls 1 cycle | Combo loop risk |
|---|---|---|---|
| Direct wire (no buffer) | 0 | Upstream stalls same cycle | High if ready feeds back combo |
| Simple register slice | 1 | Upstream stalls on stall cycle | Low if Moore outputs |
| Skid buffer | 1 + 1 skid slot | Upstream can xfer 1 more beat | Low — registered ready |
| Sync FIFO | N | Absorbs N stalls | Low |
The classic mistake wires s_ready combinationally to downstream readiness AND upstream validity:
assign s_ready = m_ready && !s_valid; — if the sender's valid also depends on s_ready in the same cycle, synthesis reports a combinational loop. Even when simulation "works," timing closure fails.
Valid-ready rule from Module 6: ready is a registered or state-derived signal; it must not be a function of the incoming valid in the same cycle. The skid buffer solves this by tracking occupancy in registers:
m_valid, m_data)Main register drives downstream; skid catches one beat when main is full and upstream still transfers.
A minimal skid tracks two bits of state: whether main and skid slots are occupied.
| main_full | skid_full | s_ready | m_valid | Meaning |
|---|---|---|---|---|
| 0 | 0 | 1 | 0 | Empty — accept upstream |
| 1 | 0 | 1 | 1 | One beat in main; skid free |
| 1 | 1 | 0 | 1 | Full — must stall upstream |
| 0 | 1 | 0 | 1 | Transient during skid→main move |
"Why not just use a 2-entry FIFO?" — A skid is cheaper (2 regs + small control) and exactly matches the pipeline elasticity need. FIFOs generalize to depth N; skids are the 1-deep special case you'll instantiate between every pipe stage.
// skid_buffer — 1-deep valid-ready elastic stage
// WIDTH parameterizable; breaks valid/ready combo loops
module skid_buffer #(
parameter WIDTH = 8
) (
input wire clk,
input wire rst_n,
// Upstream (slave to source)
input wire s_valid,
input wire [WIDTH-1:0] s_data,
output wire s_ready,
// Downstream (master to sink)
output wire m_valid,
output wire [WIDTH-1:0] m_data,
input wire m_ready
);
reg main_full, skid_full;
reg [WIDTH-1:0] main_data, skid_data;
wire s_xfer = s_valid && s_ready;
wire m_xfer = m_valid && m_ready;
// Registered ready — NOT a function of s_valid
assign s_ready = !main_full || (m_xfer && !skid_full);
assign m_valid = main_full;
assign m_data = main_data;
always @(posedge clk or negedge rst_n) begin
if (!rst_n) begin
main_full <= 1'b0;
skid_full <= 1'b0;
main_data <= {WIDTH{1'b0}};
skid_data <= {WIDTH{1'b0}};
end else begin
// Downstream xfer: shift skid → main if present
if (m_xfer) begin
if (skid_full) begin
main_data <= skid_data;
skid_full <= 1'b0;
end else
main_full <= 1'b0;
end
// Upstream xfer: fill main or skid
if (s_xfer) begin
if (!main_full) begin
main_full <= 1'b1;
main_data <= s_data;
end else begin
skid_full <= 1'b1;
skid_data <= s_data;
end
end
end
end
endmodule
Do not write assign s_ready = !s_valid && .... Occupancy flags must come from registers updated on the clock edge, not from the current beat's valid.
Cycle 4: m_ready=0 but s_ready=1 — beat B enters skid while A waits on m_data
Cycle 5: m_ready=1 — A transfers; skid shifts B into main on next edge
The key observation: without a skid, s_ready would drop the same cycle m_ready drops, losing the second upstream beat or creating a combo path through valid.
// Typical pattern: skid → compute → skid
wire stage_valid, stage_ready;
wire [31:0] stage_data;
skid_buffer #(.WIDTH(32)) u_in_skid (
.clk(clk), .rst_n(rst_n),
.s_valid(up_valid), .s_data(up_data), .s_ready(up_ready),
.m_valid(stage_valid), .m_data(stage_data), .m_ready(stage_ready)
);
// Registered compute block (1-cycle latency)
reg [31:0] result;
reg result_valid;
always @(posedge clk) begin
if (stage_valid && stage_ready) begin
result <= stage_data + 32'd1; // example op
result_valid <= 1'b1;
end else if (down_ready)
result_valid <= 1'b0;
end
skid_buffer #(.WIDTH(32)) u_out_skid (
.clk(clk), .rst_n(rst_n),
.s_valid(result_valid), .s_data(result), .s_ready(stage_ready),
.m_valid(down_valid), .m_data(down_data), .m_ready(down_ready)
);
Engineers often confuse three similar structures. Here is when to use each:
| Structure | Registers | Throughput under 1-cycle stall | Typical use |
|---|---|---|---|
| Wire (no buffer) | 0 | Stalls immediately | Combo paths only |
| Register slice | 1 | Stalls on stall cycle | Simple pipeline stage |
| Skid buffer | 2 (main + skid) | 1 extra beat accepted | Between pipe stages with back-pressure |
| 2-entry FIFO | 2 + ptr logic | 2 beats buffered | Rate-matching, wider elasticity |
A skid costs roughly 2× the register bits of a plain slice but buys exactly one cycle of upstream immunity. If your downstream stall bursts are longer than 1 cycle, step up to a sync FIFO (Lesson 7.2). If stalls are rare single-cycle bubbles, skid is the sweet spot.
// Minimal directed test: 2 beats in, 1-cycle m_ready stall
initial begin
rst_n = 0; s_valid = 0; m_ready = 0;
#20 rst_n = 1; m_ready = 1;
@(posedge clk); s_valid = 1; s_data = 8'hAA;
@(posedge clk); s_data = 8'hBB; // second beat same cycle m_ready drops
m_ready = 0;
@(posedge clk); s_valid = 0;
if (!s_ready) $display("FAIL: skid should accept B");
repeat(2) @(posedge clk);
m_ready = 1;
@(posedge clk);
if (m_data !== 8'hAA) $display("FAIL: first out should be AA");
@(posedge clk);
if (m_data !== 8'hBB) $display("FAIL: second out should be BB");
else $display("PASS: skid absorbed stall");
end
s_ready is NOT a combinational function of s_validm_ready=0 for exactly 1 cycle while 2 beats arrivem_ready always high (full throughput)ready must be registered from occupancy/state, never combo from incoming valid.