From 4c978bf463f171b199a16ea51de59c46822e424d Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Fri, 24 Jun 2022 10:24:01 +0200 Subject: [PATCH] build/generic_toolchain: Add add_false_path_constraint and remove it from altera/quartus, lattice/trellis. --- litex/build/altera/quartus.py | 6 ------ litex/build/generic_toolchain.py | 9 ++++++++- litex/build/lattice/trellis.py | 6 ------ 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/litex/build/altera/quartus.py b/litex/build/altera/quartus.py index 5b4f16bda..3b143045f 100644 --- a/litex/build/altera/quartus.py +++ b/litex/build/altera/quartus.py @@ -213,9 +213,3 @@ fi if subprocess.call(shell + [script]) != 0: raise OSError("Error occured during Quartus's script execution.") - - def add_false_path_constraint(self, platform, from_, to): - from_.attr.add("keep") - to.attr.add("keep") - if (to, from_) not in self.false_paths: - self.false_paths.add((from_, to)) diff --git a/litex/build/generic_toolchain.py b/litex/build/generic_toolchain.py index 847035a5e..ad3426baa 100644 --- a/litex/build/generic_toolchain.py +++ b/litex/build/generic_toolchain.py @@ -6,6 +6,7 @@ # SPDX-License-Identifier: BSD-2-Clause import os +import math from migen.fhdl.structure import _Fragment @@ -95,4 +96,10 @@ class GenericToolchain: 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 \ No newline at end of file + self.clocks[clk] = period + + def add_false_path_constraint(self, platform, from_, to): + from_.attr.add("keep") + to.attr.add("keep") + if (to, from_) not in self.false_paths: + self.false_paths.add((from_, to)) diff --git a/litex/build/lattice/trellis.py b/litex/build/lattice/trellis.py index 03334b1b7..6f40742d1 100644 --- a/litex/build/lattice/trellis.py +++ b/litex/build/lattice/trellis.py @@ -220,12 +220,6 @@ class LatticeTrellisToolchain(GenericToolchain): platform.add_platform_command("""FREQUENCY PORT "{clk}" {freq} MHz;""".format( freq=str(float(1/period)*1000), clk="{clk}"), clk=clk) - def add_false_path_constraint(self, platform, from_, to): - from_.attr.add("keep") - to.attr.add("keep") - if (to, from_) not in self.false_paths: - self.false_paths.add((from_, to)) - def trellis_args(parser): toolchain_group = parser.add_argument_group(title="Toolchain options") toolchain_group.add_argument("--yosys-nowidelut", action="store_true", help="Use Yosys's nowidelut mode.")