Description
There is a desire to have a generic stream abstraction in nmigen.lib
which can be used / presented by the nmigen-stdio
cores (among others). This issue exists to capture discussion around the design of such an abstraction.
Obvious places to look for inspiration here include AXI4-Stream and Avalon-ST. Wishbone, although common in OSHW designs, does not define a specific streaming mode and thus is quite complex for the streaming use case. It's also underspecified, so "Wishbone compatibility" is less meaningful than we might hope.
AXI4-Stream uses a simple ready-valid handshake for flow control, which is non-optional. It requires all transfers to be integer multiples of 8 bits, and supports both "packet" and "frame" abstractions for higher-level structure over the octet stream. It also supports sparse data streams and multiplexing multiple logical streams onto a single physical stream (see TID
). All of these elements except for the "valid" half of the handshake are, technically speaking, optional. Anecdotally, I found the spec quite readable, although of course implementation may be another matter.
Avalon-ST is quite similar to AXI4-Stream with the following notable differences:
- No formal abstraction above "packet" (no "frame")
- Support for reporting errors
- Symbols need not be 8 bits
- Support for "ready latency" -
ready
is asserted zero or more cycles before the sink is actually ready to accept data - and "ready allowance" - each assertion ofready
allows the source to send zero or more beats afterready
is deasserted
Anecdotally, I found the Avalon-ST spec less readable than the AXI4-Stream spec, but only slightly.
My first-pass suggestion is a design much like Avalon-ST, but fixing the value of the beatsPerCycle
attribute to 1 and readyLatency
and readyAllowance
to 0.