RTL Design #24 · 2026-10-17 · Stream forks · Medium · about 15 min

A fork that delivers the same beat twice

stream_fork copies one valid/ready stream to two sinks, a and b. The source holds in_valid and in_data until the beat is accepted (in_valid && in_ready). The sinks are independent: either one may be ready when the other isn't.

  • Each sink receives every beat exactly once (x_valid && x_ready), in order.
  • A sink that hasn't taken the current beat yet sees valid for it, whatever either ready is doing. A sink that has taken it sees valid low until the next beat.
  • The source's beat is accepted in the cycle the last sink takes it. With both sinks ready, that's one beat per cycle and no added latency.

Run sends four beats with a always ready and b ready one cycle in three, and prints what each sink received. Fix stream_fork.sv.

Write and run your answer in the browser. The hidden tests check it, and it’s free.