Skip to content

Commit 20d3b98

Browse files
committed
mpl: remove -halo arguments and add new command set_macro_default_halo
Signed-off-by: Arthur Koucher <arthurkoucher@precisioninno.com>
1 parent d43d716 commit 20d3b98

104 files changed

Lines changed: 5030 additions & 4287 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/mpl/README.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ rtl_macro_placer
2626
[-max_num_level max_num_level]
2727
[-coarsening_ratio coarsening_ratio]
2828
[-large_net_threshold large_net_threshold]
29-
[-halo_width halo_width]
30-
[-halo_height halo_height]
3129
[-fence_lx fence_lx]
3230
[-fence_ly fence_ly]
3331
[-fence_ux fence_ux]
@@ -57,7 +55,6 @@ rtl_macro_placer
5755
| `-max_num_level` | Maximum depth of physical hierarchical tree. The default value is `2`, and the allowed values are integers `[0, MAX_INT]`. |
5856
| `-coarsening_ratio` | The larger the coarsening_ratio, the faster the convergence process. The allowed values are floats, and the default value is `10.0`. |
5957
| `-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]`. |
60-
| `-halo_width` | Horizontal/vertical halo around macros (microns). The allowed values are floats, and the default value is `0.0`. |
6158
| `-fence_lx`, `-fence_ly`, `-fence_ux`, `-fence_uy` | Defines the global fence bounding box coordinates. The default values are the core area coordinates). |
6259
| `-target_util` | Specifies the target utilization. The allowed values are floats and the default value is `0.25`. |
6360
| `-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`. |
@@ -122,9 +119,22 @@ set_macro_guidance_region
122119
| `-region` | The lower left corner and upper right corner {lx ly ux uy} of the region in microns. |
123120

124121

122+
### Set Macro Default Halo
123+
124+
Command for setting the default halo around all macros. Per-macro halos set with `set_macro_halo` take precedence.
125+
126+
```tcl
127+
set_macro_default_halo left bottom right top
128+
set_macro_default_halo width height
129+
```
130+
131+
#### Arguments
132+
133+
The left, bottom, right and top halo, or the width (sets both left and right) and height (sets both bottom and top), in microns.
134+
125135
### Set Macro Halo
126136

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

