diff --git a/litex/build/generic_toolchain.py b/litex/build/generic_toolchain.py index 488b92178..a584220a4 100644 --- a/litex/build/generic_toolchain.py +++ b/litex/build/generic_toolchain.py @@ -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 diff --git a/litex/build/xilinx/platform.py b/litex/build/xilinx/platform.py index 6c20f0c49..72a83c061 100644 --- a/litex/build/xilinx/platform.py +++ b/litex/build/xilinx/platform.py @@ -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 )