build/xilinx/vivado: update add_period_constraint behavior when clock is already constrainted.

This commit is contained in:
Florent Kermarrec 2019-12-31 10:32:09 +01:00
parent fe4eaf5860
commit 3022f02b3f
1 changed files with 4 additions and 2 deletions

View File

@ -311,9 +311,11 @@ class XilinxVivadoToolchain:
def add_period_constraint(self, platform, clk, period): def add_period_constraint(self, platform, clk, period):
clk.attr.add("keep") clk.attr.add("keep")
if clk in self.clocks:
raise ValueError("A period constraint already exists")
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 period != self.clocks[clk]:
raise ValueError("Clock already constrained to {:.2f}ns, new constraint to {:.2f}ns"
.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):