Skip to content
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

Deprecate the use of Signal.attrs mapping to specify platform-specific attributes #1498

Closed
whitequark opened this issue Aug 28, 2024 · 1 comment

Comments

@whitequark
Copy link
Member

whitequark commented Aug 28, 2024

Amaranth has a goal of not performing any platform-specific decisions until the moment when elaborate is called, and keeping the object tree intact (not mutated) during/after elaborate. However, the current design of attrs makes this impossible: anything that goes inside is by necessity platform-specific, and so it must be mutated within elaborate.

Amaranth's platform code is one of the worst offenders here, since add_clock_constraint usually adds a (platform-specific!) keep attribute to the clock.

Instead, I propose that attributes are added to signals using an API like:

platform.add_attribute(sig, "keep")
platform.add_attribute(sig, "dont_touch", "TRUE")

This way, the platform-specific attributes are kept inside the platform, and applied late in the compilation pipeline (during NIR generation or NIR to RTLIL/Verilog conversion, probably).

This also opens the opportunity to make signals almost entirely immutable, finishing the work started in #1067.

@whitequark
Copy link
Member Author

Oh, I forgot that #1466 already exists, my bad.

@whitequark whitequark closed this as not planned Won't fix, can't repro, duplicate, stale Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant