lib.cdc: expand ResetSynchronizer documentation.

Loosely based on work by @Wren6991.
This commit is contained in:
whitequark 2019-09-23 19:31:23 +00:00
parent 86f0f12b58
commit 52e761dc33

View file

@ -15,9 +15,9 @@ class FFSynchronizer(Elaboratable):
Parameters Parameters
---------- ----------
i : Signal, in i : Signal(n), in
Signal to be resynchronised. Signal to be resynchronised.
o : Signal, out o : Signal(n), out
Signal connected to synchroniser output. Signal connected to synchroniser output.
o_domain : str o_domain : str
Name of output clock domain. Name of output clock domain.
@ -33,8 +33,8 @@ class FFSynchronizer(Elaboratable):
Platform override Platform override
----------------- -----------------
Define the ``get_ff_sync`` platform method to override the implementation of :class:`FFSynchronizer`, Define the ``get_ff_sync`` platform method to override the implementation of
e.g. to instantiate library cells directly. :class:`FFSynchronizer`, e.g. to instantiate library cells directly.
Note on Reset Note on Reset
------------- -------------
@ -81,6 +81,32 @@ MultiReg = deprecated("instead of `MultiReg`, use `FFSynchronizer`")(FFSynchroni
class ResetSynchronizer(Elaboratable): class ResetSynchronizer(Elaboratable):
"""Synchronize deassertion of a clock domain reset.
The reset of the clock domain driven by the :class:`ResetSynchronizer` is asserted
asynchronously and deasserted synchronously, eliminating metastability during deassertion.
The driven clock domain could use a reset that is asserted either synchronously or
asynchronously; a reset is always deasserted synchronously. A domain with an asynchronously
asserted reset is useful if the clock of the domain may be gated, yet the domain still
needs to be reset promptly; otherwise, synchronously asserted reset (the default) should
be used.
Parameters
----------
arst : Signal(1), out
Asynchronous reset signal, to be synchronized.
domain : str
Name of clock domain to reset.
stages : int, >=2
Number of synchronization stages between input and output. The lowest safe number is 2,
with higher numbers reducing MTBF further, at the cost of increased deassertion latency.
Platform override
-----------------
Define the ``get_reset_sync`` platform method to override the implementation of
:class:`ResetSynchronizer`, e.g. to instantiate library cells directly.
"""
def __init__(self, arst, *, domain="sync", stages=2): def __init__(self, arst, *, domain="sync", stages=2):
self.arst = arst self.arst = arst