diff --git a/docs/user/FlowVariables.md b/docs/user/FlowVariables.md
index 3c6f82902e..073067edf0 100644
--- a/docs/user/FlowVariables.md
+++ b/docs/user/FlowVariables.md
@@ -255,6 +255,7 @@ configuration file.
| SYNTH_MINIMUM_KEEP_SIZE| For hierarchical synthesis, we keep modules of larger area than given by this variable and flatten smaller modules. The area unit used is the size of a basic nand2 gate from the platform's standard cell library. The default value is platform specific.| 0|
| SYNTH_MOCK_LARGE_MEMORIES| Reduce Yosys inferred memories larger than SYNTH_MEMORY_MAX_BITS to 1 row. Yosys will generally infer memories from behavioral Verilog code, whether the memories are in standalone modules or instantiated within some larger module. fakeram and empty Verilog memories(blackboxes) of memories will not be inferred memories by Yosys and are therefore not affected by this variable. This is useful and convenient to separate the concern of instantiating and placing memories from investigating other issues with a design, though it comes at the expense of the increased accuracy that using realistic fakemem would provide. Memories with a single 1 row will of course have unrealistically good timing and area characteristics, but timing will still correctly terminate in a register. Large port memories, typically register files, will still have the retain a lot of the port logic that can be useful to investigate issues. This can be especially useful during development of designs where the behavioral model comes first and suitable memories are matched up when the design RTL is stable. A typical use case would be Chisel which will generate a behavioral model for a memories with the required clocks, ports, etc. in addition to a computer readable file with the specification of the memories that is used to [automatically](https://chipyard.readthedocs.io/en/stable/Tools/Barstools.html/) match up suitable memory macros later in the flow. During an architectural screening study, a large range of memory configurations can be investigated quickly with this option, without getting bogged down in the concern of how to realize the memories in silicon for emphemral RTL configurations that exist only long enough to run through the ORFS flow to create a table of some characteristics of a design configuration.| 0|
| SYNTH_NETLIST_FILES| Skips synthesis and uses the supplied netlist files. If the netlist files contains duplicate modules, which can happen when using hierarchical synthesis on indvidual netlist files and combining here, subsequent modules are silently ignored and only the first module is used.| |
+| SYNTH_ODB_TCL| Specifies a Tcl script with commands to run as part of the synth ODB generation step. Useful in bazel-orfs flows which can paralleled hierarchical synthesis and needs to clean up the final netlist.| |
| SYNTH_OPT_HIER| Optimize constants across hierarchical boundaries.| |
| SYNTH_REPEATABLE_BUILD| License to prune anything that makes builds less repeatable, typically used with Bazel to ensure that builds are bit-for-bit identical so that caching works optimally. Removes debug information that encodes paths, timestamps, etc.| 0|
| SYNTH_RETIME_MODULES| *This is an experimental option and may cause adverse effects.* *No effort has been made to check if the retimed RTL is logically equivalent to the non-retimed RTL.* List of modules to apply automatic retiming to. These modules must not get dissolved and as such they should either be the top module or be included in SYNTH_KEEP_MODULES. The main use case is to quickly identify if performance can be improved by manually retiming the input RTL. Retiming will treat module ports like register endpoints/startpoints. The objective function of retiming isn't informed by SDC, even the clock period is ignored. As such, retiming will optimize for best delay at potentially high register number cost. Automatic retiming can produce suboptimal results as its timing model is crude and it doesn't find the optimal distribution of registers on long pipelines. See OR discussion #8080.| |
@@ -302,6 +303,7 @@ configuration file.
- [SYNTH_MINIMUM_KEEP_SIZE](#SYNTH_MINIMUM_KEEP_SIZE)
- [SYNTH_MOCK_LARGE_MEMORIES](#SYNTH_MOCK_LARGE_MEMORIES)
- [SYNTH_NETLIST_FILES](#SYNTH_NETLIST_FILES)
+- [SYNTH_ODB_TCL](#SYNTH_ODB_TCL)
- [SYNTH_OPT_HIER](#SYNTH_OPT_HIER)
- [SYNTH_REPEATABLE_BUILD](#SYNTH_REPEATABLE_BUILD)
- [SYNTH_RETIME_MODULES](#SYNTH_RETIME_MODULES)
diff --git a/flow/scripts/synth_odb.tcl b/flow/scripts/synth_odb.tcl
index ad56b542e8..18a9709d3d 100644
--- a/flow/scripts/synth_odb.tcl
+++ b/flow/scripts/synth_odb.tcl
@@ -3,6 +3,8 @@ source $::env(SCRIPTS_DIR)/load.tcl
erase_non_stage_variables synth
load_design 1_2_yosys.v 1_2_yosys.sdc
+source_env_var_if_exists SYNTH_ODB_TCL
+
orfs_write_db $::env(RESULTS_DIR)/1_synth.odb
# Canonicalize 1_synth.sdc. The original SDC_FILE provided by
# the user could have dependencies, such as sourcing util.tcl,
diff --git a/flow/scripts/variables.yaml b/flow/scripts/variables.yaml
index 4a75744397..d312399d05 100644
--- a/flow/scripts/variables.yaml
+++ b/flow/scripts/variables.yaml
@@ -914,6 +914,15 @@ SYNTH_OPT_HIER:
Optimize constants across hierarchical boundaries.
stages:
- synth
+SYNTH_ODB_TCL:
+ description: |
+ Specifies a Tcl script with commands to run as part of the synth ODB
+ generation step.
+
+ Useful in bazel-orfs flows which can paralleled hierarchical synthesis
+ and needs to clean up the final netlist.
+ stages:
+ - synth
VERILOG_TOP_PARAMS:
description: |
Apply toplevel params (if exist). Passed in as a list of key value pairs