- Start Date: 2023-08-22
- RFC PR: amaranth-lang/rfcs#20
- Amaranth Issue: amaranth-lang/amaranth#875
Deprecate non-FWFT FIFOs
Summary
Deprecate non-first-word-fall-through FIFOs.
Motivation
Currently, FIFOs in amaranth.lib.fifo have two incompatible interfaces: FWFT (first word fallthrough) and non-FWFT. The incompatibility concerns only the read half. FWFT FIFOs have r_data valid when r_rdy is asserted. Non-FWFT FIFOs have r_data valid only after strobing r_en, if the FIFO was empty previously.
Non-FWFT interface is awkward and is essentially never used. It is a holdover from Migen and its implementation details that was included for compatibility. There are three downsides to having it:
- Having non-FWFT FIFOs requires every consumer of the FIFO interface to check for
fwftwhen interacting with the FIFO and either asserting that it isTrue, or adding a code path to handle it. No one does this. - The FWFT interface is directly compatible with streams and allows us to add e.g.
r_streamandw_streamto existing FIFOs without adding a wrapper such asstream.FIFO. It also makes any custom FIFOs defined downstream of Amaranth stream-enabled. - The notion of FWFT vs non-FWFT FIFOs is confusing and difficult to understand. E.g. the author of this RFC wrote both
lib.fifoand the Glasgow FIFO code, and she misused thefwftargument in the latter.
Guide-level and reference-level explanation
In the next version, instantiating SyncFIFO(fwft=False) emits a deprecation warning. In addition, FIFOInterface's fwft parameter now defaults to True. Other FIFOs have no non-FWFT variant in the first place.
In the version after that, there is no way to instantiate SyncFIFO(fwft=False). The feature and all references to it are removed in their entirety.
Implementation considerations
At the moment, SyncFIFOBuffered is implemented as a register in the output of SyncFIFO(fwft=False). The implementation will need to be rewritten.
Drawbacks
- Churn.
- There will be no alternative to
SyncFIFO(fwft=False).
Rationale and alternatives
- It is feasible to extract
SyncFIFO(fwft=False)into its own module that may be used by downstream code that needs non-FWFT FIFOs. It would not implementFIFOInterface.- There is no reason the
SyncFIFOclass could not be copied into downstream code as it is.
- There is no reason the
- It is possible to wrap FIFOs in the stream library in a way that ensures only FWFT FIFOs are used.
- Let's not create pointless wrappers.
Prior art
Not relevant.
Unresolved questions
None.
Future possibilities
This RFC primarily exists to enable better stream interface integration.