From 62e869296f14fcae9e27f9b3edf7b5c05fe82af1 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Fri, 11 Nov 2022 10:05:30 +0100 Subject: [PATCH] build/generic_toolchain: Make adding keep attribute to clk signals optionals in add_period_constraint/add_false_path_constraint. Keep it enabled by default. --- litex/build/generic_toolchain.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/litex/build/generic_toolchain.py b/litex/build/generic_toolchain.py index f7b832ad8..8dae9d865 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]: @@ -166,8 +167,9 @@ class GenericToolchain: .format(self.clocks[clk], period)) self.clocks[clk] = period - def add_false_path_constraint(self, platform, from_, to): - from_.attr.add("keep") - to.attr.add("keep") + def add_false_path_constraint(self, platform, from_, to, keep=True): + if keep: + from_.attr.add("keep") + to.attr.add("keep") if (to, from_) not in self.false_paths: self.false_paths.add((from_, to))