From 4a3c19cedc40aeb598e28ccabc3eea1dc46f32b3 Mon Sep 17 00:00:00 2001 From: Gwenhael Goavec-Merou Date: Sat, 25 Jun 2022 17:10:23 +0200 Subject: [PATCH] build/lattice/icestorm: add edalize as alternate backend --- litex/build/lattice/icestorm.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/litex/build/lattice/icestorm.py b/litex/build/lattice/icestorm.py index a078762de..933d8deba 100644 --- a/litex/build/lattice/icestorm.py +++ b/litex/build/lattice/icestorm.py @@ -25,6 +25,7 @@ class LatticeIceStormToolchain(GenericToolchain): attr_translate = { "keep": ("keep", "true"), } + supported_backend = ["LiteX", "edalize"] special_overrides = common.lattice_ice40_special_overrides def __init__(self): @@ -72,6 +73,7 @@ class LatticeIceStormToolchain(GenericToolchain): if self.named_pc: r += "\n" + "\n\n".join(self.named_pc) tools.write_to_file(self._build_name + ".pcf", r) + return (self._build_name + ".pcf", "PCF") # Timing Constraints (in pre_pack file) -------------------------------------------------------- @@ -80,6 +82,7 @@ class LatticeIceStormToolchain(GenericToolchain): for clk, period in self.clocks.items(): r += """ctx.addClock("{}", {})\n""".format(vns.get_name(clk), 1e3/period) tools.write_to_file(self._build_name + "_pre_pack.py", r) + return (self._build_name + "_pre_pack.py", "PY") # Yosys/Nextpnr Helpers/Templates -------------------------------------------------------------- @@ -185,6 +188,16 @@ class LatticeIceStormToolchain(GenericToolchain): raise ValueError("Invalid device package {}".format(package)) return (family, architecture, package) + # Edalize tool name and tool options ----------------------------------------------------------- + def get_tool_options(self): + tool_options = { + "icepack_options": ["-s"], + "yosys_synth_options": self._synth_opts.split(' '), + "nextpnr_options": self._pnr_opts.split(' '), + } + print(tool_options) + return ("icestorm", tool_options) + def icestorm_args(parser): toolchain_group = parser.add_argument_group(title="Toolchain options")