clash-lang / clash-protocols

a battery-included library for dataflow protocols
Other
19 stars 7 forks source link

Add simpler PacketStream FIFO #121

Open t-wallet opened 1 month ago

t-wallet commented 1 month ago

Sometimes all you want to achieve with a FIFO is absorb minimal backpressure. Not having to buffer full packets allows for a shallower FIFO and less logic. The implementation can be largely copied from packetFifoC, removing all of the dropping semantics. Note that using DfConv.fifo is also a solution, but highly suboptimal because it does not have a separate FIFO for metadata.

Expected behaviour

The circuit is expected to have the following type:

fifoC ::
  forall dataWidth meta dom contentDepth metaDepth.
  SNat contentDepth ->
  SNat metaDepth ->
  Circuit (PacketStream dom meta dataWidth) (PacketStream dom meta dataWidth)