From fb0c9e846d72fc4fe99ca329cc84a8d2537d3d8d Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Wed, 17 May 2023 16:45:45 +0200 Subject: [PATCH] build/add_period_constraint: Simplify by using new integrated cases in generic add_period_constraint. --- litex/build/altera/platform.py | 3 --- litex/build/anlogic/anlogic.py | 9 --------- litex/build/anlogic/platform.py | 1 - litex/build/efinix/platform.py | 3 --- litex/build/gowin/platform.py | 1 - litex/build/lattice/platform.py | 3 --- litex/build/microsemi/platform.py | 4 ---- litex/build/osfpga/platform.py | 1 - litex/build/xilinx/platform.py | 3 --- 9 files changed, 28 deletions(-) diff --git a/litex/build/altera/platform.py b/litex/build/altera/platform.py index ca690dd77..59f1078ff 100644 --- a/litex/build/altera/platform.py +++ b/litex/build/altera/platform.py @@ -45,9 +45,6 @@ class AlteraPlatform(GenericPlatform): return self.toolchain.build(self, *args, **kwargs) def add_period_constraint(self, clk, period): - if clk is None: return - if hasattr(clk, "p"): - clk = clk.p self.toolchain.add_period_constraint(self, clk, period, keep=False) def add_false_path_constraint(self, from_, to): diff --git a/litex/build/anlogic/anlogic.py b/litex/build/anlogic/anlogic.py index bb239d2d2..838f0bf9c 100644 --- a/litex/build/anlogic/anlogic.py +++ b/litex/build/anlogic/anlogic.py @@ -204,12 +204,3 @@ class TangDinastyToolchain(GenericToolchain): (architecture, family, package) = devices[device] return (architecture, family, package) - - def add_period_constraint(self, platform, clk, period): - clk.attr.add("keep") - 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 diff --git a/litex/build/anlogic/platform.py b/litex/build/anlogic/platform.py index 627882467..9979223df 100644 --- a/litex/build/anlogic/platform.py +++ b/litex/build/anlogic/platform.py @@ -36,5 +36,4 @@ class AnlogicPlatform(GenericPlatform): return self.toolchain.build(self, *args, **kwargs) def add_period_constraint(self, clk, period): - if clk is None: return self.toolchain.add_period_constraint(self, clk, period) diff --git a/litex/build/efinix/platform.py b/litex/build/efinix/platform.py index 14ec97d43..2ca80593a 100644 --- a/litex/build/efinix/platform.py +++ b/litex/build/efinix/platform.py @@ -63,9 +63,6 @@ class EfinixPlatform(GenericPlatform): return self.toolchain.build(self, *args, **kwargs) def add_period_constraint(self, clk, period): - if clk is None: return - if hasattr(clk, "p"): - clk = clk.p self.toolchain.add_period_constraint(self, clk, period) def add_false_path_constraint(self, from_, to): diff --git a/litex/build/gowin/platform.py b/litex/build/gowin/platform.py index b37e8d155..30c86bd6e 100644 --- a/litex/build/gowin/platform.py +++ b/litex/build/gowin/platform.py @@ -43,5 +43,4 @@ class GowinPlatform(GenericPlatform): return self.toolchain.build(self, *args, **kwargs) def add_period_constraint(self, clk, period): - if clk is None: return self.toolchain.add_period_constraint(self, clk, period) diff --git a/litex/build/lattice/platform.py b/litex/build/lattice/platform.py index 029ca578c..2aaa4e77b 100644 --- a/litex/build/lattice/platform.py +++ b/litex/build/lattice/platform.py @@ -48,9 +48,6 @@ class LatticePlatform(GenericPlatform): return self.toolchain.build(self, *args, **kwargs) def add_period_constraint(self, clk, period): - if clk is None: return - if hasattr(clk, "p"): - clk = clk.p self.toolchain.add_period_constraint(self, clk, period) def add_false_path_constraint(self, from_, to): diff --git a/litex/build/microsemi/platform.py b/litex/build/microsemi/platform.py index ace9bfe4a..a324a776b 100644 --- a/litex/build/microsemi/platform.py +++ b/litex/build/microsemi/platform.py @@ -34,10 +34,6 @@ class MicrosemiPlatform(GenericPlatform): return self.toolchain.build(self, *args, **kwargs) def add_period_constraint(self, clk, period): - if clk is None: return - clk.attr.add("keep") - if hasattr(clk, "p"): - clk = clk.p self.toolchain.add_period_constraint(self, clk, period) def add_false_path_constraint(self, from_, to): diff --git a/litex/build/osfpga/platform.py b/litex/build/osfpga/platform.py index b01516629..d3e822908 100644 --- a/litex/build/osfpga/platform.py +++ b/litex/build/osfpga/platform.py @@ -36,7 +36,6 @@ class OSFPGAPlatform(GenericPlatform): return self.toolchain.build(self, *args, **kwargs) def add_period_constraint(self, clk, period): - if clk is None: return self.toolchain.add_period_constraint(self, clk, period) def add_false_path_constraint(self, from_, to): diff --git a/litex/build/xilinx/platform.py b/litex/build/xilinx/platform.py index fd75dae1d..806516038 100644 --- a/litex/build/xilinx/platform.py +++ b/litex/build/xilinx/platform.py @@ -85,9 +85,6 @@ class XilinxPlatform(GenericPlatform): return self.toolchain.build(self, *args, **kwargs) def add_period_constraint(self, clk, period, keep=True): - if clk is None: return - if hasattr(clk, "p"): - clk = clk.p self.toolchain.add_period_constraint(self, clk, period, keep=keep) def add_false_path_constraint(self, from_, to):