build/lattice/icestorm: add edalize as alternate backend

This commit is contained in:
Gwenhael Goavec-Merou 2022-06-25 17:10:23 +02:00
parent 04617027f4
commit 4a3c19cedc
1 changed files with 13 additions and 0 deletions

View File

@ -25,6 +25,7 @@ class LatticeIceStormToolchain(GenericToolchain):
attr_translate = { attr_translate = {
"keep": ("keep", "true"), "keep": ("keep", "true"),
} }
supported_backend = ["LiteX", "edalize"]
special_overrides = common.lattice_ice40_special_overrides special_overrides = common.lattice_ice40_special_overrides
def __init__(self): def __init__(self):
@ -72,6 +73,7 @@ class LatticeIceStormToolchain(GenericToolchain):
if self.named_pc: if self.named_pc:
r += "\n" + "\n\n".join(self.named_pc) r += "\n" + "\n\n".join(self.named_pc)
tools.write_to_file(self._build_name + ".pcf", r) tools.write_to_file(self._build_name + ".pcf", r)
return (self._build_name + ".pcf", "PCF")
# Timing Constraints (in pre_pack file) -------------------------------------------------------- # Timing Constraints (in pre_pack file) --------------------------------------------------------
@ -80,6 +82,7 @@ class LatticeIceStormToolchain(GenericToolchain):
for clk, period in self.clocks.items(): for clk, period in self.clocks.items():
r += """ctx.addClock("{}", {})\n""".format(vns.get_name(clk), 1e3/period) r += """ctx.addClock("{}", {})\n""".format(vns.get_name(clk), 1e3/period)
tools.write_to_file(self._build_name + "_pre_pack.py", r) tools.write_to_file(self._build_name + "_pre_pack.py", r)
return (self._build_name + "_pre_pack.py", "PY")
# Yosys/Nextpnr Helpers/Templates -------------------------------------------------------------- # Yosys/Nextpnr Helpers/Templates --------------------------------------------------------------
@ -185,6 +188,16 @@ class LatticeIceStormToolchain(GenericToolchain):
raise ValueError("Invalid device package {}".format(package)) raise ValueError("Invalid device package {}".format(package))
return (family, architecture, 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): def icestorm_args(parser):
toolchain_group = parser.add_argument_group(title="Toolchain options") toolchain_group = parser.add_argument_group(title="Toolchain options")