Skip to content

Commit

Permalink
Merge pull request #2113 from trabucayre/toolchain_diamond_sdc
Browse files Browse the repository at this point in the history
litex/build/lattice/diamond, platform: allows users to add custom sdc files
  • Loading branch information
enjoy-digital authored Nov 4, 2024
2 parents 175e63a + 47e8b02 commit 3f3249c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions litex/build/lattice/diamond.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ def tcl_path(path): return path.replace("\\", "/")
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)))
Expand Down
4 changes: 4 additions & 0 deletions litex/build/lattice/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -42,6 +43,9 @@ def __init__(self, *args, toolchain="diamond", **kwargs):
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))

Expand Down

0 comments on commit 3f3249c

Please sign in to comment.