Bring into line with master
authorDave Marples <dave@marples.net>
Tue, 12 May 2020 11:28:09 +0000 (12:28 +0100)
committerDave Marples <dave@marples.net>
Tue, 12 May 2020 11:28:09 +0000 (12:28 +0100)
1  2 
litex/build/lattice/trellis.py

index bc908a9427e743320ada0ed09555209573f050c7,38e4cdaeb37fd101abbda3abcd05fcb34c5c1356..3c4eded4bc617b684279a8082676aad7205bbc0b
@@@ -117,11 -117,11 +117,11 @@@ nextpnr_ecp5_architectures = 
  _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}",
-     "ecppack {build_name}.config --svf {build_name}.svf --bit {build_name}.bit --bootaddr={bootaddr}"
+     --{architecture} --package {package} --speed {speed_grade} {timefailarg} {ignoreloops} --seed {seed}",
+     "ecppack {build_name}.config --svf {build_name}.svf --bit {build_name}.bit"
  ]
  
- def _build_script(source, build_template, build_name, architecture, package, speed_grade, timingstrict, ignoreloops, bootaddr):
 -def _build_script(source, build_template, build_name, architecture, package, speed_grade, timingstrict, ignoreloops, seed):
++def _build_script(source, build_template, build_name, architecture, package, speed_grade, timingstrict, ignoreloops, bootaddr, seed):
      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"
      for s in build_template:
          s_fail = s + "{fail_stmt}\n"  # Required so Windows scripts fail early.
          script_contents += s_fail.format(
 -            build_name   = build_name,
 -            architecture = architecture,
 -            package      = package,
 -            speed_grade  = speed_grade,
 -            timefailarg  = "--timing-allow-fail" if not timingstrict else "",
 -            ignoreloops  = "--ignore-loops" if ignoreloops else "",
 -            fail_stmt    = fail_stmt,
 -            seed         = seed)
 +            build_name      = build_name,
 +            architecture    = architecture,
 +            package         = package,
 +            speed_grade     = speed_grade,
 +            timefailarg     = "--timing-allow-fail" if not timingstrict else "",
 +            ignoreloops     = "--ignore-loops" if ignoreloops else "",
 +            bootaddr        = bootaddr,
-             fail_stmt       = fail_stmt)
++            fail_stmt       = fail_stmt,
++            seed            = seed)
  
      script_file = "build_" + build_name + script_ext
      tools.write_to_file(script_file, script_contents, force_unix=False)
@@@ -187,7 -187,7 +188,8 @@@ class LatticeTrellisToolchain
          nowidelut      = False,
          timingstrict   = False,
          ignoreloops    = False,
 +        bootaddr       = 0,
+         seed           = 1,
          **kwargs):
  
          # Create build directory
  
          # Generate build script
          script = _build_script(False, self.build_template, build_name, architecture, package,
-         speed_grade, timingstrict, ignoreloops, bootaddr)
 -            speed_grade, timingstrict, ignoreloops, seed)
--
++                               speed_grade, timingstrict, ignoreloops, bootaddr, seed)
          # Run
          if run:
              _run_script(script)
@@@ -246,13 -246,13 +247,16 @@@ def trellis_args(parser)
                          help="fail if timing not met, i.e., do NOT pass '--timing-allow-fail' to nextpnr")
      parser.add_argument("--nextpnr-ignoreloops", action="store_true",
                          help="ignore combinational loops in timing analysis, i.e. pass '--ignore-loops' to nextpnr")
 +    parser.add_argument("--ecppack-bootaddr", default=0,
 +                        help="Set boot address for next image, i.e. pass '--bootaddr xxx' to ecppack")
+     parser.add_argument("--nextpnr-seed", default=1, type=int,
+                         help="seed to pass to nextpnr")
  
  def trellis_argdict(args):
      return {
          "nowidelut":    args.yosys_nowidelut,
          "timingstrict": args.nextpnr_timingstrict,
          "ignoreloops":  args.nextpnr_ignoreloops,
-         "bootaddr":     args.ecppack_bootaddr
++        "bootaddr":     args.ecppack_bootaddr,
+         "seed":         args.nextpnr_seed,
      }