Skid Buffer
Medium · Sequential · SystemVerilog · VHDL
A premium problem. Subscribe to open it in the editor, run the testbench and see where your design lands.
Design a skid buffer: a valid/ready register slice whose outputs, s_ready included, are all registered.
A pipeline stage that registers its ready signal learns of a downstream stall a cycle late, so it can accept one word it has nowhere to send. A skid buffer keeps one extra slot, the skid slot, to catch that word. Every path through the stage then starts or ends at a register, in both directions, and the stage still passes one word per cycle.
A word is accepted in a cycle with s_valid and s_ready high, and delivered in a cycle with m_valid and m_ready high. The buffer holds up to two words: one in the output register, shown on m_valid and m_data, and one in the skid slot. Words are delivered in the order they were accepted, each exactly once.
In a cycle in which the output register is empty or delivers its word, it holds from the next cycle the skid slot's word if there is one, otherwise the word accepted in that cycle, and otherwise nothing (m_valid low). In a cycle in which the output register holds a word that is not delivered, a word accepted in that cycle goes to the skid slot. So a word accepted while the output register is empty or delivering is on m_data in the following cycle, and with m_ready high the buffer passes one word per cycle.
s_ready is high exactly when the skid slot is empty. m_data is don't-care while m_valid is low.
resetn is a synchronous, active-low reset that empties the buffer: m_valid becomes 0 and s_ready becomes 1.
- FIFOs & memory
- Arbitration & flow control