From 3c6f46717bb58cc2eccd1973c32ce1b90d252440 Mon Sep 17 00:00:00 2001 From: Catherine Date: Wed, 3 Apr 2024 11:50:11 +0000 Subject: [PATCH] lib.wiring: allow reset-less signals in interfaces. This check was originally added out of abundance of caution, but since then it was observed that reset-less-ness is purely an implementation detail (see #1220), and furthermore it interferes with adaptation of `FIFOInterface`` signals (where `[rw]_data` are reset-less) for RFC 61. --- amaranth/lib/wiring.py | 4 ---- docs/changes.rst | 1 + tests/test_lib_wiring.py | 8 ++++---- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/amaranth/lib/wiring.py b/amaranth/lib/wiring.py index 2fcad85..03f8de1 100644 --- a/amaranth/lib/wiring.py +++ b/amaranth/lib/wiring.py @@ -893,10 +893,6 @@ class Signature(metaclass=SignatureMeta): f"the initial value {member.init!r}, but it has " f"the initial value {attr_value_cast.init!r}") return False - if attr_value_cast.reset_less: - if reasons is not None: - reasons.append(f"{_format_path(path)} is expected to not be reset-less") - return False return True if member.is_signature: return member.signature.is_compliant(attr_value, reasons=reasons, path=path) diff --git a/docs/changes.rst b/docs/changes.rst index 0c48234..354df3c 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -107,6 +107,7 @@ Standard library changes * Added: :mod:`amaranth.lib.memory`. (`RFC 45`_) * Added: :class:`amaranth.lib.data.Const` class. (`RFC 51`_) * Changed: :meth:`amaranth.lib.data.Layout.const` returns a :class:`amaranth.lib.data.Const`, not a view (`RFC 51`_) +* Changed: :meth:`amaranth.lib.wiring.Signature.is_compliant` no longer rejects reset-less signals. * Added: :class:`amaranth.lib.io.SingleEndedPort`, :class:`amaranth.lib.io.DifferentialPort`. (`RFC 55`_) * Added: :class:`amaranth.lib.io.Buffer`, :class:`amaranth.lib.io.FFBuffer`, :class:`amaranth.lib.io.DDRBuffer`. (`RFC 55`_) * Removed: (deprecated in 0.4) :mod:`amaranth.lib.scheduler`. (`RFC 19`_) diff --git a/tests/test_lib_wiring.py b/tests/test_lib_wiring.py index b1471c0..4602f27 100644 --- a/tests/test_lib_wiring.py +++ b/tests/test_lib_wiring.py @@ -453,10 +453,10 @@ class SignatureTestCase(unittest.TestCase): r"^'obj\.a' is expected to have the initial value 1, but it has the initial value 0$", sig=Signature({"a": In(1, init=1)}), obj=NS(a=Signal(1))) - self.assertNotCompliant( - r"^'obj\.a' is expected to not be reset-less$", - sig=Signature({"a": In(1)}), - obj=NS(a=Signal(1, reset_less=True))) + self.assertTrue( + Signature({"a": In(1)}).is_compliant( + NS(signature=Signature({"a": In(1)}), + a=Signal(1, reset_less=True)))) self.assertNotCompliant( r"^'obj\.a' does not have an attribute 'b'$", sig=Signature({"a": Out(Signature({"b": In(1)}))}),