129139
```tcl
130140
set_macro_halo

src/mpl/include/mpl/rtl_mp.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ class MacroPlacer
5050
int max_num_level,
5151
float coarsening_ratio,
5252
int large_net_threshold,
53-
int halo_width,
54-
int halo_height,
5553
odb::Rect global_fence,
5654
float area_weight,
5755
float outline_weight,
@@ -76,6 +74,7 @@ class MacroPlacer
7674

7775
void setMacroPlacementFile(const std::string& file_name);
7876
void addGuidanceRegion(odb::dbInst* macro, odb::Rect region);
77+
void setDefaultHalo(int left, int bottom, int right, int top);
7978
void setMacroHalo(odb::dbInst* macro,
8079
int left,
8180
int bottom,

src/mpl/src/hier_rtlmp.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,13 @@ void HierRTLMP::setGlobalFence(odb::Rect global_fence)
111111
}
112112
}
113113

114-
void HierRTLMP::setDefaultHalo(int halo_width, int halo_height)
114+
void HierRTLMP::setDefaultHalo(int left, int bottom, int right, int top)
115115
{
116-
default_halo_ = {halo_width, halo_height, halo_width, halo_height};
116+
if (!default_halo_.isZero()) {
117+
logger_->warn(MPL, 71, "Overwriting default macro halo.");
118+
}
119+
120+
default_halo_ = {left, bottom, right, top};
117121
}
118122

119123
void HierRTLMP::setGuidanceRegions(

src/mpl/src/hier_rtlmp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class HierRTLMP
7676
// Interfaces functions for setting options
7777
// Hierarchical Macro Placement Related Options
7878
void setGlobalFence(odb::Rect global_fence);
79-
void setDefaultHalo(int halo_width, int halo_height);
79+
void setDefaultHalo(int left, int bottom, int right, int top);
8080
void setGuidanceRegions(
8181
const std::map<odb::dbInst*, odb::Rect>& guidance_regions);
8282
void setMacroHalo(odb::dbInst* macro,

src/mpl/src/mpl.i

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ bool rtl_macro_placer_cmd(const int max_num_macro,
3434
const int max_num_level,
3535
const float coarsening_ratio,
3636
const int large_net_threshold,
37-
const float halo_width,
38-
const float halo_height,
3937
const float fence_lx,
4038
const float fence_ly,
4139
const float fence_ux,
@@ -69,8 +67,6 @@ bool rtl_macro_placer_cmd(const int max_num_macro,
6967
max_num_level,
7068
coarsening_ratio,
7169
large_net_threshold,
72-
block->micronsToDbu(halo_width),
73-
block->micronsToDbu(halo_height),
7470
global_fence,
7571
area_weight,
7672
outline_weight,
@@ -136,8 +132,21 @@ add_guidance_region(odb::dbInst* macro,
136132
}
137133

138134
void
139-
set_macro_halo(odb::dbInst* macro,
140-
float left,
135+
set_default_halo(float left,
136+
float bottom,
137+
float right,
138+
float top)
139+
{
140+
odb::dbBlock* block = ord::OpenRoad::openRoad()->getDb()->getChip()->getBlock();
141+
getMacroPlacer()->setDefaultHalo(block->micronsToDbu(left),
142+
block->micronsToDbu(bottom),
143+
block->micronsToDbu(right),
144+
block->micronsToDbu(top));
145+
}
146+
147+
void
148+
set_macro_halo(odb::dbInst* macro,
149+
float left,
141150
float bottom,
142151
float right,
143152
float top)

src/mpl/src/mpl.tcl

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ sta::define_cmd_args "rtl_macro_placer" { -max_num_macro max_num_macro \
99
-max_num_level max_num_level \
1010
-coarsening_ratio coarsening_ratio \
1111
-large_net_threshold large_net_threshold \
12-
-halo_width halo_width \
13-
-halo_height halo_height \
1412
-fence_lx fence_lx \
1513
-fence_ly fence_ly \
1614
-fence_ux fence_ux \
@@ -34,7 +32,6 @@ proc rtl_macro_placer { args } {
3432
sta::parse_key_args "rtl_macro_placer" args \
3533
keys {-max_num_macro -min_num_macro -max_num_inst -min_num_inst -tolerance \
3634
-max_num_level -coarsening_ratio -large_net_threshold \
37-
-halo_width -halo_height \
3835
-fence_lx -fence_ly -fence_ux -fence_uy \
3936
-area_weight -outline_weight -wirelength_weight -guidance_weight -fence_weight \
4037
-boundary_weight -notch_weight \
@@ -63,8 +60,6 @@ proc rtl_macro_placer { args } {
6360
set max_num_level 2
6461
set coarsening_ratio 10.0
6562
set large_net_threshold 50
66-
set halo_width 0.0
67-
set halo_height 0.0
6863
set fence_lx 0.0
6964
set fence_ly 0.0
7065
set fence_ux 0.0
@@ -109,17 +104,6 @@ proc rtl_macro_placer { args } {
109104
set large_net_threshold $keys(-large_net_threshold)
110105
}
111106

112-
if { [info exists keys(-halo_width)] && [info exists keys(-halo_height)] } {
113-
set halo_width $keys(-halo_width)
114-
set halo_height $keys(-halo_height)
115-
} elseif { [info exists keys(-halo_width)] } {
116-
set halo_width $keys(-halo_width)
117-
set halo_height $keys(-halo_width)
118-
} elseif { [info exists keys(-halo_height)] } {
119-
set halo_width $keys(-halo_height)
120-
set halo_height $keys(-halo_height)
121-
}
122-
123107
if { [info exists keys(-fence_lx)] } {
124108
set fence_lx $keys(-fence_lx)
125109
}
@@ -191,8 +175,6 @@ proc rtl_macro_placer { args } {
191175
$max_num_level \
192176
$coarsening_ratio \
193177
$large_net_threshold \
194-
$halo_width \
195-
$halo_height \
196178
$fence_lx $fence_ly $fence_ux $fence_uy \
197179
$area_weight $outline_weight $wirelength_weight \
198180
$guidance_weight $fence_weight $boundary_weight \
@@ -292,6 +274,15 @@ proc set_macro_guidance_region { args } {
292274
mpl::add_guidance_region $macro $x1 $y1 $x2 $y2
293275
}
294276

277+
sta::define_cmd_args "set_macro_default_halo" { halo }
278+
proc set_macro_default_halo { args } {
279+
sta::parse_key_args "set_macro_default_halo" args \
280+
keys {} flags {}
281+
282+
lassign [mpl::parse_halo $args] left bottom right top
283+
mpl::set_default_halo $left $bottom $right $top
284+
}
285+
295286
sta::define_cmd_args "set_macro_halo" { -macro_name macro_name \
296287
-halo halo }
297288
proc set_macro_halo { args } {
@@ -314,10 +305,16 @@ proc set_macro_halo { args } {
314305
utl::error MPL 38 "-halo is required."
315306
}
316307

308+
lassign [mpl::parse_halo $halo] left bottom right top
309+
mpl::set_macro_halo $macro $left $bottom $right $top
310+
}
311+
312+
namespace eval mpl {
313+
proc parse_halo { halo } {
317314
set length [llength $halo]
318315

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

323320
if { $length == 2 } {
@@ -330,10 +327,15 @@ proc set_macro_halo { args } {
330327
lassign $halo left bottom right top
331328
}
332329

333-
mpl::set_macro_halo $macro $left $bottom $right $top
330+
foreach value [list $left $bottom $right $top] {
331+
if { $value < 0 } {
332+
utl::error MPL 73 "Halo values must be non-negative."
333+
}
334+
}
335+
336+
return [list $left $bottom $right $top]
334337
}
335338

336-
namespace eval mpl {
337339
proc parse_macro_name { cmd macro_name } {
338340
set block [ord::get_db_block]
339341
set inst [$block findInst "$macro_name"]

src/mpl/src/object.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,11 @@ class HardMacro
265265
right = halo->xMax();
266266
top = halo->yMax();
267267
}
268+
269+
bool isZero() const
270+
{
271+
return left == 0 && bottom == 0 && right == 0 && top == 0;
272+
}
268273
};
269274

270275
HardMacro(const odb::Point& location,

src/mpl/src/rtl_mp.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ bool MacroPlacer::place(const int num_threads,
4242
const int max_num_level,
4343
const float coarsening_ratio,
4444
const int large_net_threshold,
45-
const int halo_width,
46-
const int halo_height,
4745
const odb::Rect global_fence,
4846
const float area_weight,
4947
const float outline_weight,
@@ -65,7 +63,6 @@ bool MacroPlacer::place(const int num_threads,
6563
hier_rtlmp_->setMaxNumLevel(max_num_level);
6664
hier_rtlmp_->setClusterSizeRatioPerLevel(coarsening_ratio);
6765
hier_rtlmp_->setLargeNetThreshold(large_net_threshold);
68-
hier_rtlmp_->setDefaultHalo(halo_width, halo_height);
6966
hier_rtlmp_->setGlobalFence(global_fence);
7067
hier_rtlmp_->setAreaWeight(area_weight);
7168
hier_rtlmp_->setOutlineWeight(outline_weight);
@@ -217,6 +214,11 @@ void MacroPlacer::addGuidanceRegion(odb::dbInst* macro, odb::Rect region)
217214
guidance_regions_[macro] = region;
218215
}
219216

217+
void MacroPlacer::setDefaultHalo(int left, int bottom, int right, int top)
218+
{
219+
hier_rtlmp_->setDefaultHalo(left, bottom, right, top);
220+
}
221+
220222
void MacroPlacer::setMacroHalo(odb::dbInst* macro,
221223
int left,
222224
int bottom,

src/mpl/test/BUILD

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ COMPULSORY_TESTS = [
2323
"guides2",
2424
"halos1",
2525
"halos2",
26+
"halos3",
27+
"halos4",
2628
"io_constraints1",
2729
"io_constraints10",
2830
"io_constraints2",
@@ -119,6 +121,14 @@ filegroup(
119121
"testcases/halos1.def",
120122
"testcases/orientation_improve1.lef",
121123
],
124+
"halos3": [
125+
"testcases/halo3.def",
126+
"testcases/orientation_improve1.lef",
127+
],
128+
"halos4": [
129+
"testcases/halo3.def",
130+
"testcases/orientation_improve1.lef",
131+
],
122132
"io_constraints1": [
123133
"testcases/io_constraints1.def",
124134
"testcases/macro_only.lef",

src/mpl/test/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ or_integration_tests(
3333
placement_blockages1
3434
halos1
3535
halos2
36+
halos3
37+
halos4
3638
)
3739

3840

0 commit comments

Comments
 (0)