diff --git a/docs/user/FlowVariables.md b/docs/user/FlowVariables.md index 449ec84425..d49fd3a84a 100644 --- a/docs/user/FlowVariables.md +++ b/docs/user/FlowVariables.md @@ -301,6 +301,7 @@ configuration file. | SWAP_ARITH_OPERATORS| Improve timing QoR by swapping ALU and MULT arithmetic operators.| 0| | SYNTH_ARGS| Optional synthesis variables for yosys.| | | SYNTH_BLACKBOXES| List of cells treated as a black box by Yosys. With Bazel, this can be used to run synthesis in parallel for the large modules of the design. Non-existant modules are ignored silently, useful when listing modules statically, even if modules come and go dynamically.| | +| SYNTH_BLACKBOXES_FILE| Path to a file with more modules to treat as black boxes, one name per line, added to SYNTH_BLACKBOXES. For a parallel synthesis whose list is too long for one environment variable: Linux caps one at 128 KiB.| | | SYNTH_CANONICALIZE_TCL| Specifies a Tcl script with commands to run as part of the synth canonicalize step.| | | SYNTH_CHECKPOINT| Path to a Yosys RTLIL checkpoint to read in place of the default canonicalization checkpoint at the start of synth.tcl. Intended for parallel synthesis flows that reuse a checkpoint taken after coarse synthesis and `keep_hierarchy` have already been decided, so each partition skips that common prefix. Leave unset for the normal flow.| | | SYNTH_GUT| Load design and remove all internal logic before doing synthesis. This is useful when creating a mock .lef abstract that has a smaller area than the amount of logic would allow. bazel-orfs uses this to mock SRAMs, for instance.| 0| @@ -374,6 +375,7 @@ configuration file. - [SKIP_REPORT_METRICS](#SKIP_REPORT_METRICS) - [SYNTH_ARGS](#SYNTH_ARGS) - [SYNTH_BLACKBOXES](#SYNTH_BLACKBOXES) +- [SYNTH_BLACKBOXES_FILE](#SYNTH_BLACKBOXES_FILE) - [SYNTH_CANONICALIZE_TCL](#SYNTH_CANONICALIZE_TCL) - [SYNTH_CHECKPOINT](#SYNTH_CHECKPOINT) - [SYNTH_GUT](#SYNTH_GUT) diff --git a/flow/scripts/synth.tcl b/flow/scripts/synth.tcl index f13789c04e..c33ef9019c 100644 --- a/flow/scripts/synth.tcl +++ b/flow/scripts/synth.tcl @@ -58,10 +58,23 @@ if { [env_var_exists_and_non_empty SYNTH_CHECKPOINT] } { # the checkpoint. In synth_preamble.tcl a single design is being # synthesised, so an unknown name is almost certainly a user typo and # should fail loudly — `blackbox $m` without `catch` is intentional. -if { [env_var_exists_and_non_empty SYNTH_BLACKBOXES] } { - foreach m $::env(SYNTH_BLACKBOXES) { - catch { blackbox $m } +# +# An orchestrator with thousands of kept modules gives the list in a file +# instead, SYNTH_BLACKBOXES_FILE, one name per line: Linux caps one +# environment string at 128 KiB, and 2,250 names are 206 KB. +set synth_blackboxes [env_var_or_empty SYNTH_BLACKBOXES] +if { [env_var_exists_and_non_empty SYNTH_BLACKBOXES_FILE] } { + set fid [open $::env(SYNTH_BLACKBOXES_FILE) r] + while { [gets $fid line] >= 0 } { + set m [string trim $line] + if { $m ne "" } { + lappend synth_blackboxes $m + } } + close $fid +} +foreach m $synth_blackboxes { + catch { blackbox $m } } hierarchy -check -top $::env(DESIGN_NAME) diff --git a/flow/scripts/variables.json b/flow/scripts/variables.json index 7ac2d93f3b..5a77ad501e 100644 --- a/flow/scripts/variables.json +++ b/flow/scripts/variables.json @@ -1327,6 +1327,12 @@ "synth" ] }, + "SYNTH_BLACKBOXES_FILE": { + "description": "Path to a file with more modules to treat as black boxes, one name per line, added to SYNTH_BLACKBOXES. For a parallel synthesis whose list is too long for one environment variable: Linux caps one at 128 KiB.\n", + "stages": [ + "synth" + ] + }, "SYNTH_CANONICALIZE_TCL": { "description": "Specifies a Tcl script with commands to run as part of the synth canonicalize step.\n", "stages": [ diff --git a/flow/scripts/variables.yaml b/flow/scripts/variables.yaml index a2119190de..ba04ae9376 100644 --- a/flow/scripts/variables.yaml +++ b/flow/scripts/variables.yaml @@ -372,6 +372,13 @@ SYNTH_BLACKBOXES: statically, even if modules come and go dynamically. stages: - synth +SYNTH_BLACKBOXES_FILE: + description: > + Path to a file with more modules to treat as black boxes, one name per + line, added to SYNTH_BLACKBOXES. For a parallel synthesis whose list is + too long for one environment variable: Linux caps one at 128 KiB. + stages: + - synth SYNTH_CHECKPOINT: description: > Path to a Yosys RTLIL checkpoint to read in place of the default