Skip to content

Commit

Permalink
build/lattice/radiant: allows extra configuration (prj_set_strategy_v…
Browse files Browse the repository at this point in the history
…alue XX=YY) to be added at script creation time
  • Loading branch information
trabucayre committed Jun 19, 2024
1 parent d6b0c84 commit d985458
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions litex/build/lattice/radiant.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,10 @@ class LatticeRadiantToolchain(GenericToolchain):
def __init__(self):
super().__init__()

self._timingstrict = False
self._synth_mode = "radiant"
self._yosys = None
self._timingstrict = False
self._synth_mode = "radiant"
self._yosys = None
self._prj_strategy_opts = {}

def build(self, platform, fragment,
timingstrict = False,
Expand Down Expand Up @@ -176,6 +177,10 @@ def tcl_path(path): return path.replace("\\", "/")
# Set top level
tcl.append("prj_set_impl_opt top \"{}\"".format(self._build_name))

# Set user project extra configurations
for k,v in self._prj_strategy_opts.items():
tcl.append(f"prj_set_strategy_value {k}={v}")

# Save project
tcl.append("prj_save")

Expand Down Expand Up @@ -283,6 +288,16 @@ def _check_timing(self):
return
raise Exception("Failed to meet timing")

"""
Set optional configuration for syn, par, bit.
Attributes
==========
strategy_opts: dict
keys/values to inject at script creation time
"""
def set_prj_strategy_opts(self, strategy_opts={}):
self._prj_strategy_opts.update(strategy_opts)


def radiant_build_args(parser):
toolchain_group = parser.add_argument_group(title="Radiant toolchain options")
Expand Down

0 comments on commit d985458

Please sign in to comment.