Description
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.
Activity
whitequark commentedon Aug 28, 2024
Oh, I forgot that #1466 already exists, my bad.