RTL Design #36 · 2026-10-29 · Width conversion · Easy · about 10 min
A width converter that skips a beat under backpressure
narrow turns a 16-bit word into two 8-bit beats, with valid/ready on both sides. A beat moves when valid and ready are both 1 at a rising edge.
- The converter takes one word at a time.
in_readyis 1 whenever it holds no word, and 0 while it is sending one. - It sends the low byte first, then the high byte.
out_lastis 1 on the high byte only. - While
out_validis 1 andout_readyis 0,out_valid,out_dataandout_lasthold. - After the high byte moves, the converter is empty and
in_readyreturns to 1. - After reset it is empty.
With the consumer always ready the design works. When the consumer stalls, bytes go missing. Fix narrow.sv.
Write and run your answer in the browser. The hidden tests check it, and it’s free.