Deprecate the use of Signal.attrs
mapping to specify platform-specific attributes
#1498
Labels
Signal.attrs
mapping to specify platform-specific attributes
#1498
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/afterelaborate
. However, the current design ofattrs
makes this impossible: anything that goes inside is by necessity platform-specific, and so it must be mutated withinelaborate
.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:
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.
The text was updated successfully, but these errors were encountered: