From: Florent Kermarrec Date: Tue, 17 Mar 2015 13:59:05 +0000 (+0100) Subject: fhdl/special: add optional synthesis directive (needed by Synplify Pro) X-Git-Tag: 24jan2021_ls180~2099^2~171 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b7d7fe1a4c759dd906d7e1d621149a4e87ed8d3c;p=litex.git fhdl/special: add optional synthesis directive (needed by Synplify Pro) --- diff --git a/migen/fhdl/specials.py b/migen/fhdl/specials.py index ca0df99f..78098dd1 100644 --- a/migen/fhdl/specials.py +++ b/migen/fhdl/specials.py @@ -89,7 +89,7 @@ class Instance(Special): class PreformattedParam(str): pass - def __init__(self, of, *items, name="", **kwargs): + def __init__(self, of, *items, name="", synthesis_directive=None, **kwargs): Special.__init__(self) self.of = of if name: @@ -97,6 +97,7 @@ class Instance(Special): else: self.name_override = of self.items = list(items) + self.synthesis_directive = synthesis_directive for k, v in sorted(kwargs.items(), key=itemgetter(0)): item_type, item_name = k.split("_", maxsplit=1) item_class = { @@ -159,7 +160,11 @@ class Instance(Special): r += "\t." + name_inst + "(" + name_design + ")" if not firstp: r += "\n" - r += ");\n\n" + if instance.synthesis_directive is not None: + synthesis_directive = "/* synthesis {} */".format(instance.synthesis_directive) + r += ")" + synthesis_directive + ";\n\n" + else: + r += ");\n\n" return r (READ_FIRST, WRITE_FIRST, NO_CHANGE) = range(3)