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))