Skip to content

Signal.like is not fully functional with ShapeCastable-based signals #1285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wanda-phi opened this issue Apr 5, 2024 · 0 comments · Fixed by #1313
Closed

Signal.like is not fully functional with ShapeCastable-based signals #1285

wanda-phi opened this issue Apr 5, 2024 · 0 comments · Fixed by #1313
Labels
Milestone

Comments

@wanda-phi
Copy link
Member

The name_suffix functionality is broken. The init, reset_less, attrs, and decoder properties of the original signal are not preserved.

>>> from amaranth.lib import data
>>> from amaranth.hdl import *
>>> l = data.StructLayout({"a": 8, "b": 4})
>>> s = Signal(l, init={"a": 1, "b": 2}, reset_less=True, attrs={"x": 123})
>>> s2 = Signal.like(s, name_suffix="a")
[...]
AttributeError: View with layout StructLayout({'a': 8, 'b': 4}) does not have a field 'name'; did you mean one of: 'a', 'b'?
>>> s2 = Signal.like(s)
>>> s.as_value().init
513
>>> s2.as_value().init
0
>>> s.as_value().reset_less
True
>>> s2.as_value().reset_less
False
>>> s.as_value().attrs
OrderedDict([('x', 123)])
>>> s2.as_value().attrs
OrderedDict()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

2 participants