From 47e8b0273f1d0f2681a52d3478d6fc0b4ffb3938 Mon Sep 17 00:00:00 2001 From: Gwenhael Goavec-Merou Date: Mon, 4 Nov 2024 12:42:38 +0100 Subject: [PATCH] litex/build/lattice/diamond, platform: allows users to add custom sdc files --- litex/build/lattice/diamond.py | 4 ++++ litex/build/lattice/platform.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/litex/build/lattice/diamond.py b/litex/build/lattice/diamond.py index 877e96ffe..7bc113fc4 100644 --- a/litex/build/lattice/diamond.py +++ b/litex/build/lattice/diamond.py @@ -121,6 +121,10 @@ class LatticeDiamondToolchain(GenericToolchain): for filename in self.platform.ips: tcl.append("prj_src add \"{}\" -work {}".format(tcl_path(filename), library)) + # Add SDCs + for filename in self.platform.sdcs: + tcl.append("prj_src add \"{}\" -format SDC".format(tcl_path(filename))) + # Add Strategy for filename, strategy_name in self.platform.strategy: tcl.append("prj_strgy import -name {} -file {}".format(strategy_name, tcl_path(filename))) diff --git a/litex/build/lattice/platform.py b/litex/build/lattice/platform.py index 621a1b39f..91f8f7327 100644 --- a/litex/build/lattice/platform.py +++ b/litex/build/lattice/platform.py @@ -24,6 +24,7 @@ class LatticePlatform(GenericPlatform): def __init__(self, *args, toolchain="diamond", **kwargs): GenericPlatform.__init__(self, *args, **kwargs) self.ips = set() + self.sdcs = set() self.strategy = set() if toolchain == "diamond": self.toolchain = diamond.LatticeDiamondToolchain() @@ -42,6 +43,9 @@ class LatticePlatform(GenericPlatform): def add_ip(self, filename): self.ips.add((os.path.abspath(filename))) + def add_sdc(self, filename): + self.sdcs.add((os.path.abspath(filename))) + def add_strategy(self, filename, strategy_name): self.strategy.add((os.path.abspath(filename), strategy_name))