Skip to content

Commit

Permalink
squishy: actions: Added a new option --aggressive-mapping to the `S…
Browse files Browse the repository at this point in the history
…quishySynthAction` `run_synth` to allow for more intense mapping using ABC9 to hopefully improve performance
  • Loading branch information
lethalbit committed Jun 16, 2024
1 parent b324401 commit ba6f893
Showing 1 changed file with 25 additions and 10 deletions.
35 changes: 25 additions & 10 deletions squishy/actions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ def run_synth(

synth_opts: list[str] = []
pnr_opts: list[str] = []
script_pre_synth = ''
script_post_synth = ''

build_dir = Path(args.build_dir)

Expand All @@ -194,6 +196,11 @@ def run_synth(
# Synthesis Options
if not args.no_abc9:
synth_opts.append('-abc9')
if args.aggressive_mapping:
if args.no_abc9:
log.error('Can not spcify `--aggressive-mapping` with ABC9 disabled, remove `--no-abc9`')
else:
script_pre_synth += 'scratchpad -copy abc9.script.flow3 abc9.script\n'

# Place and Route Options
if args.use_router2:
Expand Down Expand Up @@ -230,16 +237,18 @@ def run_synth(
) as progress:
name, prod = plat.build(
elab,
name = elab_name,
build_dir = build_dir,
do_build = True,
do_program = False,
synth_opts = synth_opts,
nextpnr_opts = pnr_opts,
verbose = args.loud,
skip_cache = skip_cache,
progress = progress,
debug_verilog = cacheable and not skip_cache
name = elab_name,
build_dir = build_dir,
do_build = True,
do_program = False,
synth_opts = synth_opts,
nextpnr_opts = pnr_opts,
verbose = args.loud,
skip_cache = skip_cache,
progress = progress,
debug_verilog = cacheable and not skip_cache,
script_after_read = script_pre_synth,
script_after_synth = script_post_synth
)

return (name, prod)
Expand Down Expand Up @@ -294,6 +303,12 @@ def register_synth_args(self, parser: ArgumentParser, cacheable: bool = False) -
help = 'Disable use of Yosys\' ABC9'
)

synth_options.add_argument(
'--aggressive-mapping',
action = 'store_true',
help = 'Run multiple ABC9 mapping more than once to improve performance in exchange for longer synth time'
)

# Place and Route Options
pnr_options.add_argument(
'--use-router2',
Expand Down

0 comments on commit ba6f893

Please sign in to comment.