From b107d4a6fed9d0a7a77a857f31c8f1e0e6ec15c8 Mon Sep 17 00:00:00 2001 From: Vamsi Vytla Date: Thu, 3 Nov 2022 21:26:28 -0700 Subject: [PATCH] Make keep attribute for add_period_constraint optional. Vivado 2019 barfs upon IDELAYCTRL automatically replicated and it's refclk set to dont_touch. --- litex/build/generic_toolchain.py | 5 +++-- litex/build/xilinx/platform.py | 4 ++-- litex/build/xilinx/vivado.py | 1 - 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/litex/build/generic_toolchain.py b/litex/build/generic_toolchain.py index f7b832ad8..987268744 100644 --- a/litex/build/generic_toolchain.py +++ b/litex/build/generic_toolchain.py @@ -157,8 +157,9 @@ class GenericToolchain: return v_output.ns - def add_period_constraint(self, platform, clk, period): - clk.attr.add("keep") + def add_period_constraint(self, platform, clk, period, keep=True): + if keep: + clk.attr.add("keep") period = math.floor(period*1e3)/1e3 # Round to lowest picosecond. if clk in self.clocks: if period != self.clocks[clk]: diff --git a/litex/build/xilinx/platform.py b/litex/build/xilinx/platform.py index 14f6092bb..b3bfb1029 100644 --- a/litex/build/xilinx/platform.py +++ b/litex/build/xilinx/platform.py @@ -72,11 +72,11 @@ class XilinxPlatform(GenericPlatform): def build(self, *args, **kwargs): return self.toolchain.build(self, *args, **kwargs) - def add_period_constraint(self, clk, period): + def add_period_constraint(self, clk, period, keep=True): if clk is None: return if hasattr(clk, "p"): clk = clk.p - self.toolchain.add_period_constraint(self, clk, period) + self.toolchain.add_period_constraint(self, clk, period, keep=keep) def add_false_path_constraint(self, from_, to): if hasattr(from_, "p"): diff --git a/litex/build/xilinx/vivado.py b/litex/build/xilinx/vivado.py index 8535d2948..21400e7b4 100644 --- a/litex/build/xilinx/vivado.py +++ b/litex/build/xilinx/vivado.py @@ -384,7 +384,6 @@ class XilinxVivadoToolchain(GenericToolchain): if tools.subprocess_call_filtered(shell + [script], common.colors) != 0: raise OSError("Error occured during Vivado's script execution.") - def vivado_build_args(parser): toolchain_group = parser.add_argument_group(title="Toolchain options") toolchain_group.add_argument("--synth-mode", default="vivado", help="Synthesis mode (vivado or yosys).")