build/generic_toolchain: Make adding keep attribute to clk signals optionals in add_period_constraint/add_false_path_constraint.

Keep it enabled by default.
This commit is contained in:
Florent Kermarrec 2022-11-11 10:05:30 +01:00
parent 1a66f4a6ad
commit 62e869296f
1 changed files with 7 additions and 5 deletions

View File

@ -157,8 +157,9 @@ class GenericToolchain:
return v_output.ns return v_output.ns
def add_period_constraint(self, platform, clk, period): def add_period_constraint(self, platform, clk, period, keep=True):
clk.attr.add("keep") if keep:
clk.attr.add("keep")
period = math.floor(period*1e3)/1e3 # Round to lowest picosecond. period = math.floor(period*1e3)/1e3 # Round to lowest picosecond.
if clk in self.clocks: if clk in self.clocks:
if period != self.clocks[clk]: if period != self.clocks[clk]:
@ -166,8 +167,9 @@ class GenericToolchain:
.format(self.clocks[clk], period)) .format(self.clocks[clk], period))
self.clocks[clk] = period self.clocks[clk] = period
def add_false_path_constraint(self, platform, from_, to): def add_false_path_constraint(self, platform, from_, to, keep=True):
from_.attr.add("keep") if keep:
to.attr.add("keep") from_.attr.add("keep")
to.attr.add("keep")
if (to, from_) not in self.false_paths: if (to, from_) not in self.false_paths:
self.false_paths.add((from_, to)) self.false_paths.add((from_, to))