build/lattice/radiant: allows extra configuration (prj_set_strategy_value XX=YY) to be added at script creation time

This commit is contained in:
Gwenhael Goavec-Merou 2024-06-19 16:22:30 +02:00
parent d6b0c84f9c
commit d9854582c6
1 changed files with 18 additions and 3 deletions

View File

@ -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,
@ -176,6 +177,10 @@ class LatticeRadiantToolchain(GenericToolchain):
# 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")
@ -283,6 +288,16 @@ class LatticeRadiantToolchain(GenericToolchain):
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")