From 12966fa951807791efc22957d0802b6723196594 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Harboe?= Date: Wed, 30 Oct 2024 18:41:33 +0100 Subject: [PATCH] cleanup: introduce place_density_with_lb_addon proc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit this replaces unique pattern where a file is sourced and it acts more or less as a proc, setting a variable. Made logging a bit more consistent, added it for global_placement invocation in global_place_skip_io. This makes it evident in the code that place_density_with_lb_addon is logged as soon as it is calculated. Signed-off-by: Øyvind Harboe --- flow/scripts/global_place.tcl | 8 +++----- flow/scripts/global_place_skip_io.tcl | 16 ++++++++-------- flow/scripts/macro_place_util.tcl | 3 +-- flow/scripts/set_place_density.tcl | 12 ------------ flow/scripts/util.tcl | 16 ++++++++++++++++ 5 files changed, 28 insertions(+), 27 deletions(-) delete mode 100644 flow/scripts/set_place_density.tcl diff --git a/flow/scripts/global_place.tcl b/flow/scripts/global_place.tcl index 6b0f25486a..391e123181 100644 --- a/flow/scripts/global_place.tcl +++ b/flow/scripts/global_place.tcl @@ -7,8 +7,6 @@ set_dont_use $::env(DONT_USE_CELLS) fast_route -source $::env(SCRIPTS_DIR)/set_place_density.tcl - set global_placement_args {} # Parameters for routability mode in global placement @@ -21,8 +19,8 @@ if {$::env(GPL_TIMING_DRIVEN)} { lappend global_placement_args {-timing_driven} } -proc do_placement {place_density global_placement_args} { - set all_args [concat [list -density $place_density \ +proc do_placement {global_placement_args} { + set all_args [concat [list -density [place_density_with_lb_addon] \ -pad_left $::env(CELL_PAD_IN_SITES_GLOBAL_PLACEMENT) \ -pad_right $::env(CELL_PAD_IN_SITES_GLOBAL_PLACEMENT)] \ $global_placement_args] @@ -34,7 +32,7 @@ proc do_placement {place_density global_placement_args} { log_cmd global_placement {*}$all_args } -set result [catch {do_placement $place_density $global_placement_args} errMsg] +set result [catch {do_placement $global_placement_args} errMsg] if {$result != 0} { write_db $::env(RESULTS_DIR)/3_3_place_gp-failed.odb error $errMsg diff --git a/flow/scripts/global_place_skip_io.tcl b/flow/scripts/global_place_skip_io.tcl index e0e1f448f0..b9ca0c51c4 100644 --- a/flow/scripts/global_place_skip_io.tcl +++ b/flow/scripts/global_place_skip_io.tcl @@ -6,17 +6,17 @@ load_design 2_floorplan.odb 2_floorplan.sdc if { [env_var_exists_and_non_empty FLOORPLAN_DEF] } { puts "FLOORPLAN_DEF is set. Skipping global placement without IOs" } else { - source $::env(SCRIPTS_DIR)/set_place_density.tcl + set place_density [place_density_with_lb_addon] if { 0 != [llength [array get ::env GLOBAL_PLACEMENT_ARGS]] } { - global_placement -skip_io -density $place_density \ - -pad_left $::env(CELL_PAD_IN_SITES_GLOBAL_PLACEMENT) \ - -pad_right $::env(CELL_PAD_IN_SITES_GLOBAL_PLACEMENT) \ - {*}$::env(GLOBAL_PLACEMENT_ARGS) + log_cmd global_placement -skip_io -density $place_density \ + -pad_left $::env(CELL_PAD_IN_SITES_GLOBAL_PLACEMENT) \ + -pad_right $::env(CELL_PAD_IN_SITES_GLOBAL_PLACEMENT) \ + {*}$::env(GLOBAL_PLACEMENT_ARGS) } else { - global_placement -skip_io -density $place_density \ - -pad_left $::env(CELL_PAD_IN_SITES_GLOBAL_PLACEMENT) \ - -pad_right $::env(CELL_PAD_IN_SITES_GLOBAL_PLACEMENT) + log_cmd global_placement -skip_io -density $place_density \ + -pad_left $::env(CELL_PAD_IN_SITES_GLOBAL_PLACEMENT) \ + -pad_right $::env(CELL_PAD_IN_SITES_GLOBAL_PLACEMENT) } } diff --git a/flow/scripts/macro_place_util.tcl b/flow/scripts/macro_place_util.tcl index b40e5e216f..27d3f61f15 100644 --- a/flow/scripts/macro_place_util.tcl +++ b/flow/scripts/macro_place_util.tcl @@ -57,8 +57,7 @@ if {[find_macros] != ""} { append_env_var additional_rtlmp_args RTLMP_FENCE_UX -fence_ux 1 append_env_var additional_rtlmp_args RTLMP_FENCE_UY -fence_uy 1 - source $::env(SCRIPTS_DIR)/set_place_density.tcl - append additional_rtlmp_args " -target_util $place_density" + append additional_rtlmp_args " -target_util [place_density_with_lb_addon]" set all_args $additional_rtlmp_args diff --git a/flow/scripts/set_place_density.tcl b/flow/scripts/set_place_density.tcl deleted file mode 100644 index 70417129da..0000000000 --- a/flow/scripts/set_place_density.tcl +++ /dev/null @@ -1,12 +0,0 @@ -# check the lower boundary of the PLACE_DENSITY and add PLACE_DENSITY_LB_ADDON if it exists -if {[info exist ::env(PLACE_DENSITY_LB_ADDON)]} { - set place_density_lb [gpl::get_global_placement_uniform_density \ - -pad_left $::env(CELL_PAD_IN_SITES_GLOBAL_PLACEMENT) \ - -pad_right $::env(CELL_PAD_IN_SITES_GLOBAL_PLACEMENT)] - set place_density [expr $place_density_lb + ((1.0 - $place_density_lb) * $::env(PLACE_DENSITY_LB_ADDON)) + 0.01] - if {$place_density > 1.0} { - utl::error FLW 24 "Place density exceeds 1.0 (current PLACE_DENSITY_LB_ADDON = $::env(PLACE_DENSITY_LB_ADDON)). Please check if the value of PLACE_DENSITY_LB_ADDON is between 0 and 0.99." - } -} else { - set place_density $::env(PLACE_DENSITY) -} diff --git a/flow/scripts/util.tcl b/flow/scripts/util.tcl index ec972778c2..46eda942c0 100644 --- a/flow/scripts/util.tcl +++ b/flow/scripts/util.tcl @@ -136,3 +136,19 @@ proc erase_non_stage_variables {stage_name} { } set global_route_congestion_report $::env(REPORTS_DIR)/congestion.rpt + +proc place_density_with_lb_addon {} { + # check the lower boundary of the PLACE_DENSITY and add PLACE_DENSITY_LB_ADDON if it exists + if {[info exist ::env(PLACE_DENSITY_LB_ADDON)]} { + set place_density_lb [gpl::get_global_placement_uniform_density \ + -pad_left $::env(CELL_PAD_IN_SITES_GLOBAL_PLACEMENT) \ + -pad_right $::env(CELL_PAD_IN_SITES_GLOBAL_PLACEMENT)] + set place_density [expr $place_density_lb + ((1.0 - $place_density_lb) * $::env(PLACE_DENSITY_LB_ADDON)) + 0.01] + if {$place_density > 1.0} { + utl::error FLW 24 "Place density exceeds 1.0 (current PLACE_DENSITY_LB_ADDON = $::env(PLACE_DENSITY_LB_ADDON)). Please check if the value of PLACE_DENSITY_LB_ADDON is between 0 and 0.99." + } + } else { + set place_density $::env(PLACE_DENSITY) + } + return $place_density +}