From 799cf4b4fb5b8621e9aba872ac448561121a62ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Harboe?= Date: Thu, 12 Sep 2024 07:14:45 +0200 Subject: [PATCH 1/3] floorplan: replace surprises and documentation with actionable error messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I've been surprised several times by CORE_UTILIZATION overriding DIE/CORE_AREA. Remove documentation/rules and replace it with checks and actionable error messages. Signed-off-by: Øyvind Harboe --- docs/user/FlowVariables.md | 10 ++--- flow/Makefile | 3 ++ flow/scripts/floorplan.tcl | 87 +++++++++++++++++++++----------------- 3 files changed, 56 insertions(+), 44 deletions(-) diff --git a/docs/user/FlowVariables.md b/docs/user/FlowVariables.md index 9801242cd3..b220f026ba 100644 --- a/docs/user/FlowVariables.md +++ b/docs/user/FlowVariables.md @@ -264,11 +264,11 @@ configuration file. | Variable | Description | |-----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `CORE_UTILIZATION` | The core utilization percentage (0-100). Overrides `DIE_AREA` and `CORE_AREA`. | -| `CORE_ASPECT_RATIO` | The core aspect ratio (height / width). This values is ignored if `CORE_UTILIZATION` undefined. | -| `CORE_MARGIN` | The margin between the core area and die area, in multiples of SITE heights. The margin is applied to each side. This variable is ignored if `CORE_UTILIZATION` is undefined. | -| `DIE_AREA` | The die area specified as a list of lower-left and upper-right corners in microns (X1 Y1 X2 Y2). This variable is ignored if `CORE_UTILIZATION` and `CORE_ASPECT_RATIO` are defined. | -| `CORE_AREA` | The core area specified as a list of lower-left and upper-right corners in microns (X1 Y1 X2 Y2). This variable is ignored if `CORE_UTILIZATION` and `CORE_ASPECT_RATIO` are defined. | +| `CORE_UTILIZATION` | The core utilization percentage (0-100). | +| `CORE_ASPECT_RATIO` | The core aspect ratio (height / width). This values is ignored if `CORE_UTILIZATION` undefined. | +| `CORE_MARGIN` | The margin between the core area and die area, in multiples of SITE heights. The margin is applied to each side. This variable is ignored if `CORE_UTILIZATION` is undefined. | +| `DIE_AREA` | The die area specified as a list of lower-left and upper-right corners in microns (X1 Y1 X2 Y2). | +| `CORE_AREA` | The core area specified as a list of lower-left and upper-right corners in microns (X1 Y1 X2 Y2). | | `RESYNTH_AREA_RECOVER` | Enable re-synthesis for area reclaim. | | `RESYNTH_TIMING_RECOVER` | Enable re-synthesis for timing optimization. | | `MACRO_HALO_X` | Set macro halo for x-direction. Only available for ASAP7 PDK. | diff --git a/flow/Makefile b/flow/Makefile index 2a6452b82e..8c5856bd0c 100644 --- a/flow/Makefile +++ b/flow/Makefile @@ -145,6 +145,9 @@ export RECOVER_POWER ?= 0 export SKIP_INCREMENTAL_REPAIR ?= 0 export DETAILED_METRICS ?= 0 export EQUIVALENCE_CHECK ?= 0 +export CORE_UTILIZATION ?= +export DIE_AREA ?= +export CORE_AREA ?= # If we are running headless use offscreen rendering for save_image ifndef DISPLAY diff --git a/flow/scripts/floorplan.tcl b/flow/scripts/floorplan.tcl index 2b235655dc..89725a2aa3 100644 --- a/flow/scripts/floorplan.tcl +++ b/flow/scripts/floorplan.tcl @@ -44,48 +44,57 @@ if { [info exists ::env(ADDITIONAL_SITES)]} { append additional_args " -additional_sites $::env(ADDITIONAL_SITES)" } -# Initialize floorplan by reading in floorplan DEF -# --------------------------------------------------------------------------- -if {[info exists ::env(FLOORPLAN_DEF)]} { - puts "Read in Floorplan DEF to initialize floorplan: $env(FLOORPLAN_DEF)" - read_def -floorplan_initialize $env(FLOORPLAN_DEF) -# Initialize floorplan using ICeWall FOOTPRINT -# ---------------------------------------------------------------------------- -} elseif {[info exists ::env(FOOTPRINT)]} { - - ICeWall load_footprint $env(FOOTPRINT) +proc env_var_exists_and_non_empty {env_var} { + return [expr {[info exists ::env($env_var)] && ![string equal $::env($env_var) ""]}] +} - initialize_floorplan \ - -die_area [ICeWall get_die_area] \ - -core_area [ICeWall get_core_area] \ - -site $::env(PLACE_SITE) +set use_floorplan_def [env_var_exists_and_non_empty FLOORPLAN_DEF] +set use_footprint [env_var_exists_and_non_empty FOOTPRINT] +set use_die_and_core_area [expr {[env_var_exists_and_non_empty DIE_AREA] && [env_var_exists_and_non_empty CORE_AREA]}] +set use_core_utilization [env_var_exists_and_non_empty CORE_UTILIZATION] - ICeWall init_footprint $env(SIG_MAP_FILE) +set methods_defined [expr {$use_floorplan_def + $use_footprint + $use_die_and_core_area + $use_core_utilization}] +if {$methods_defined > 1} { + puts "ERROR: More than one floorplan initialization method specified" + exit 1 +} -# Initialize floorplan using CORE_UTILIZATION -# ---------------------------------------------------------------------------- -} elseif {[info exists ::env(CORE_UTILIZATION)] && $::env(CORE_UTILIZATION) != "" } { - set aspect_ratio 1.0 - if {[info exists ::env(CORE_ASPECT_RATIO)] && $::env(CORE_ASPECT_RATIO) != ""} { - set aspect_ratio $::env(CORE_ASPECT_RATIO) - } - set core_margin 1.0 - if {[info exists ::env(CORE_MARGIN)] && $::env(CORE_MARGIN) != ""} { - set core_margin $::env(CORE_MARGIN) - } - initialize_floorplan -utilization $::env(CORE_UTILIZATION) \ - -aspect_ratio $aspect_ratio \ - -core_space $core_margin \ - -site $::env(PLACE_SITE) \ - {*}$additional_args - -# Initialize floorplan using DIE_AREA/CORE_AREA -# ---------------------------------------------------------------------------- +if {$use_floorplan_def} { + # Initialize floorplan by reading in floorplan DEF + puts "Read in Floorplan DEF to initialize floorplan: $env(FLOORPLAN_DEF)" + read_def -floorplan_initialize $env(FLOORPLAN_DEF) +} elseif {$use_footprint} { + # Initialize floorplan using ICeWall FOOTPRINT + ICeWall load_footprint $env(FOOTPRINT) + + initialize_floorplan \ + -die_area [ICeWall get_die_area] \ + -core_area [ICeWall get_core_area] \ + -site $::env(PLACE_SITE) + + ICeWall init_footprint $env(SIG_MAP_FILE) +} elseif {$use_die_and_core_area} { + initialize_floorplan -die_area $::env(DIE_AREA) \ + -core_area $::env(CORE_AREA) \ + -site $::env(PLACE_SITE) \ + {*}$additional_args +} elseif {$use_core_utilization} { + set aspect_ratio 1.0 + if {[env_var_exists_and_non_empty "CORE_ASPECT_RATIO"]} { + set aspect_ratio $::env(CORE_ASPECT_RATIO) + } + set core_margin 1.0 + if {[env_var_exists_and_non_empty "CORE_MARGIN"]} { + set core_margin $::env(CORE_MARGIN) + } + initialize_floorplan -utilization $::env(CORE_UTILIZATION) \ + -aspect_ratio $aspect_ratio \ + -core_space $core_margin \ + -site $::env(PLACE_SITE) \ + {*}$additional_args } else { - initialize_floorplan -die_area $::env(DIE_AREA) \ - -core_area $::env(CORE_AREA) \ - -site $::env(PLACE_SITE) \ - {*}$additional_args + puts "ERROR: No floorplan initialization method specified" + exit 1 } if { [info exists ::env(MAKE_TRACKS)] } { @@ -100,8 +109,8 @@ if {[info exists ::env(FOOTPRINT_TCL)]} { source $::env(FOOTPRINT_TCL) } -# remove buffers inserted by yosys/abc if { [info exists ::env(REMOVE_ABC_BUFFERS)] && $::env(REMOVE_ABC_BUFFERS) == 1 } { + # remove buffers inserted by yosys/abc remove_buffers } else { repair_timing_helper 0 From 45c793a6741976d6e70cfa1c7ebc25cf1e535d3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Harboe?= Date: Thu, 12 Sep 2024 16:22:10 +0200 Subject: [PATCH 2/3] floorplan: mutually exclusive floorplan methods, pick one MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Øyvind Harboe --- docs/user/FlowVariables.md | 2 ++ flow/scripts/floorplan.tcl | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/user/FlowVariables.md b/docs/user/FlowVariables.md index b220f026ba..1642410202 100644 --- a/docs/user/FlowVariables.md +++ b/docs/user/FlowVariables.md @@ -274,6 +274,8 @@ configuration file. | `MACRO_HALO_X` | Set macro halo for x-direction. Only available for ASAP7 PDK. | | `MACRO_HALO_Y` | Set macro halo for y-direction. Only available for ASAP7 PDK. | +The various methods to specify the die and core area(`FLOORPLAN_DEF`, `FOOTPRINT`, `DIE_AREA`, `CORE_AREA` and `CORE_UTILIZATION`) are mutually exclusive. If two methods are specified, floorplan.tcl will exit with an error requiring that a single method is used. + #### Placement diff --git a/flow/scripts/floorplan.tcl b/flow/scripts/floorplan.tcl index 89725a2aa3..06412fa75a 100644 --- a/flow/scripts/floorplan.tcl +++ b/flow/scripts/floorplan.tcl @@ -55,7 +55,7 @@ set use_core_utilization [env_var_exists_and_non_empty CORE_UTILIZATION] set methods_defined [expr {$use_floorplan_def + $use_footprint + $use_die_and_core_area + $use_core_utilization}] if {$methods_defined > 1} { - puts "ERROR: More than one floorplan initialization method specified" + puts "ERROR: Floorplan initialization methods are mutually exclusive, pick one." exit 1 } From 6be3f3931d3cd868b153599f616070f454f64dc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Harboe?= Date: Fri, 13 Sep 2024 16:58:53 +0200 Subject: [PATCH 3/3] doc: DIE_AREA is shorthand for a method to specify floorplan MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is an error message if CORE_AREA is not specified together with DIE_AREA, but it is close enough to the truth to say that DIE_AREA is a method to specify floorplan. Signed-off-by: Øyvind Harboe --- docs/user/FlowVariables.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user/FlowVariables.md b/docs/user/FlowVariables.md index f8c6c2a01a..5bea6f0af9 100644 --- a/docs/user/FlowVariables.md +++ b/docs/user/FlowVariables.md @@ -275,7 +275,7 @@ configuration file. | `MACRO_HALO_X` | Set macro halo for x-direction. Only available for ASAP7 PDK. | | `MACRO_HALO_Y` | Set macro halo for y-direction. Only available for ASAP7 PDK. | -The various methods to specify the die and core area(`FLOORPLAN_DEF`, `FOOTPRINT`, `DIE_AREA`, `CORE_AREA` and `CORE_UTILIZATION`) are mutually exclusive. If two methods are specified, floorplan.tcl will exit with an error requiring that a single method is used. +The various methods to specify the die and core area(`FLOORPLAN_DEF`, `FOOTPRINT`, `DIE_AREA` and `CORE_UTILIZATION`) are mutually exclusive. If two methods are specified, floorplan.tcl will exit with an error requiring that a single method is used. #### Placement