build/xilinx/vivado: update add_period_constraint behavior when clock is already...
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Tue, 31 Dec 2019 09:32:09 +0000 (10:32 +0100)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Tue, 31 Dec 2019 09:32:09 +0000 (10:32 +0100)
litex/build/xilinx/vivado.py

index 01e1aca58985b2585c9c14b603c5f34625eb56ea..ef722d4d69c98b1da6ba9ec42148ddeb237c8416 100644 (file)
@@ -311,9 +311,11 @@ class XilinxVivadoToolchain:
 
     def add_period_constraint(self, platform, clk, period):
         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
+        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
 
     def add_false_path_constraint(self, platform, from_, to):