lattice/trellis: simplify seed support and add it to trellis_args.

This commit is contained in:
Florent Kermarrec 2020-05-11 09:26:12 +02:00
parent 5ee01c9460
commit ea7fe383a3
1 changed files with 6 additions and 3 deletions

View File

@ -117,7 +117,7 @@ nextpnr_ecp5_architectures = {
_build_template = [ _build_template = [
"yosys -l {build_name}.rpt {build_name}.ys", "yosys -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} --speed {speed_grade} {timefailarg} {ignoreloops} {seed}", --{architecture} --package {package} --speed {speed_grade} {timefailarg} {ignoreloops} --seed {seed}",
"ecppack {build_name}.config --svf {build_name}.svf --bit {build_name}.bit" "ecppack {build_name}.config --svf {build_name}.svf --bit {build_name}.bit"
] ]
@ -141,7 +141,7 @@ def _build_script(source, build_template, build_name, architecture, package, spe
timefailarg = "--timing-allow-fail" if not timingstrict else "", timefailarg = "--timing-allow-fail" if not timingstrict else "",
ignoreloops = "--ignore-loops" if ignoreloops else "", ignoreloops = "--ignore-loops" if ignoreloops else "",
fail_stmt = fail_stmt, fail_stmt = fail_stmt,
seed = f"--seed {seed}" if seed is not None else "") seed = seed)
script_file = "build_" + build_name + script_ext script_file = "build_" + build_name + script_ext
tools.write_to_file(script_file, script_contents, force_unix=False) tools.write_to_file(script_file, script_contents, force_unix=False)
@ -187,7 +187,7 @@ class LatticeTrellisToolchain:
nowidelut = False, nowidelut = False,
timingstrict = False, timingstrict = False,
ignoreloops = False, ignoreloops = False,
seed = None, seed = 1,
**kwargs): **kwargs):
# Create build directory # Create build directory
@ -246,10 +246,13 @@ def trellis_args(parser):
help="fail if timing not met, i.e., do NOT pass '--timing-allow-fail' to nextpnr") help="fail if timing not met, i.e., do NOT pass '--timing-allow-fail' to nextpnr")
parser.add_argument("--nextpnr-ignoreloops", action="store_true", parser.add_argument("--nextpnr-ignoreloops", action="store_true",
help="ignore combinational loops in timing analysis, i.e. pass '--ignore-loops' to nextpnr") help="ignore combinational loops in timing analysis, i.e. pass '--ignore-loops' to nextpnr")
parser.add_argument("--nextpnr-seed", default=1, type=int,
help="seed to pass to nextpnr")
def trellis_argdict(args): def trellis_argdict(args):
return { return {
"nowidelut": args.yosys_nowidelut, "nowidelut": args.yosys_nowidelut,
"timingstrict": args.nextpnr_timingstrict, "timingstrict": args.nextpnr_timingstrict,
"ignoreloops": args.nextpnr_ignoreloops, "ignoreloops": args.nextpnr_ignoreloops,
"seed": args.nextpnr_seed,
} }