fhdl/special: add optional synthesis directive (needed by Synplify Pro)

This commit is contained in:
Florent Kermarrec 2015-03-17 14:59:05 +01:00
parent 022ac26c22
commit b7d7fe1a4c
1 changed files with 7 additions and 2 deletions

View File

@ -89,7 +89,7 @@ class Instance(Special):
class PreformattedParam(str): class PreformattedParam(str):
pass pass
def __init__(self, of, *items, name="", **kwargs): def __init__(self, of, *items, name="", synthesis_directive=None, **kwargs):
Special.__init__(self) Special.__init__(self)
self.of = of self.of = of
if name: if name:
@ -97,6 +97,7 @@ class Instance(Special):
else: else:
self.name_override = of self.name_override = of
self.items = list(items) self.items = list(items)
self.synthesis_directive = synthesis_directive
for k, v in sorted(kwargs.items(), key=itemgetter(0)): for k, v in sorted(kwargs.items(), key=itemgetter(0)):
item_type, item_name = k.split("_", maxsplit=1) item_type, item_name = k.split("_", maxsplit=1)
item_class = { item_class = {
@ -159,7 +160,11 @@ class Instance(Special):
r += "\t." + name_inst + "(" + name_design + ")" r += "\t." + name_inst + "(" + name_design + ")"
if not firstp: if not firstp:
r += "\n" 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 return r
(READ_FIRST, WRITE_FIRST, NO_CHANGE) = range(3) (READ_FIRST, WRITE_FIRST, NO_CHANGE) = range(3)