From: Tim 'mithro' Ansell Date: Mon, 30 Dec 2019 18:25:14 +0000 (+0100) Subject: Allow specifying the same clock constraint multiple times. X-Git-Tag: 24jan2021_ls180~787 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f0b5c6721627947025527d9ed9c9304cc291c530;p=litex.git Allow specifying the same clock constraint multiple times. (As long as the clock values actually match.) --- diff --git a/litex/build/lattice/icestorm.py b/litex/build/lattice/icestorm.py index b999e483..c7857408 100644 --- a/litex/build/lattice/icestorm.py +++ b/litex/build/lattice/icestorm.py @@ -193,7 +193,12 @@ class LatticeIceStormToolchain: return v_output.ns def add_period_constraint(self, platform, clk, period): + clk_ns = 1e3/period clk.attr.add("keep") if clk in self.clocks: - raise ValueError("A period constraint already exists") - self.clocks[clk] = 1e3/period + if clk_ns != self.clocks[clk]: + raise ValueError( + "A period constraint already exists" + "(wanted: {:.2f}ns, got {:.2f}ns)".format( + clk_ns, self.clocks[clk])) + self.clocks[clk] = clk_ns