Skip to content

Commit

Permalink
Merge pull request #2344 from Pinata-Consulting/floorplan-less-rules-…
Browse files Browse the repository at this point in the history
…and-surprises

floorplan: replace surprises and documentation with actionable error messages
  • Loading branch information
maliberty authored Sep 13, 2024
2 parents 2352dc9 + 6be3f39 commit 7643295
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 44 deletions.
12 changes: 7 additions & 5 deletions docs/user/FlowVariables.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,16 +265,18 @@ 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. |
| `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` 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


Expand Down
3 changes: 3 additions & 0 deletions flow/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
87 changes: 48 additions & 39 deletions flow/scripts/floorplan.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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: Floorplan initialization methods are mutually exclusive, pick one."
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)] } {
Expand All @@ -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
Expand Down

0 comments on commit 7643295

Please sign in to comment.