build/lattice/icestorm/trellis: Generate Yosys script in build_project.
This commit is contained in:
parent
4c978bf463
commit
7117de0f1f
|
@ -81,8 +81,6 @@ class LatticeIceStormToolchain(GenericToolchain):
|
|||
language, includes, filename))
|
||||
return "\n".join(reads)
|
||||
|
||||
# Yosys/Nextpnr Helpers/Templates --------------------------------------------------------------
|
||||
|
||||
_yosys_template = [
|
||||
"verilog_defaults -push",
|
||||
"verilog_defaults -add -defer",
|
||||
|
@ -92,7 +90,9 @@ class LatticeIceStormToolchain(GenericToolchain):
|
|||
"synth_ice40 {synth_opts} -json {build_name}.json -top {build_name} -dsp",
|
||||
]
|
||||
|
||||
def _build_yosys(self):
|
||||
# Project (.ys) --------------------------------------------------------------------------------
|
||||
|
||||
def build_project(self):
|
||||
ys = []
|
||||
for l in self._yosys_template:
|
||||
ys.append(l.format(
|
||||
|
@ -112,8 +112,6 @@ class LatticeIceStormToolchain(GenericToolchain):
|
|||
]
|
||||
|
||||
def build_script(self):
|
||||
# Generate Yosys script
|
||||
self._build_yosys()
|
||||
# Translate device to Nextpnr architecture/package
|
||||
(family, architecture, package) = self.parse_device()
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ class LatticeTrellisToolchain(GenericToolchain):
|
|||
lpf.append("\n\n".join(named_pc))
|
||||
tools.write_to_file(self._build_name + ".lpf", "\n".join(lpf))
|
||||
|
||||
# Yosys/Nextpnr Helpers/Templates --------------------------------------------------------------
|
||||
# Yosys Helpers/Templates ----------------------------------------------------------------------
|
||||
|
||||
_yosys_template = [
|
||||
"verilog_defaults -push",
|
||||
|
@ -111,7 +111,9 @@ class LatticeTrellisToolchain(GenericToolchain):
|
|||
language, includes, filename))
|
||||
return "\n".join(reads)
|
||||
|
||||
def _build_yosys(self):
|
||||
# Project (.ys) --------------------------------------------------------------------------------
|
||||
|
||||
def build_project(self):
|
||||
ys = []
|
||||
for l in self._yosys_template:
|
||||
ys.append(l.format(
|
||||
|
@ -122,6 +124,8 @@ class LatticeTrellisToolchain(GenericToolchain):
|
|||
))
|
||||
tools.write_to_file(self._build_name + ".ys", "\n".join(ys))
|
||||
|
||||
# NextPnr Helpers/Templates --------------------------------------------------------------------
|
||||
|
||||
def nextpnr_ecp5_parse_device(self, device):
|
||||
device = device.lower()
|
||||
family = device.split("-")[0]
|
||||
|
@ -167,8 +171,6 @@ class LatticeTrellisToolchain(GenericToolchain):
|
|||
]
|
||||
|
||||
def build_script(self):
|
||||
# Generate Yosys script
|
||||
self._build_yosys()
|
||||
# Translate device to Nextpnr architecture/package
|
||||
(family, size, speed_grade, package) = self.nextpnr_ecp5_parse_device(self.platform.device)
|
||||
architecture = self.nextpnr_ecp5_architectures[(family + "-" + size)]
|
||||
|
@ -202,7 +204,7 @@ class LatticeTrellisToolchain(GenericToolchain):
|
|||
|
||||
return script_file
|
||||
|
||||
def run_script(script):
|
||||
def run_script(self, script):
|
||||
if sys.platform in ("win32", "cygwin"):
|
||||
shell = ["cmd", "/c"]
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue