Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions src/mpl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ rtl_macro_placer
[-max_num_level max_num_level]
[-coarsening_ratio coarsening_ratio]
[-large_net_threshold large_net_threshold]
[-halo_width halo_width]
[-halo_width halo_width]
[-halo_height halo_height]
[-fence_lx fence_lx]
[-fence_ly fence_ly]
Expand Down Expand Up @@ -57,7 +57,8 @@ rtl_macro_placer
| `-max_num_level` | Maximum depth of physical hierarchical tree. The default value is `2`, and the allowed values are integers `[0, MAX_INT]`. |
| `-coarsening_ratio` | The larger the coarsening_ratio, the faster the convergence process. The allowed values are floats, and the default value is `10.0`. |
| `-large_net_threshold` | Ignore nets with many connections during clustering, such as global nets. The default value is `50`, and the allowed values are integers `[0, MAX_INT]`. |
| `-halo_width` | Horizontal/vertical halo around macros (microns). The allowed values are floats, and the default value is `0.0`. |
| `-halo_width` | **Deprecated: use `set_macro_default_halo` instead.** Horizontal halo around macros (microns). The default value is `0.0`. |
| `-halo_height` | **Deprecated: use `set_macro_default_halo` instead.** Vertical halo around macros (microns). The default value is `0.0`. |
| `-fence_lx`, `-fence_ly`, `-fence_ux`, `-fence_uy` | Defines the global fence bounding box coordinates. The default values are the core area coordinates). |
| `-target_util` | Specifies the target utilization. The allowed values are floats and the default value is `0.25`. |
| `-min_ar` | Specifies the minimum aspect ratio $a$, or the ratio of its width to height of a `StandardCellCluster` from $[a, \frac{1}{a}]$. The allowed values are floats, and the default value is `0.33`. |
Expand Down Expand Up @@ -122,9 +123,22 @@ set_macro_guidance_region
| `-region` | The lower left corner and upper right corner {lx ly ux uy} of the region in microns. |


### Set Macro Default Halo

Command for setting the default halo around all macros. Per-macro halos set with `set_macro_halo` take precedence.

```tcl
set_macro_default_halo left bottom right top
set_macro_default_halo width height
```

#### Arguments

The left, bottom, right and top halo, or the width (sets both left and right) and height (sets both bottom and top), in microns.

### Set Macro Halo

Command for setting a halo for specific macros. If unset, the macro will use the default values specified in MACRO_PLACE_HALO.
Command for setting a halo for specific macros. If unset, the macro will use the default halo.

