From d9854582c626dbdab29184935f980c90c4b61ece Mon Sep 17 00:00:00 2001 From: Gwenhael Goavec-Merou Date: Wed, 19 Jun 2024 16:22:30 +0200 Subject: [PATCH] build/lattice/radiant: allows extra configuration (prj_set_strategy_value XX=YY) to be added at script creation time --- litex/build/lattice/radiant.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/litex/build/lattice/radiant.py b/litex/build/lattice/radiant.py index 53b595d95..938f899e2 100644 --- a/litex/build/lattice/radiant.py +++ b/litex/build/lattice/radiant.py @@ -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")