RTL Design / Module 7: Datapath & Memory Systems
Lesson 7.1

Skid buffer — why pipelines need it

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.

Definition

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.

1

The pipeline stall problem

Consider two registered stages connected by valid-ready:

Stage Avalid/readyStage Bvalid/readyStage C

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.

Analogy

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.

StructureDepthThroughput when downstream stalls 1 cycleCombo loop risk
Direct wire (no buffer)0Upstream stalls same cycleHigh if ready feeds back combo
Simple register slice1Upstream stalls on stall cycleLow if Moore outputs
Skid buffer1 + 1 skid slotUpstream can xfer 1 more beatLow — registered ready
Sync FIFONAbsorbs N stallsLow
2

Why ready cannot depend on valid (combo loop)

The classic mistake wires s_ready combinationally to downstream readiness AND upstream validity:

Trap — combinational loop

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:

  • Main register — holds the beat presented to downstream (m_valid, m_data)
  • Skid register — catches one overflow beat when main is full and upstream still has data
  • ready — asserted when there is space (main empty OR skid empty with transfer happening)
Skid buffer internal structure

Main register drives downstream; skid catches one beat when main is full and upstream still transfers.

3

Occupancy states

A minimal skid tracks two bits of state: whether main and skid slots are occupied.

main_fullskid_fulls_readym_validMeaning
0010Empty — accept upstream
1011One beat in main; skid free
1101Full — must stall upstream
0101Transient during skid→main move
Interview angle

"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.

4

1-deep skid buffer RTL

skid_buffer.v
// 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
Trap

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.

5

Waveform — skid absorbs one stall

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.

6

Instantiation pattern in pipelines

pipeline_slice.v
// 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)
);
▶ Run skid buffer in simulator
7

Skid vs register slice vs 2-entry FIFO

Engineers often confuse three similar structures. Here is when to use each:

StructureRegistersThroughput under 1-cycle stallTypical use
Wire (no buffer)0Stalls immediatelyCombo paths only
Register slice1Stalls on stall cycleSimple pipeline stage
Skid buffer2 (main + skid)1 extra beat acceptedBetween pipe stages with back-pressure
2-entry FIFO2 + ptr logic2 beats bufferedRate-matching, wider elasticity
Design trade-off

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.

skid_buffer_tb_snippet.v
// 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
8

Design checklist

  • Verify s_ready is NOT a combinational function of s_valid
  • Confirm occupancy FSM covers all 4 states with safe reset (both empty)
  • Test: downstream m_ready=0 for exactly 1 cycle while 2 beats arrive
  • Test: back-to-back transfers with m_ready always high (full throughput)
  • Document WIDTH parameter and whether skid is on input, output, or both sides

🎯 What to remember

  • Skid buffers add 1 beat of elasticity between pipeline stages — the minimum fix for registered-stage stalls.
  • ready must be registered from occupancy/state, never combo from incoming valid.
  • Main + skid registers = at most 2 beats in flight; upstream stalls only when both are full.
  • Next up: sync FIFOs generalize this to depth N with full/empty flags.
Advertisement