Merge pull request #336 from kbeckmann/trellis-speed
trellis: Pass speed argument to nextpnr
This commit is contained in:
commit
018c7ca890
|
@ -99,16 +99,19 @@ def nextpnr_ecp5_package(package):
|
||||||
return "CABGA756"
|
return "CABGA756"
|
||||||
raise ValueError("Unknown package {}".format(package))
|
raise ValueError("Unknown package {}".format(package))
|
||||||
|
|
||||||
|
def nextpnr_ecp5_speed_grade(package):
|
||||||
|
return package[0] if package[0] in ["6", "7", "8"] else "6"
|
||||||
|
|
||||||
# Script -------------------------------------------------------------------------------------------
|
# Script -------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
_build_template = [
|
_build_template = [
|
||||||
"yosys -q -l {build_name}.rpt {build_name}.ys",
|
"yosys -q -l {build_name}.rpt {build_name}.ys",
|
||||||
"nextpnr-ecp5 --json {build_name}.json --lpf {build_name}.lpf --textcfg {build_name}.config \
|
"nextpnr-ecp5 --json {build_name}.json --lpf {build_name}.lpf --textcfg {build_name}.config \
|
||||||
--{architecture} --package {package} {timefailarg}",
|
--{architecture} --package {package} --speed {speed_grade} {timefailarg}",
|
||||||
"ecppack {build_name}.config --svf {build_name}.svf --bit {build_name}.bit"
|
"ecppack {build_name}.config --svf {build_name}.svf --bit {build_name}.bit"
|
||||||
]
|
]
|
||||||
|
|
||||||
def _build_script(source, build_template, build_name, architecture, package, timingstrict):
|
def _build_script(source, build_template, build_name, architecture, package, speed_grade, timingstrict):
|
||||||
if sys.platform in ("win32", "cygwin"):
|
if sys.platform in ("win32", "cygwin"):
|
||||||
script_ext = ".bat"
|
script_ext = ".bat"
|
||||||
script_contents = "@echo off\nrem Autogenerated by LiteX / git: " + tools.get_litex_git_revision() + "\n\n"
|
script_contents = "@echo off\nrem Autogenerated by LiteX / git: " + tools.get_litex_git_revision() + "\n\n"
|
||||||
|
@ -124,6 +127,7 @@ def _build_script(source, build_template, build_name, architecture, package, tim
|
||||||
build_name = build_name,
|
build_name = build_name,
|
||||||
architecture = architecture,
|
architecture = architecture,
|
||||||
package = package,
|
package = package,
|
||||||
|
speed_grade = speed_grade,
|
||||||
timefailarg = "--timing-allow-fail" if not timingstrict else "",
|
timefailarg = "--timing-allow-fail" if not timingstrict else "",
|
||||||
fail_stmt = fail_stmt)
|
fail_stmt = fail_stmt)
|
||||||
|
|
||||||
|
@ -202,11 +206,12 @@ class LatticeTrellisToolchain:
|
||||||
# Translate device to Nextpnr architecture/package
|
# Translate device to Nextpnr architecture/package
|
||||||
(family, size, package) = platform.device.split("-")
|
(family, size, package) = platform.device.split("-")
|
||||||
architecture = nextpnr_ecp5_architectures[(family + "-" + size).lower()]
|
architecture = nextpnr_ecp5_architectures[(family + "-" + size).lower()]
|
||||||
|
speed_grade = nextpnr_ecp5_speed_grade(package)
|
||||||
package = nextpnr_ecp5_package(package)
|
package = nextpnr_ecp5_package(package)
|
||||||
|
|
||||||
# Generate build script
|
# Generate build script
|
||||||
script = _build_script(False, self.build_template, build_name, architecture, package,
|
script = _build_script(False, self.build_template, build_name, architecture, package,
|
||||||
timingstrict)
|
speed_grade, timingstrict)
|
||||||
|
|
||||||
# Run
|
# Run
|
||||||
if run:
|
if run:
|
||||||
|
|
Loading…
Reference in New Issue