diff --git a/docs/user/FlowVariables.md b/docs/user/FlowVariables.md index 178f0f2b0a..78e0f99f41 100644 --- a/docs/user/FlowVariables.md +++ b/docs/user/FlowVariables.md @@ -157,7 +157,7 @@ configuration file. | IO_PLACER_H| A list of metal layers on which the I/O pins are placed horizontally (top and bottom of the die).| | | IO_PLACER_V| A list of metal layers on which the I/O pins are placed vertically (sides of the die).| | | IR_DROP_LAYER| Default metal layer to report IR drop.| | -| KEEP_VARS| Feature toggle to keep intermediate variables during the flow. This is useful for the single-run flow, where all stages of the flow are run in a single OpenROAD instance.| | +| KEEP_VARS| Feature toggle to keep intermediate variables during the flow. This is useful for the single-run flow, where all stages of the flow are run in a single OpenROAD instance.| 0| | KLAYOUT_TECH_FILE| A mapping from LEF/DEF to GDS using the KLayout tool.| | | LATCH_MAP_FILE| Optional mapping file supplied to Yosys to map latches| | | LAYER_PARASITICS_FILE| Path to per layer parasitics file. Defaults to $(PLATFORM_DIR)/setRC.tcl.| | @@ -271,6 +271,7 @@ configuration file. | VERILOG_FILES| The path to the design Verilog/SystemVerilog files providing a description of modules.| | | VERILOG_INCLUDE_DIRS| Specifies the include directories for the Verilog input files.| | | VERILOG_TOP_PARAMS| Apply toplevel params (if exist). Passed in as a list of key value pairs in tcl syntax; separated by spaces: PARAM1 VALUE1 PARAM2 VALUE2 stages: - synth| | +| WRITE_ODB_AND_SDC_EACH_STAGE| Save out .sdc and .odb file after each stage, useful to disable when using a single OpenROAD instance to run all stages of the flow.| 1| | YOSYS_FLAGS| Flags to pass to yosys.| -v 3| ## synth variables @@ -487,6 +488,7 @@ configuration file. - [OPENROAD_HIERARCHICAL](#OPENROAD_HIERARCHICAL) - [SWAP_ARITH_OPERATORS](#SWAP_ARITH_OPERATORS) - [SYNTH_WRAPPED_OPERATORS](#SYNTH_WRAPPED_OPERATORS) +- [WRITE_ODB_AND_SDC_EACH_STAGE](#WRITE_ODB_AND_SDC_EACH_STAGE) ## generate_abstract variables diff --git a/flow/scripts/cts.tcl b/flow/scripts/cts.tcl index e281f4b594..66732265eb 100644 --- a/flow/scripts/cts.tcl +++ b/flow/scripts/cts.tcl @@ -9,8 +9,8 @@ repair_clock_inverters proc save_progress { stage } { puts "Run 'make gui_$stage.odb' to load progress snapshot" - write_db $::env(RESULTS_DIR)/$stage.odb - write_sdc -no_timestamp $::env(RESULTS_DIR)/$stage.sdc + orfs_write_db $::env(RESULTS_DIR)/$stage.odb + orfs_write_sdc $::env(RESULTS_DIR)/$stage.sdc } # Run CTS @@ -80,5 +80,5 @@ report_metrics 4 "cts final" source_env_var_if_exists POST_CTS_TCL -write_db $::env(RESULTS_DIR)/4_1_cts.odb -write_sdc -no_timestamp $::env(RESULTS_DIR)/4_cts.sdc +orfs_write_db $::env(RESULTS_DIR)/4_1_cts.odb +orfs_write_sdc $::env(RESULTS_DIR)/4_cts.sdc diff --git a/flow/scripts/density_fill.tcl b/flow/scripts/density_fill.tcl index 08347868d5..a0f45f7276 100644 --- a/flow/scripts/density_fill.tcl +++ b/flow/scripts/density_fill.tcl @@ -8,7 +8,7 @@ if { $::env(USE_FILL) } { # The .v file is just for debugging purposes, not a result of # this stage. write_verilog $::env(RESULTS_DIR)/6_1_fill.v - write_db $::env(RESULTS_DIR)/6_1_fill.odb + orfs_write_db $::env(RESULTS_DIR)/6_1_fill.odb } else { log_cmd exec cp $::env(RESULTS_DIR)/5_route.odb $::env(RESULTS_DIR)/6_1_fill.odb # There is no 5_route.v file to copy diff --git a/flow/scripts/detail_place.tcl b/flow/scripts/detail_place.tcl index eff7a140d0..a0e1775947 100644 --- a/flow/scripts/detail_place.tcl +++ b/flow/scripts/detail_place.tcl @@ -32,10 +32,10 @@ proc do_dpl { } { set result [catch { do_dpl } errMsg] if { $result != 0 } { - write_db $::env(RESULTS_DIR)/3_5_place_dp-failed.odb + orfs_write_db $::env(RESULTS_DIR)/3_5_place_dp-failed.odb error $errMsg } report_metrics 3 "detailed place" true false -write_db $::env(RESULTS_DIR)/3_5_place_dp.odb +orfs_write_db $::env(RESULTS_DIR)/3_5_place_dp.odb diff --git a/flow/scripts/detail_route.tcl b/flow/scripts/detail_route.tcl index 6022daecc1..0a2aa6b5a5 100644 --- a/flow/scripts/detail_route.tcl +++ b/flow/scripts/detail_route.tcl @@ -7,7 +7,7 @@ if { ![grt::have_routes] } { } if { $::env(SKIP_DETAILED_ROUTE) } { - write_db $::env(RESULTS_DIR)/5_2_route.odb + orfs_write_db $::env(RESULTS_DIR)/5_2_route.odb exit } @@ -79,4 +79,4 @@ if { ![design_is_routed] } { report_metrics 5 "detailed route" -write_db $::env(RESULTS_DIR)/5_2_route.odb +orfs_write_db $::env(RESULTS_DIR)/5_2_route.odb diff --git a/flow/scripts/fillcell.tcl b/flow/scripts/fillcell.tcl index ea23e5b24f..ba4b96912e 100644 --- a/flow/scripts/fillcell.tcl +++ b/flow/scripts/fillcell.tcl @@ -8,7 +8,7 @@ if { [env_var_exists_and_non_empty FILL_CELLS] } { log_cmd filler_placement $::env(FILL_CELLS) check_placement - write_db $::env(RESULTS_DIR)/5_3_fillcell.odb + orfs_write_db $::env(RESULTS_DIR)/5_3_fillcell.odb } else { log_cmd exec cp $::env(RESULTS_DIR)/5_2_route.odb $::env(RESULTS_DIR)/5_3_fillcell.odb } diff --git a/flow/scripts/final_report.tcl b/flow/scripts/final_report.tcl index 5cebdf2ea8..928e92bf2b 100644 --- a/flow/scripts/final_report.tcl +++ b/flow/scripts/final_report.tcl @@ -8,7 +8,7 @@ set_propagated_clock [all_clocks] # Ensure all OR created (rsz/cts) instances are connected global_connect -write_db $::env(RESULTS_DIR)/6_final.odb +orfs_write_db $::env(RESULTS_DIR)/6_final.odb # Delete routing obstructions for final DEF source $::env(SCRIPTS_DIR)/deleteRoutingObstructions.tcl diff --git a/flow/scripts/floorplan.tcl b/flow/scripts/floorplan.tcl index 9880250f86..710cef5f16 100644 --- a/flow/scripts/floorplan.tcl +++ b/flow/scripts/floorplan.tcl @@ -150,5 +150,5 @@ report_metrics 2 "floorplan final" false false source_env_var_if_exists POST_FLOORPLAN_TCL source_env_var_if_exists IO_CONSTRAINTS -write_db $::env(RESULTS_DIR)/2_1_floorplan.odb -write_sdc -no_timestamp $::env(RESULTS_DIR)/2_1_floorplan.sdc +orfs_write_db $::env(RESULTS_DIR)/2_1_floorplan.odb +orfs_write_sdc $::env(RESULTS_DIR)/2_1_floorplan.sdc diff --git a/flow/scripts/global_place.tcl b/flow/scripts/global_place.tcl index ef130951b3..7ac604bc07 100644 --- a/flow/scripts/global_place.tcl +++ b/flow/scripts/global_place.tcl @@ -46,7 +46,7 @@ proc do_placement { global_placement_args } { set result [catch { do_placement $global_placement_args } errMsg] if { $result != 0 } { - write_db $::env(RESULTS_DIR)/3_3_place_gp-failed.odb + orfs_write_db $::env(RESULTS_DIR)/3_3_place_gp-failed.odb error $errMsg } @@ -59,4 +59,4 @@ if { $::env(CLUSTER_FLOPS) } { report_metrics 3 "global place" false false -write_db $::env(RESULTS_DIR)/3_3_place_gp.odb +orfs_write_db $::env(RESULTS_DIR)/3_3_place_gp.odb diff --git a/flow/scripts/global_place_skip_io.tcl b/flow/scripts/global_place_skip_io.tcl index b528856448..550df07fb6 100644 --- a/flow/scripts/global_place_skip_io.tcl +++ b/flow/scripts/global_place_skip_io.tcl @@ -13,4 +13,4 @@ if { [env_var_exists_and_non_empty FLOORPLAN_DEF] } { {*}[env_var_or_empty GLOBAL_PLACEMENT_ARGS] } -write_db $::env(RESULTS_DIR)/3_1_place_gp_skip_io.odb +orfs_write_db $::env(RESULTS_DIR)/3_1_place_gp_skip_io.odb diff --git a/flow/scripts/global_route.tcl b/flow/scripts/global_route.tcl index 7d24fcdbc2..6970b759ab 100644 --- a/flow/scripts/global_route.tcl +++ b/flow/scripts/global_route.tcl @@ -29,11 +29,11 @@ proc global_route_helper { } { if { $result != 0 } { if { !$::env(GENERATE_ARTIFACTS_ON_FAILURE) } { - write_db $::env(RESULTS_DIR)/5_1_grt-failed.odb + orfs_write_db $::env(RESULTS_DIR)/5_1_grt-failed.odb error $errMsg } - write_sdc -no_timestamp $::env(RESULTS_DIR)/5_1_grt.sdc - write_db $::env(RESULTS_DIR)/5_1_grt.odb + orfs_write_sdc $::env(RESULTS_DIR)/5_1_grt.sdc + orfs_write_db $::env(RESULTS_DIR)/5_1_grt.odb return } @@ -113,8 +113,8 @@ proc global_route_helper { } { source [file join $::env(SCRIPTS_DIR) "write_ref_sdc.tcl"] write_guides $::env(RESULTS_DIR)/route.guide - write_db $::env(RESULTS_DIR)/5_1_grt.odb - write_sdc -no_timestamp $::env(RESULTS_DIR)/5_1_grt.sdc + orfs_write_db $::env(RESULTS_DIR)/5_1_grt.odb + orfs_write_sdc $::env(RESULTS_DIR)/5_1_grt.sdc } global_route_helper diff --git a/flow/scripts/io_placement.tcl b/flow/scripts/io_placement.tcl index e4f61e0983..0ec25dc545 100644 --- a/flow/scripts/io_placement.tcl +++ b/flow/scripts/io_placement.tcl @@ -11,7 +11,7 @@ if { -hor_layers $::env(IO_PLACER_H) \ -ver_layers $::env(IO_PLACER_V) \ {*}[env_var_or_empty PLACE_PINS_ARGS] - write_db $::env(RESULTS_DIR)/3_2_place_iop.odb + orfs_write_db $::env(RESULTS_DIR)/3_2_place_iop.odb write_pin_placement $::env(RESULTS_DIR)/3_2_place_iop.tcl } else { log_cmd exec cp $::env(RESULTS_DIR)/3_1_place_gp_skip_io.odb $::env(RESULTS_DIR)/3_2_place_iop.odb diff --git a/flow/scripts/macro_place.tcl b/flow/scripts/macro_place.tcl index cc0f7706c6..302dd7b9c7 100644 --- a/flow/scripts/macro_place.tcl +++ b/flow/scripts/macro_place.tcl @@ -4,5 +4,5 @@ load_design 2_1_floorplan.odb 2_1_floorplan.sdc source $::env(SCRIPTS_DIR)/macro_place_util.tcl -write_db $::env(RESULTS_DIR)/2_2_floorplan_macro.odb +orfs_write_db $::env(RESULTS_DIR)/2_2_floorplan_macro.odb write_macro_placement $::env(RESULTS_DIR)/2_2_floorplan_macro.tcl diff --git a/flow/scripts/pdn.tcl b/flow/scripts/pdn.tcl index 72d2c55c14..977fe71f1e 100644 --- a/flow/scripts/pdn.tcl +++ b/flow/scripts/pdn.tcl @@ -18,4 +18,4 @@ foreach net [$block getNets] { } } -write_db $::env(RESULTS_DIR)/2_4_floorplan_pdn.odb +orfs_write_db $::env(RESULTS_DIR)/2_4_floorplan_pdn.odb diff --git a/flow/scripts/repair_timing_post_place.tcl b/flow/scripts/repair_timing_post_place.tcl index a74b8c2b1a..53ce035ab3 100644 --- a/flow/scripts/repair_timing_post_place.tcl +++ b/flow/scripts/repair_timing_post_place.tcl @@ -18,4 +18,4 @@ puts "Estimate parasitics" estimate_parasitics -placement report_metrics 3 "place repair timing" true false -write_db $::env(RESULTS_DIR)/3_6_place_repair_timing.odb +orfs_write_db $::env(RESULTS_DIR)/3_6_place_repair_timing.odb diff --git a/flow/scripts/resize.tcl b/flow/scripts/resize.tcl index 50276a85ec..832855578c 100644 --- a/flow/scripts/resize.tcl +++ b/flow/scripts/resize.tcl @@ -32,4 +32,4 @@ report_metrics 3 "resizer" true false puts "Instance count before $instance_count_before, after [sta::network_leaf_instance_count]" puts "Pin count before $pin_count_before, after [sta::network_leaf_pin_count]" -write_db $::env(RESULTS_DIR)/3_4_place_resized.odb +orfs_write_db $::env(RESULTS_DIR)/3_4_place_resized.odb diff --git a/flow/scripts/synth_odb.tcl b/flow/scripts/synth_odb.tcl index 29553f6cf9..ad56b542e8 100644 --- a/flow/scripts/synth_odb.tcl +++ b/flow/scripts/synth_odb.tcl @@ -3,9 +3,9 @@ source $::env(SCRIPTS_DIR)/load.tcl erase_non_stage_variables synth load_design 1_2_yosys.v 1_2_yosys.sdc -write_db $::env(RESULTS_DIR)/1_synth.odb +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, # which are read in here and a canonicalized version is written # out by OpenSTA that has no dependencies. -write_sdc -no_timestamp $::env(RESULTS_DIR)/1_synth.sdc +orfs_write_sdc $::env(RESULTS_DIR)/1_synth.sdc diff --git a/flow/scripts/tapcell.tcl b/flow/scripts/tapcell.tcl index eb00d11e23..cbd4ede9fc 100644 --- a/flow/scripts/tapcell.tcl +++ b/flow/scripts/tapcell.tcl @@ -9,4 +9,4 @@ if { [env_var_exists_and_non_empty TAPCELL_TCL] } { cut_rows } -write_db $::env(RESULTS_DIR)/2_3_floorplan_tapcell.odb +orfs_write_db $::env(RESULTS_DIR)/2_3_floorplan_tapcell.odb diff --git a/flow/scripts/util.tcl b/flow/scripts/util.tcl index 243e3b7d41..c06e942d6d 100644 --- a/flow/scripts/util.tcl +++ b/flow/scripts/util.tcl @@ -145,7 +145,7 @@ proc find_macros { } { } proc erase_non_stage_variables { stage_name } { - if { [info exists ::env(KEEP_VARS)] && $::env(KEEP_VARS) == 1 } { + if { $::env(KEEP_VARS) } { return } # "$::env(SCRIPTS_DIR)/stage_variables.py stage_name" returns list of @@ -241,3 +241,17 @@ proc find_physical_only_masters { } { } return $physical_only_masters } + +proc orfs_write_db { output_file } { + if { !$::env(WRITE_ODB_AND_SDC_EACH_STAGE) } { + return + } + log_cmd write_db $output_file +} + +proc orfs_write_sdc { output_file } { + if { !$::env(WRITE_ODB_AND_SDC_EACH_STAGE) } { + return + } + log_cmd write_sdc -no_timestamp $output_file +} diff --git a/flow/scripts/variables.yaml b/flow/scripts/variables.yaml index fe50e320f2..27bba8e9f7 100644 --- a/flow/scripts/variables.yaml +++ b/flow/scripts/variables.yaml @@ -1237,5 +1237,13 @@ KEEP_VARS: Feature toggle to keep intermediate variables during the flow. This is useful for the single-run flow, where all stages of the flow are run in a single OpenROAD instance. + default: 0 stages: - All stages +WRITE_ODB_AND_SDC_EACH_STAGE: + description: > + Save out .sdc and .odb file after each stage, useful to disable + when using a single OpenROAD instance to run all stages of the flow. + stages: + - All stages + default: 1