diff --git a/docs/user/FlowVariables.md b/docs/user/FlowVariables.md index dfb6ab40f2..4faa3cf80c 100644 --- a/docs/user/FlowVariables.md +++ b/docs/user/FlowVariables.md @@ -93,6 +93,7 @@ configuration file. | ABC_AREA| Strategies for Yosys ABC synthesis: Area/Speed. Default ABC_SPEED.| 0| | ABC_DRIVER_CELL| Default driver cell used during ABC synthesis.| | | ABC_LOAD_IN_FF| During synthesis set_load value used.| | +| ABC_SCRIPT| Replaces the ABC script synthesis runs, so that a design can vendor and change it. Ignored when SYNTH_WRAPPED_OPERATORS or SWAP_ARITH_OPERATORS is set: abc_new then maps each arithmetic operator with its own script.| | | ABSTRACT_SOURCE| Which .odb file to use to create abstract| | | ADDER_MAP_FILE| Optional mapping file supplied to Yosys to map adders| | | ADDITIONAL_FILES| Additional files to be added to `make issue` archive.| | @@ -340,6 +341,7 @@ configuration file. - [ABC_AREA](#ABC_AREA) - [ABC_DRIVER_CELL](#ABC_DRIVER_CELL) - [ABC_LOAD_IN_FF](#ABC_LOAD_IN_FF) +- [ABC_SCRIPT](#ABC_SCRIPT) - [ADDER_MAP_FILE](#ADDER_MAP_FILE) - [ADDITIONAL_MEMORIES](#ADDITIONAL_MEMORIES) - [CACHED_REPORTS](#CACHED_REPORTS) diff --git a/flow/scripts/synth.tcl b/flow/scripts/synth.tcl index 7327312e53..aa4d3afb6c 100644 --- a/flow/scripts/synth.tcl +++ b/flow/scripts/synth.tcl @@ -284,8 +284,13 @@ if { } { log_cmd abc {*}$abc_args } else { + # Not dead code: abc_new mistakes the "-script" in /OpenROAD-flow-scripts/... + # paths for a given -script and drops its default (YosysHQ/yosys#6320). scratchpad -set abc9.script $::env(SCRIPTS_DIR)/abc_speed_gia_only.script - # crop out -script from arguments + # abc_new maps each arithmetic operator module with the abc9_script + # attribute synth_wrap_operators.tcl sets on it, and every other module + # with the script above. An explicit -script overrides both, so it is + # cropped from the arguments and ABC_SCRIPT does not apply here. set abc_args [lrange $abc_args 2 end] log_cmd abc_new {*}$abc_args delete {t:$specify*} diff --git a/flow/scripts/synth_preamble.tcl b/flow/scripts/synth_preamble.tcl index 53353ee46a..cc517b2e35 100644 --- a/flow/scripts/synth_preamble.tcl +++ b/flow/scripts/synth_preamble.tcl @@ -189,7 +189,10 @@ proc read_design_sources { } { } } -if { $::env(ABC_AREA) } { +if { [env_var_exists_and_non_empty ABC_SCRIPT] } { + puts "Using ABC script $::env(ABC_SCRIPT)." + set abc_script $::env(ABC_SCRIPT) +} elseif { $::env(ABC_AREA) } { puts "Using ABC area script." set abc_script $::env(SCRIPTS_DIR)/abc_area.script } else { diff --git a/flow/scripts/variables.json b/flow/scripts/variables.json index 61a7b8b8e7..c79940855c 100644 --- a/flow/scripts/variables.json +++ b/flow/scripts/variables.json @@ -18,6 +18,12 @@ "synth" ] }, + "ABC_SCRIPT": { + "description": "Replaces the ABC script synthesis runs, so that a design can vendor and\nchange it. Ignored when SYNTH_WRAPPED_OPERATORS or SWAP_ARITH_OPERATORS\nis set: abc_new then maps each arithmetic operator with its own script.\n", + "stages": [ + "synth" + ] + }, "ABSTRACT_SOURCE": { "description": "Which .odb file to use to create abstract\n", "stages": [ diff --git a/flow/scripts/variables.yaml b/flow/scripts/variables.yaml index 2052bd468d..ac913b71ad 100644 --- a/flow/scripts/variables.yaml +++ b/flow/scripts/variables.yaml @@ -1037,6 +1037,13 @@ ABC_AREA: stages: - synth default: 0 +ABC_SCRIPT: + description: | + Replaces the ABC script synthesis runs, so that a design can vendor and + change it. Ignored when SYNTH_WRAPPED_OPERATORS or SWAP_ARITH_OPERATORS + is set: abc_new then maps each arithmetic operator with its own script. + stages: + - synth PWR_NETS_VOLTAGES: description: | Used for IR Drop calculation.