Draft preview. Lessons are being written and reviewed.

Digital Design / Module 7: Memories and FIFOs

44. Skid buffers

Break a long ready path.

Lecture coming soon

See it move

The idea

In a long , the ready path back to the source can become the critical timing path. The natural fix is to register ready, but that creates a new problem: the upstream block sees the "stop" a cycle too late, and it has already sent one more word. That word needs somewhere to go.

A skid buffer supplies one spare storage slot for that word. The name comes from a car skidding a little further after the brakes are applied.

How it works

  • Normal flow: data passes straight through, and the spare is empty.
  • Downstream stops: the word already in flight lands in the spare.
  • ready to upstream goes low, since the spare is full.
  • Downstream resumes: the spare empties first, and then ready rises again.
assign in_ready  = !spare_full;
assign out_valid = spare_full || in_valid;
assign out_data  = spare_full ? spare : in_data;

always_ff @(posedge clk)
  if (rst)
    spare_full <= 1'b0;
  else if (spare_full) begin
    if (out_ready) spare_full <= 1'b0;
  end else if (in_valid && !out_ready) begin
    spare      <= in_data;
    spare_full <= 1'b1;
  end

in_ready now comes from a flop, so the combinational path from out_ready has been cut.

Comparing the options

DesignReady pathThroughputExtra storage
Simple pipeline registerCombinationalFullNone
Registered ready, no spareCutWords get lostNone
Skid bufferCutFullOne entry

Full designs often register the output data as well as ready, cutting both directions.

Check it with stress

Test with random , because this kind of bug appears only with particular patterns. Check that every word arrives once, in order. In the animation above, switch between the two modes and toggle ready in different cycles.

Common mistake

Sizing the spare without counting the delay. One registered stage means one word in flight. With more register stages in the ready path, you need more entries, and the structure becomes a small .

Key ideas

  • Registering ready adds a cycle of delay.
  • One extra entry holds data already in flight.
  • It is effectively a small FIFO, keeping full throughput.

Your exercise

Write and test a skid buffer against random backpressure.

Find the bug

This code has one deliberate bug. Read the symptom, then click the line you think is wrong.

What goes wrong: The word caught during a stall is stored but never delivered, and one word is lost each time.

Interview questions

coreWhy not simply register ready?

basicWhat problem does a skid buffer solve?

basicIf ready reaches the sender through three register stages instead of one, how many spare entries do you need to avoid losing data?

coreThis skid buffer sometimes delivers a word twice. Find the bug.

always @(posedge clk)
  if (rst) spare_full <= 1'b0;
  else if (spare_full) begin
    if (out_ready) spare_full <= 1'b0;
  end else if (!out_ready) begin
    spare      <= in_data;
    spare_full <= 1'b1;
  end

coreIn the lesson's skid buffer, in_ready is !spare_full. Why does that cut the long ready path?

coreThe lesson's skid buffer cuts the ready path. Which path through it is still combinational, and why might that matter?

coreHow would you verify a skid buffer?

advancedFour of the lesson's skid buffers are chained, words are offered every cycle, and the final out_ready drops and stays low. How many more words does the source send, and where do they go?

advancedHow does a skid buffer that also registers its output differ from the lesson's version?

Practise these 9 questions with animations