Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build diamond addition #2097

Merged
merged 4 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions litex/build/lattice/diamond.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class LatticeDiamondToolchain(GenericToolchain):

def __init__(self):
super().__init__()
self.additional_ldf_commands = []

def build(self, platform, fragment,
timingstrict = False,
Expand Down Expand Up @@ -116,9 +117,20 @@ def tcl_path(path): return path.replace("\\", "/")
for filename, language, library, *copy in self.platform.sources:
tcl.append("prj_src add \"{}\" -work {}".format(tcl_path(filename), library))

# Add IPs
for filename in self.platform.ips:
tcl.append("prj_src add \"{}\" -work {}".format(tcl_path(filename), library))

# Add Strategy
for filename, strategy_name in self.platform.strategy:
tcl.append("prj_strgy import -name {} -file {}".format(strategy_name, tcl_path(filename)))

# Set top level
tcl.append("prj_impl option top \"{}\"".format(self._build_name))

# Add additional commands
tcl += self.additional_ldf_commands

# Save project
tcl.append("prj_project save")

Expand Down
10 changes: 10 additions & 0 deletions litex/build/lattice/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
# Copyright (c) 2017 William D. Jones <[email protected]>
# SPDX-License-Identifier: BSD-2-Clause

import os

from litex.build.generic_platform import GenericPlatform
from litex.build.lattice import common, diamond, icestorm, trellis, radiant, oxide

Expand All @@ -21,6 +23,8 @@ class LatticePlatform(GenericPlatform):

def __init__(self, *args, toolchain="diamond", **kwargs):
GenericPlatform.__init__(self, *args, **kwargs)
self.ips = set()
self.strategy = set()
if toolchain == "diamond":
self.toolchain = diamond.LatticeDiamondToolchain()
elif toolchain == "trellis":
Expand All @@ -35,6 +39,12 @@ def __init__(self, *args, toolchain="diamond", **kwargs):
else:
raise ValueError(f"Unknown toolchain {toolchain}")

def add_ip(self, filename):
self.ips.add((os.path.abspath(filename)))

def add_strategy(self, filename, strategy_name):
self.strategy.add((os.path.abspath(filename), strategy_name))

def get_verilog(self, *args, special_overrides=dict(), **kwargs):
so = dict() # No common overrides between ECP5 and iCE40.
so.update(self.toolchain.special_overrides)
Expand Down
2 changes: 1 addition & 1 deletion litex/soc/cores/jtag.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ def __init__(self, tck_delay_luts=8):
new_tck = Signal()
self.specials += Instance("LUT4",
attr = {"keep"},
p_INIT = 2,
p_init = 2,
i_A = tck,
i_B = 0,
i_C = 0,
Expand Down
Loading