Add support for custom attributes on Signals

This commit is contained in:
Vadzim Dambrouski 2024-03-04 20:51:51 +01:00
parent 044760e06c
commit b49eb433c8
2 changed files with 18 additions and 1 deletions

View File

@ -182,3 +182,20 @@ class GenericToolchain:
to.attr.add("keep")
if (to, from_) not in self.false_paths:
self.false_paths.add((from_, to))
def custom_attributes(self):
return CustomAttributes(self.attr_translate)
class CustomAttributes:
def __init__(self, attributes):
self.attributes = attributes
def get(self, k, v=None):
if k in self.attributes:
return self.attributes[k]
elif "=" in k:
parts = k.split("=", 1)
return parts[0].strip(), parts[1].strip()
elif v is not None:
return k, v
return None

View File

@ -87,7 +87,7 @@ class XilinxPlatform(GenericPlatform):
so.update(special_overrides)
return GenericPlatform.get_verilog(self, *args,
special_overrides = so,
attr_translate = self.toolchain.attr_translate,
attr_translate = self.toolchain.custom_attributes(),
**kwargs
)