Merge pull request #336 from kbeckmann/trellis-speed

trellis: Pass speed argument to nextpnr
This commit is contained in:
enjoy-digital 2020-01-08 19:17:04 +01:00 committed by GitHub
commit 018c7ca890
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 3 deletions

View File

@ -99,16 +99,19 @@ def nextpnr_ecp5_package(package):
return "CABGA756"
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 -------------------------------------------------------------------------------------------
_build_template = [
"yosys -q -l {build_name}.rpt {build_name}.ys",
"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"
]
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"):
script_ext = ".bat"
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,
architecture = architecture,
package = package,
speed_grade = speed_grade,
timefailarg = "--timing-allow-fail" if not timingstrict else "",
fail_stmt = fail_stmt)
@ -202,11 +206,12 @@ class LatticeTrellisToolchain:
# Translate device to Nextpnr architecture/package
(family, size, package) = platform.device.split("-")
architecture = nextpnr_ecp5_architectures[(family + "-" + size).lower()]
speed_grade = nextpnr_ecp5_speed_grade(package)
package = nextpnr_ecp5_package(package)
# Generate build script
script = _build_script(False, self.build_template, build_name, architecture, package,
timingstrict)
speed_grade, timingstrict)
# Run
if run: