build/xilinx/vivado: Allow passing str to add_false_path_constraint to allow mising Signals and str and simplify design constraints.

This commit is contained in:
Florent Kermarrec 2024-12-02 17:28:38 +01:00
parent 4e775a7bd6
commit ec06bf5955
1 changed files with 22 additions and 9 deletions

View File

@ -217,13 +217,26 @@ class XilinxVivadoToolchain(GenericToolchain):
False: "nets",
True: "ports",
}[hasattr(clk, "port")]
for _from, _to in sorted(self.false_paths, key=lambda x: (x[0].duid, x[1].duid)):
for _from, _to in sorted(self.false_paths, key=lambda x: (str(x[0]), str(x[1]))):
if isinstance(_from, str):
_from_cmd = f"[get_clocks {_from}]"
else:
_from_cmd = f"[get_clocks -include_generated_clocks -of [get_{get_clk_type(_from)} {{_from}}]]"
if isinstance(_to, str):
_to_cmd = f"[get_clocks {_to}]"
else:
_to_cmd = f"[get_clocks -include_generated_clocks -of [get_{get_clk_type(_to)} {{_to}}]]"
self.platform.add_platform_command(
"set_clock_groups "
"-group [get_clocks -include_generated_clocks -of [get_" + get_clk_type(_from) + " {_from}]] "
"-group [get_clocks -include_generated_clocks -of [get_" + get_clk_type(_to) + " {_to}]] "
f"-group {_from_cmd} "
f"-group {_to_cmd} "
"-asynchronous",
_from=_from, _to=_to)
_from = _from if not isinstance(_from, str) else None,
_to = _to if not isinstance(_to, str) else None,
)
# Clear false path constraints after generation.
self.false_paths.clear()