Merge pull request #732 from Disasm/ecp5-compress
Add option for ECP5 bistream compression
This commit is contained in:
commit
f055b1be69
litex/build/lattice
|
@ -123,10 +123,10 @@ _build_template = [
|
|||
"yosys -l {build_name}.rpt {build_name}.ys",
|
||||
"nextpnr-ecp5 --json {build_name}.json --lpf {build_name}.lpf --textcfg {build_name}.config \
|
||||
--{architecture} --package {package} --speed {speed_grade} {timefailarg} {ignoreloops} --seed {seed}",
|
||||
"ecppack {build_name}.config --svf {build_name}.svf --bit {build_name}.bit --bootaddr {bootaddr} {spimode}"
|
||||
"ecppack {build_name}.config --svf {build_name}.svf --bit {build_name}.bit --bootaddr {bootaddr} {spimode} {compress}"
|
||||
]
|
||||
|
||||
def _build_script(source, build_template, build_name, architecture, package, speed_grade, timingstrict, ignoreloops, bootaddr, seed, spimode):
|
||||
def _build_script(source, build_template, build_name, architecture, package, speed_grade, timingstrict, ignoreloops, bootaddr, seed, spimode, compress):
|
||||
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"
|
||||
|
@ -148,7 +148,8 @@ def _build_script(source, build_template, build_name, architecture, package, spe
|
|||
bootaddr = bootaddr,
|
||||
fail_stmt = fail_stmt,
|
||||
seed = seed,
|
||||
spimode = "" if spimode is None else "--spimode {}".format(spimode))
|
||||
spimode = "" if spimode is None else "--spimode {}".format(spimode),
|
||||
compress = "" if not compress else "--compress")
|
||||
|
||||
script_file = "build_" + build_name + script_ext
|
||||
tools.write_to_file(script_file, script_contents, force_unix=False)
|
||||
|
@ -203,6 +204,7 @@ class LatticeTrellisToolchain:
|
|||
bootaddr = 0,
|
||||
seed = 1,
|
||||
spimode = None,
|
||||
compress = False,
|
||||
**kwargs):
|
||||
|
||||
# Create build directory
|
||||
|
@ -234,7 +236,7 @@ class LatticeTrellisToolchain:
|
|||
|
||||
# Generate build script
|
||||
script = _build_script(False, self.build_template, build_name, architecture, package,
|
||||
speed_grade, timingstrict, ignoreloops, bootaddr, seed, spimode)
|
||||
speed_grade, timingstrict, ignoreloops, bootaddr, seed, spimode, compress)
|
||||
# Run
|
||||
if run:
|
||||
_run_script(script)
|
||||
|
@ -266,6 +268,8 @@ def trellis_args(parser):
|
|||
help="Set boot address for next image, i.e. pass '--bootaddr xxx' to ecppack")
|
||||
parser.add_argument("--ecppack-spimode", default=None,
|
||||
help="Set slave SPI programming mode")
|
||||
parser.add_argument("--ecppack-compress", action="store_true",
|
||||
help="Compress bitstream to reduce size")
|
||||
parser.add_argument("--nextpnr-seed", default=1, type=int,
|
||||
help="seed to pass to nextpnr")
|
||||
|
||||
|
@ -277,5 +281,6 @@ def trellis_argdict(args):
|
|||
"ignoreloops": args.nextpnr_ignoreloops,
|
||||
"bootaddr": args.ecppack_bootaddr,
|
||||
"spimode": args.ecppack_spimode,
|
||||
"compress": args.ecppack_compress,
|
||||
"seed": args.nextpnr_seed,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue