vivado: permit resources without pins

This is required if the LOC is done by another, external constraints set,
as in the case of the Zynq Processing System Instance.
This commit is contained in:
Robert Jordens 2015-03-06 14:56:27 -07:00 committed by Florent Kermarrec
parent e60a97534b
commit 3e84c66ba9
1 changed files with 8 additions and 4 deletions

View File

@ -19,9 +19,11 @@ def _format_constraint(c):
return "set_property DRIVE " + str(c.strength) return "set_property DRIVE " + str(c.strength)
elif isinstance(c, Misc): elif isinstance(c, Misc):
return "set_property " + c.misc.replace("=", " ") return "set_property " + c.misc.replace("=", " ")
else:
raise ValueError("unknown constraint %s" % c)
def _format_xdc(signame, pin, others, resname): def _format_xdc(signame, resname, *constraints):
fmt_c = [_format_constraint(c) for c in ([Pins(pin)] + others)] fmt_c = [_format_constraint(c) for c in constraints]
fmt_r = resname[0] + ":" + str(resname[1]) fmt_r = resname[0] + ":" + str(resname[1])
if resname[2] is not None: if resname[2] is not None:
fmt_r += "." + resname[2] fmt_r += "." + resname[2]
@ -35,9 +37,11 @@ def _build_xdc(named_sc, named_pc):
for sig, pins, others, resname in named_sc: for sig, pins, others, resname in named_sc:
if len(pins) > 1: if len(pins) > 1:
for i, p in enumerate(pins): for i, p in enumerate(pins):
r += _format_xdc(sig + "[" + str(i) + "]", p, others, resname) r += _format_xdc(sig + "[" + str(i) + "]", resname, Pins(p), *others)
elif pins:
r += _format_xdc(sig, resname, Pins(pins[0]), *others)
else: else:
r += _format_xdc(sig, pins[0], others, resname) r += _format_xdc(sig, resname, *others)
if named_pc: if named_pc:
r += "\n" + "\n\n".join(named_pc) r += "\n" + "\n\n".join(named_pc)
return r return r