```tcl
set_macro_halo
Expand Down
3 changes: 1 addition & 2 deletions src/mpl/include/mpl/rtl_mp.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ class MacroPlacer
int max_num_level,
float coarsening_ratio,
int large_net_threshold,
int halo_width,
int halo_height,
odb::Rect global_fence,
float area_weight,
float outline_weight,
Expand All @@ -76,6 +74,7 @@ class MacroPlacer

void setMacroPlacementFile(const std::string& file_name);
void addGuidanceRegion(odb::dbInst* macro, odb::Rect region);
void setDefaultHalo(int left, int bottom, int right, int top);
void setMacroHalo(odb::dbInst* macro,
int left,
int bottom,
Expand Down
8 changes: 6 additions & 2 deletions src/mpl/src/hier_rtlmp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,13 @@ void HierRTLMP::setGlobalFence(odb::Rect global_fence)
}
}

void HierRTLMP::setDefaultHalo(int halo_width, int halo_height)
void HierRTLMP::setDefaultHalo(int left, int bottom, int right, int top)
{
default_halo_ = {halo_width, halo_height, halo_width, halo_height};
if (!default_halo_.isZero()) {
logger_->warn(MPL, 71, "Overwriting default macro halo.");
}

default_halo_ = {left, bottom, right, top};
}

void HierRTLMP::setGuidanceRegions(
Expand Down
2 changes: 1 addition & 1 deletion src/mpl/src/hier_rtlmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class HierRTLMP
// Interfaces functions for setting options
// Hierarchical Macro Placement Related Options
void setGlobalFence(odb::Rect global_fence);
void setDefaultHalo(int halo_width, int halo_height);
void setDefaultHalo(int left, int bottom, int right, int top);
void setGuidanceRegions(
const std::map<odb::dbInst*, odb::Rect>& guidance_regions);
void setMacroHalo(odb::dbInst* macro,
Expand Down
21 changes: 15 additions & 6 deletions src/mpl/src/mpl.i
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ bool rtl_macro_placer_cmd(const int max_num_macro,
const int max_num_level,
const float coarsening_ratio,
const int large_net_threshold,
const float halo_width,
const float halo_height,
const float fence_lx,
const float fence_ly,
const float fence_ux,
Expand Down Expand Up @@ -69,8 +67,6 @@ bool rtl_macro_placer_cmd(const int max_num_macro,
max_num_level,
coarsening_ratio,
large_net_threshold,
block->micronsToDbu(halo_width),
block->micronsToDbu(halo_height),
global_fence,
area_weight,
outline_weight,
Expand Down Expand Up @@ -136,8 +132,21 @@ add_guidance_region(odb::dbInst* macro,
}

void
set_macro_halo(odb::dbInst* macro,
float left,
set_default_halo(float left,
float bottom,
float right,
float top)
{
odb::dbBlock* block = ord::OpenRoad::openRoad()->getDb()->getChip()->getBlock();
getMacroPlacer()->setDefaultHalo(block->micronsToDbu(left),
block->micronsToDbu(bottom),
block->micronsToDbu(right),
block->micronsToDbu(top));
}

void
set_macro_halo(odb::dbInst* macro,
float left,
float bottom,
float right,
float top)
Expand Down
58 changes: 42 additions & 16 deletions src/mpl/src/mpl.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ proc rtl_macro_placer { args } {
set max_num_level 2
set coarsening_ratio 10.0
set large_net_threshold 50
set halo_width 0.0
set halo_height 0.0
set fence_lx 0.0
set fence_ly 0.0
set fence_ux 0.0
Expand Down Expand Up @@ -109,15 +107,25 @@ proc rtl_macro_placer { args } {
set large_net_threshold $keys(-large_net_threshold)
}

if { [info exists keys(-halo_width)] && [info exists keys(-halo_height)] } {
set halo_width $keys(-halo_width)
set halo_height $keys(-halo_height)
} elseif { [info exists keys(-halo_width)] } {
set halo_width $keys(-halo_width)
set halo_height $keys(-halo_width)
} elseif { [info exists keys(-halo_height)] } {
set halo_width $keys(-halo_height)
set halo_height $keys(-halo_height)
if { [info exists keys(-halo_width)] || [info exists keys(-halo_height)] } {
utl::warn MPL 74 "-halo_width/-halo_height are deprecated, use\
the set_macro_default_halo command instead."
set halo_width 0.0
set halo_height 0.0

if { [info exists keys(-halo_width)] } {
set halo_width $keys(-halo_width)
set halo_height $halo_width
}

if { [info exists keys(-halo_height)] } {
set halo_height $keys(-halo_height)
if { ![info exists keys(-halo_width)] } {
set halo_width $halo_height
}
}

mpl::set_default_halo $halo_width $halo_height $halo_width $halo_height
}

if { [info exists keys(-fence_lx)] } {
Expand Down Expand Up @@ -191,8 +199,6 @@ proc rtl_macro_placer { args } {
$max_num_level \
$coarsening_ratio \
$large_net_threshold \
$halo_width \
$halo_height \
$fence_lx $fence_ly $fence_ux $fence_uy \
$area_weight $outline_weight $wirelength_weight \
$guidance_weight $fence_weight $boundary_weight \
Expand Down Expand Up @@ -292,6 +298,15 @@ proc set_macro_guidance_region { args } {
mpl::add_guidance_region $macro $x1 $y1 $x2 $y2
}

sta::define_cmd_args "set_macro_default_halo" { halo }
Comment thread
AcKoucher marked this conversation as resolved.
proc set_macro_default_halo { args } {
sta::parse_key_args "set_macro_default_halo" args \
keys {} flags {}

lassign [mpl::parse_halo $args] left bottom right top
mpl::set_default_halo $left $bottom $right $top
}

sta::define_cmd_args "set_macro_halo" { -macro_name macro_name \
-halo halo }
proc set_macro_halo { args } {
Expand All @@ -314,10 +329,16 @@ proc set_macro_halo { args } {
utl::error MPL 38 "-halo is required."
}

lassign [mpl::parse_halo $halo] left bottom right top
mpl::set_macro_halo $macro $left $bottom $right $top
}

namespace eval mpl {
proc parse_halo { halo } {
set length [llength $halo]

if { $length != 2 && $length != 4 } {
utl::error MPL 54 "-halo must be a list of 2 or 4 values."
utl::error MPL 72 "Halo must have 2 or 4 values."
}

if { $length == 2 } {
Expand All @@ -330,10 +351,15 @@ proc set_macro_halo { args } {
lassign $halo left bottom right top
}

mpl::set_macro_halo $macro $left $bottom $right $top
foreach value [list $left $bottom $right $top] {
if { $value < 0 } {
utl::error MPL 73 "Halo values must be non-negative."
}
}

return [list $left $bottom $right $top]
}

namespace eval mpl {
proc parse_macro_name { cmd macro_name } {
set block [ord::get_db_block]
set inst [$block findInst "$macro_name"]
Expand Down
5 changes: 5 additions & 0 deletions src/mpl/src/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,11 @@ class HardMacro
right = halo->xMax();
top = halo->yMax();
}

bool isZero() const
{
return left == 0 && bottom == 0 && right == 0 && top == 0;
}
};

HardMacro(const odb::Point& location,
Expand Down
8 changes: 5 additions & 3 deletions src/mpl/src/rtl_mp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ bool MacroPlacer::place(const int num_threads,
const int max_num_level,
const float coarsening_ratio,
const int large_net_threshold,
const int halo_width,
const int halo_height,
const odb::Rect global_fence,
const float area_weight,
const float outline_weight,
Expand All @@ -65,7 +63,6 @@ bool MacroPlacer::place(const int num_threads,
hier_rtlmp_->setMaxNumLevel(max_num_level);
hier_rtlmp_->setClusterSizeRatioPerLevel(coarsening_ratio);
hier_rtlmp_->setLargeNetThreshold(large_net_threshold);
hier_rtlmp_->setDefaultHalo(halo_width, halo_height);
hier_rtlmp_->setGlobalFence(global_fence);
hier_rtlmp_->setAreaWeight(area_weight);
hier_rtlmp_->setOutlineWeight(outline_weight);
Expand Down Expand Up @@ -217,6 +214,11 @@ void MacroPlacer::addGuidanceRegion(odb::dbInst* macro, odb::Rect region)
guidance_regions_[macro] = region;
}

void MacroPlacer::setDefaultHalo(int left, int bottom, int right, int top)
{
hier_rtlmp_->setDefaultHalo(left, bottom, right, top);
}

void MacroPlacer::setMacroHalo(odb::dbInst* macro,
int left,
int bottom,
Expand Down
10 changes: 10 additions & 0 deletions src/mpl/test/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ COMPULSORY_TESTS = [
"guides2",
"halos1",
"halos2",
"halos3",
"halos4",
"io_constraints1",
"io_constraints10",
"io_constraints2",
Expand Down Expand Up @@ -119,6 +121,14 @@ filegroup(
"testcases/halos1.def",
"testcases/orientation_improve1.lef",
],
"halos3": [
"testcases/halo3.def",
"testcases/orientation_improve1.lef",
],
"halos4": [
"testcases/halo3.def",
"testcases/orientation_improve1.lef",
],
"io_constraints1": [
"testcases/io_constraints1.def",
"testcases/macro_only.lef",
Expand Down
2 changes: 2 additions & 0 deletions src/mpl/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ or_integration_tests(
placement_blockages1
halos1
halos2
halos3
halos4
)


Expand Down
16 changes: 8 additions & 8 deletions src/mpl/test/boundary_push1.defok
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@ TRACKS Y 140 DO 282 STEP 3200 LAYER metal9 ;
TRACKS X 190 DO 282 STEP 3200 LAYER metal10 ;
TRACKS Y 140 DO 282 STEP 3200 LAYER metal10 ;
COMPONENTS 4 ;
- MACRO_1 HM_100x100_1x1 + FIXED ( 239440 241970 ) S ;
- MACRO_2 HM_100x100_1x1 + FIXED ( 239440 610 ) S ;
- MACRO_3 HM_100x100_1x1 + FIXED ( 600 610 ) S ;
- MACRO_4 HM_100x100_1x1 + FIXED ( 600 241970 ) S ;
- MACRO_1 HM_100x100_1x1 + FIXED ( 240040 242530 ) S ;
- MACRO_2 HM_100x100_1x1 + FIXED ( 240040 50 ) S ;
- MACRO_3 HM_100x100_1x1 + FIXED ( 0 50 ) S ;
- MACRO_4 HM_100x100_1x1 + FIXED ( 0 242530 ) S ;
END COMPONENTS
PINS 4 ;
- io_1 + NET io_1 + DIRECTION INPUT + USE SIGNAL ;
Expand All @@ -195,10 +195,10 @@ PINS 4 ;
- io_4 + NET io_4 + DIRECTION INPUT + USE SIGNAL ;
END PINS
BLOCKAGES 4 ;
- PLACEMENT + SOFT + COMPONENT MACRO_3 RECT ( 0 10 ) ( 201200 201210 ) ;
- PLACEMENT + SOFT + COMPONENT MACRO_4 RECT ( 0 241370 ) ( 201200 442570 ) ;
- PLACEMENT + SOFT + COMPONENT MACRO_2 RECT ( 238840 10 ) ( 440040 201210 ) ;
- PLACEMENT + SOFT + COMPONENT MACRO_1 RECT ( 238840 241370 ) ( 440040 442570 ) ;
- PLACEMENT + SOFT + COMPONENT MACRO_3 RECT ( 0 50 ) ( 200000 200050 ) ;
- PLACEMENT + SOFT + COMPONENT MACRO_4 RECT ( 0 242530 ) ( 200000 442530 ) ;
- PLACEMENT + SOFT + COMPONENT MACRO_2 RECT ( 240040 50 ) ( 440040 200050 ) ;
- PLACEMENT + SOFT + COMPONENT MACRO_1 RECT ( 240040 242530 ) ( 440040 442530 ) ;
END BLOCKAGES
NETS 4 ;
- io_1 ( PIN io_1 ) + USE SIGNAL ;
Expand Down
4 changes: 2 additions & 2 deletions src/mpl/test/boundary_push1.ok
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ Die Area: (0.00, 0.00) (220.02, 221.20), Floorplan Area: (0.00, 0.00) (220.02,
Area of std cell instances: 0.00
Number of macros: 4
Area of macros: 40000.00
Default halo (L, B, R, T): (0.30, 0.30, 0.30, 0.30)
Area of macros with halos: 40481.44
Default halo (L, B, R, T): (0.00, 0.00, 0.00, 0.00)
Area of macros with halos: 40000.00
Area of std cell instances + Area of macros: 40000.00
Floorplan area: 48668.42
Design Utilization: 0.82
Expand Down
2 changes: 1 addition & 1 deletion src/mpl/test/boundary_push1.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ read_lef "./testcases/orientation_improve1.lef"
read_def "./testcases/boundary_push1.def"

set_thread_count 0
rtl_macro_placer -boundary_weight 0 -report_directory [make_result_dir] -halo_width 0.3
rtl_macro_placer -boundary_weight 0 -report_directory [make_result_dir]

set def_file [make_result_file boundary_push1.def]
write_def $def_file
Expand Down
2 changes: 1 addition & 1 deletion src/mpl/test/centralization1.defok
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ PINS 1 ;
- io_1 + NET io_1 + DIRECTION INPUT + USE SIGNAL ;
END PINS
BLOCKAGES 1 ;
- PLACEMENT + SOFT + COMPONENT MACRO_1 RECT ( 201500 201890 ) ( 402700 403090 ) ;
- PLACEMENT + SOFT + COMPONENT MACRO_1 RECT ( 202100 202490 ) ( 402100 402490 ) ;
END BLOCKAGES
NETS 1 ;
- io_1 ( PIN io_1 ) + USE SIGNAL ;
Expand Down
4 changes: 2 additions & 2 deletions src/mpl/test/centralization1.ok
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ Die Area: (0.00, 0.00) (302.10, 301.00), Floorplan Area: (0.00, 0.00) (302.10,
Area of std cell instances: 0.00
Number of macros: 1
Area of macros: 10000.00
Default halo (L, B, R, T): (0.30, 0.30, 0.30, 0.30)
Area of macros with halos: 10120.36
Default halo (L, B, R, T): (0.00, 0.00, 0.00, 0.00)
Area of macros with halos: 10000.00
Area of std cell instances + Area of macros: 10000.00
Floorplan area: 91355.04
Design Utilization: 0.11
Expand Down
2 changes: 1 addition & 1 deletion src/mpl/test/centralization1.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ read_lef "./testcases/orientation_improve1.lef"
read_def "./testcases/centralization1.def"

set_thread_count 0
rtl_macro_placer -boundary_weight 0 -report_directory [make_result_dir] -halo_width 0.3
rtl_macro_placer -boundary_weight 0 -report_directory [make_result_dir]

set def_file [make_result_file centralization1.def]
write_def $def_file
Expand Down
4 changes: 2 additions & 2 deletions src/mpl/test/clocked_macro.defok
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,10 @@ TRACKS Y 140 DO 282 STEP 3200 LAYER metal9 ;
TRACKS X 190 DO 282 STEP 3200 LAYER metal10 ;
TRACKS Y 140 DO 282 STEP 3200 LAYER metal10 ;
COMPONENTS 1 ;
- U1 CLOCKED_MACRO + FIXED ( 17880 16610 ) S ;
- U1 CLOCKED_MACRO + FIXED ( 9880 8490 ) S ;
END COMPONENTS
BLOCKAGES 1 ;
- PLACEMENT + SOFT + COMPONENT U1 RECT ( 9880 8610 ) ( 225880 884610 ) ;
- PLACEMENT + SOFT + COMPONENT U1 RECT ( 9880 8490 ) ( 209880 868490 ) ;
END BLOCKAGES
NETS 3 ;
- clk ( U1 CK ) + USE SIGNAL ;
Expand Down
Loading
Loading