Skip to content

Commit

Permalink
cleanup: introduce place_density_with_lb_addon proc
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
oharboe committed Oct 30, 2024
1 parent 0944a64 commit 12966fa
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 27 deletions.
8 changes: 3 additions & 5 deletions flow/scripts/global_place.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]
Expand All @@ -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
Expand Down
16 changes: 8 additions & 8 deletions flow/scripts/global_place_skip_io.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down
3 changes: 1 addition & 2 deletions flow/scripts/macro_place_util.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 0 additions & 12 deletions flow/scripts/set_place_density.tcl

This file was deleted.

16 changes: 16 additions & 0 deletions flow/scripts/util.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 12966fa

Please sign in to comment.