mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
Add support for custom attributes on Signals
This commit is contained in:
parent
044760e06c
commit
b49eb433c8
2 changed files with 18 additions and 1 deletions
|
@ -182,3 +182,20 @@ class GenericToolchain:
|
||||||
to.attr.add("keep")
|
to.attr.add("keep")
|
||||||
if (to, from_) not in self.false_paths:
|
if (to, from_) not in self.false_paths:
|
||||||
self.false_paths.add((from_, to))
|
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
|
||||||
|
|
|
@ -87,7 +87,7 @@ class XilinxPlatform(GenericPlatform):
|
||||||
so.update(special_overrides)
|
so.update(special_overrides)
|
||||||
return GenericPlatform.get_verilog(self, *args,
|
return GenericPlatform.get_verilog(self, *args,
|
||||||
special_overrides = so,
|
special_overrides = so,
|
||||||
attr_translate = self.toolchain.attr_translate,
|
attr_translate = self.toolchain.custom_attributes(),
|
||||||
**kwargs
|
**kwargs
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue