docs: cover amaranth.lib.fifo
.
This commit is contained in:
parent
2adbe59e4f
commit
d2c569c45e
|
@ -25,42 +25,42 @@ class FIFOInterface:
|
||||||
Attributes
|
Attributes
|
||||||
----------
|
----------
|
||||||
{attributes}
|
{attributes}
|
||||||
w_data : in, width
|
w_data : Signal(width), in
|
||||||
Input data.
|
Input data.
|
||||||
w_rdy : out
|
w_rdy : Signal(1), out
|
||||||
Asserted if there is space in the queue, i.e. ``w_en`` can be asserted to write
|
Asserted if there is space in the queue, i.e. ``w_en`` can be asserted to write
|
||||||
a new entry.
|
a new entry.
|
||||||
w_en : in
|
w_en : Signal(1), in
|
||||||
Write strobe. Latches ``w_data`` into the queue. Does nothing if ``w_rdy`` is not asserted.
|
Write strobe. Latches ``w_data`` into the queue. Does nothing if ``w_rdy`` is not asserted.
|
||||||
w_level : out
|
w_level : Signal(range(depth + 1)), out
|
||||||
Number of unread entries.
|
Number of unread entries.
|
||||||
{w_attributes}
|
{w_attributes}
|
||||||
r_data : out, width
|
r_data : Signal(width), out
|
||||||
Output data. {r_data_valid}
|
Output data. {r_data_valid}
|
||||||
r_rdy : out
|
r_rdy : Signal(1), out
|
||||||
Asserted if there is an entry in the queue, i.e. ``r_en`` can be asserted to read
|
Asserted if there is an entry in the queue, i.e. ``r_en`` can be asserted to read
|
||||||
an existing entry.
|
an existing entry.
|
||||||
r_en : in
|
r_en : Signal(1), in
|
||||||
Read strobe. Makes the next entry (if any) available on ``r_data`` at the next cycle.
|
Read strobe. Makes the next entry (if any) available on ``r_data`` at the next cycle.
|
||||||
Does nothing if ``r_rdy`` is not asserted.
|
Does nothing if ``r_rdy`` is not asserted.
|
||||||
r_level : out
|
r_level : Signal(range(depth + 1)), out
|
||||||
Number of unread entries.
|
Number of unread entries.
|
||||||
{r_attributes}
|
{r_attributes}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__doc__ = _doc_template.format(description="""
|
__doc__ = _doc_template.format(description="""
|
||||||
Data written to the input interface (``w_data``, ``w_rdy``, ``w_en``) is buffered and can be
|
Data written to the input interface (``w_data``, ``w_rdy``, ``w_en``) is buffered and can be
|
||||||
read at the output interface (``r_data``, ``r_rdy``, ``r_en`). The data entry written first
|
read at the output interface (``r_data``, ``r_rdy``, ``r_en``). The data entry written first
|
||||||
to the input also appears first on the output.
|
to the input also appears first on the output.
|
||||||
""",
|
""",
|
||||||
parameters="",
|
parameters="""
|
||||||
r_data_valid="The conditions in which ``r_data`` is valid depends on the type of the queue.",
|
|
||||||
attributes="""
|
|
||||||
fwft : bool
|
fwft : bool
|
||||||
First-word fallthrough. If set, when ``r_rdy`` rises, the first entry is already
|
First-word fallthrough. If set, when ``r_rdy`` rises, the first entry is already
|
||||||
available, i.e. ``r_data`` is valid. Otherwise, after ``r_rdy`` rises, it is necessary
|
available, i.e. ``r_data`` is valid. Otherwise, after ``r_rdy`` rises, it is necessary
|
||||||
to strobe ``r_en`` for ``r_data`` to become valid.
|
to strobe ``r_en`` for ``r_data`` to become valid.
|
||||||
""".strip(),
|
""".strip(),
|
||||||
|
r_data_valid="The conditions in which ``r_data`` is valid depends on the type of the queue.",
|
||||||
|
attributes="",
|
||||||
w_attributes="",
|
w_attributes="",
|
||||||
r_attributes="")
|
r_attributes="")
|
||||||
|
|
||||||
|
@ -107,11 +107,12 @@ class SyncFIFO(Elaboratable, FIFOInterface):
|
||||||
that entry becomes available on the output on the same clock cycle. Otherwise, it is
|
that entry becomes available on the output on the same clock cycle. Otherwise, it is
|
||||||
necessary to assert ``r_en`` for ``r_data`` to become valid.
|
necessary to assert ``r_en`` for ``r_data`` to become valid.
|
||||||
""".strip(),
|
""".strip(),
|
||||||
r_data_valid="""
|
r_data_valid="For FWFT queues, valid if ``r_rdy`` is asserted. "
|
||||||
For FWFT queues, valid if ``r_rdy`` is asserted. For non-FWFT queues, valid on the next
|
"For non-FWFT queues, valid on the next cycle after ``r_rdy`` and ``r_en`` have been asserted.",
|
||||||
cycle after ``r_rdy`` and ``r_en`` have been asserted.
|
attributes="""
|
||||||
|
level : Signal(range(depth + 1)), out
|
||||||
|
Number of unread entries. This level is the same between read and write for synchronous FIFOs.
|
||||||
""".strip(),
|
""".strip(),
|
||||||
attributes="",
|
|
||||||
r_attributes="",
|
r_attributes="",
|
||||||
w_attributes="")
|
w_attributes="")
|
||||||
|
|
||||||
|
@ -211,12 +212,12 @@ class SyncFIFOBuffered(Elaboratable, FIFOInterface):
|
||||||
fwft : bool
|
fwft : bool
|
||||||
Always set.
|
Always set.
|
||||||
""".strip(),
|
""".strip(),
|
||||||
attributes="",
|
attributes="""
|
||||||
r_data_valid="Valid if ``r_rdy`` is asserted.",
|
level : Signal(range(depth + 1)), out
|
||||||
r_attributes="""
|
Number of unread entries. This level is the same between read and write for synchronous FIFOs.
|
||||||
level : out
|
|
||||||
Number of unread entries.
|
|
||||||
""".strip(),
|
""".strip(),
|
||||||
|
r_data_valid="Valid if ``r_rdy`` is asserted.",
|
||||||
|
r_attributes="",
|
||||||
w_attributes="")
|
w_attributes="")
|
||||||
|
|
||||||
def __init__(self, *, width, depth):
|
def __init__(self, *, width, depth):
|
||||||
|
@ -282,14 +283,13 @@ class AsyncFIFO(Elaboratable, FIFOInterface):
|
||||||
Read clock domain.
|
Read clock domain.
|
||||||
w_domain : str
|
w_domain : str
|
||||||
Write clock domain.
|
Write clock domain.
|
||||||
""".strip(),
|
|
||||||
attributes="""
|
|
||||||
fwft : bool
|
fwft : bool
|
||||||
Always set.
|
Always set.
|
||||||
""".strip(),
|
""".strip(),
|
||||||
|
attributes="",
|
||||||
r_data_valid="Valid if ``r_rdy`` is asserted.",
|
r_data_valid="Valid if ``r_rdy`` is asserted.",
|
||||||
r_attributes="""
|
r_attributes="""
|
||||||
r_rst : Signal, out
|
r_rst : Signal(1), out
|
||||||
Asserted while the FIFO is being reset by the write-domain reset (for at least one
|
Asserted while the FIFO is being reset by the write-domain reset (for at least one
|
||||||
read-domain clock cycle).
|
read-domain clock cycle).
|
||||||
""".strip(),
|
""".strip(),
|
||||||
|
@ -462,14 +462,13 @@ class AsyncFIFOBuffered(Elaboratable, FIFOInterface):
|
||||||
Read clock domain.
|
Read clock domain.
|
||||||
w_domain : str
|
w_domain : str
|
||||||
Write clock domain.
|
Write clock domain.
|
||||||
""".strip(),
|
|
||||||
attributes="""
|
|
||||||
fwft : bool
|
fwft : bool
|
||||||
Always set.
|
Always set.
|
||||||
""".strip(),
|
""".strip(),
|
||||||
|
attributes="",
|
||||||
r_data_valid="Valid if ``r_rdy`` is asserted.",
|
r_data_valid="Valid if ``r_rdy`` is asserted.",
|
||||||
r_attributes="""
|
r_attributes="""
|
||||||
r_rst : Signal, out
|
r_rst : Signal(1), out
|
||||||
Asserted while the FIFO is being reset by the write-domain reset (for at least one
|
Asserted while the FIFO is being reset by the write-domain reset (for at least one
|
||||||
read-domain clock cycle).
|
read-domain clock cycle).
|
||||||
""".strip(),
|
""".strip(),
|
||||||
|
|
|
@ -10,3 +10,4 @@ Standard library
|
||||||
|
|
||||||
stdlib/coding
|
stdlib/coding
|
||||||
stdlib/cdc
|
stdlib/cdc
|
||||||
|
stdlib/fifo
|
18
docs/stdlib/fifo.rst
Normal file
18
docs/stdlib/fifo.rst
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
First-in first-out queues
|
||||||
|
#########################
|
||||||
|
|
||||||
|
.. py:module:: amaranth.lib.fifo
|
||||||
|
|
||||||
|
The ``amaranth.lib.fifo`` package provides modules for first-in, first-out queues.
|
||||||
|
|
||||||
|
|
||||||
|
.. autoclass:: FIFOInterface
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
The :class:`FIFOInterface` class can be used directly to substitute a FIFO in tests, or inherited from in a custom FIFO implementation.
|
||||||
|
|
||||||
|
.. autoclass:: SyncFIFO(*, width, depth, fwft=True)
|
||||||
|
.. autoclass:: SyncFIFOBuffered(*, width, depth)
|
||||||
|
.. autoclass:: AsyncFIFO(*, width, depth, r_domain="read", w_domain="write", exact_depth=False)
|
||||||
|
.. autoclass:: AsyncFIFOBuffered(*, width, depth, r_domain="read", w_domain="write", exact_depth=False)
|
Loading…
Reference in a new issue