From befe6b4967a161cbee0bd17a185f56bc9a0da1fd Mon Sep 17 00:00:00 2001 From: whitequark Date: Sat, 26 Jan 2019 18:24:12 +0000 Subject: [PATCH] compat.genlib.resetsync: add shim for AsyncResetSynchronizer. --- doc/COMPAT_SUMMARY.md | 4 ++-- nmigen/compat/genlib/resetsync.py | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 nmigen/compat/genlib/resetsync.py diff --git a/doc/COMPAT_SUMMARY.md b/doc/COMPAT_SUMMARY.md index 0b2eb4a..8b1ed53 100644 --- a/doc/COMPAT_SUMMARY.md +++ b/doc/COMPAT_SUMMARY.md @@ -173,8 +173,8 @@ Compatibility summary - (−) `layout_get` **brk** - (−) `layout_partial` **brk** - (−) `Record` id - - (−) `resetsync` ? - - (−) `AsyncResetSynchronizer` ? + - (+) `resetsync` ? + - (+) `AsyncResetSynchronizer` **obs** → `.lib.cdc.ResetSynchronizer` - (−) `roundrobin` ? - (−) `SP_WITHDRAW`/`SP_CE` ? - (−) `RoundRobin` ? diff --git a/nmigen/compat/genlib/resetsync.py b/nmigen/compat/genlib/resetsync.py new file mode 100644 index 0000000..218dc8a --- /dev/null +++ b/nmigen/compat/genlib/resetsync.py @@ -0,0 +1,16 @@ +from ...tools import deprecated +from ...lib.cdc import ResetSynchronizer as NativeResetSynchronizer + + +__all__ = ["AsyncResetSynchronizer"] + + +@deprecated("instead of `migen.genlib.resetsync.AsyncResetSynchronizer`, " + "use `nmigen.lib.cdc.ResetSynchronizer`; note that ResetSynchronizer accepts " + "a clock domain name as an argument, not a clock domain object") +class CompatResetSynchronizer(NativeResetSynchronizer): + def __init__(self, cd, async_reset): + super().__init__(async_reset, cd.name) + + +AsyncResetSynchronizer = CompatResetSynchronizer -- 2.30.2