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_ready is 1 whenever it holds no word, and 0 while it is sending one.
  • It sends the low byte first, then the high byte. out_last is 1 on the high byte only.
  • While out_valid is 1 and out_ready is 0, out_valid, out_data and out_last hold.
  • After the high byte moves, the converter is empty and in_ready returns 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.