Skip to content

Commit 0aa3f6a

Browse files
authored
Merge pull request #9091 from AcKoucher/mpl-partial-fixed-macros
mpl: cover cases in which a fixed macro is partially inside the core
2 parents 98d3827 + 648966e commit 0aa3f6a

16 files changed

+1624
-431
lines changed

src/mpl/src/hier_rtlmp.cpp

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ void HierRTLMP::calculateChildrenTilings(Cluster* parent)
403403
std::vector<SoftMacro> macros;
404404
for (auto& cluster : parent->getChildren()) {
405405
if (cluster->isFixedMacro()) {
406-
considerFixedMacro(outline, macros, cluster.get());
406+
macros.emplace_back(logger_, cluster->getHardMacros().front(), &outline);
407407
continue;
408408
}
409409

@@ -1297,15 +1297,6 @@ void HierRTLMP::mergeNets(BundledNetList& nets)
12971297
nets = std::move(merged_nets);
12981298
}
12991299

1300-
void HierRTLMP::considerFixedMacro(const odb::Rect& outline,
1301-
std::vector<SoftMacro>& sa_macros,
1302-
Cluster* fixed_macro_cluster) const
1303-
{
1304-
const HardMacro* hard_macro = fixed_macro_cluster->getHardMacros().front();
1305-
odb::Point offset(-outline.xMin(), -outline.yMin());
1306-
sa_macros.emplace_back(logger_, hard_macro, &offset);
1307-
}
1308-
13091300
// Recommendation from the original implementation:
13101301
// For single level, increase macro blockage weight to
13111302
// half of the outline weight.
@@ -1405,7 +1396,7 @@ void HierRTLMP::placeChildren(Cluster* parent, bool ignore_std_cell_area)
14051396
soft_macro_id_map[cluster->getName()] = macros.size();
14061397

14071398
if (cluster->isFixedMacro()) {
1408-
considerFixedMacro(outline, macros, cluster.get());
1399+
macros.emplace_back(logger_, cluster->getHardMacros().front(), &outline);
14091400
continue;
14101401
}
14111402

src/mpl/src/hier_rtlmp.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,6 @@ class HierRTLMP
195195
float offset_x,
196196
float offset_y);
197197
void mergeNets(BundledNetList& nets);
198-
void considerFixedMacro(const odb::Rect& outline,
199-
std::vector<SoftMacro>& sa_macros,
200-
Cluster* fixed_macro_cluster) const;
201198

202199
// Hierarchical Macro Placement 2nd stage: Macro Placement
203200
void placeMacros(Cluster* cluster);

src/mpl/src/object.cpp

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ SoftMacro::SoftMacro(const odb::Point& location,
890890
// Represent a fixed macro.
891891
SoftMacro::SoftMacro(utl::Logger* logger,
892892
const HardMacro* hard_macro,
893-
const odb::Point* offset)
893+
const odb::Rect* outline)
894894
{
895895
if (!hard_macro->isFixed()) {
896896
logger->error(
@@ -902,17 +902,21 @@ SoftMacro::SoftMacro(utl::Logger* logger,
902902

903903
name_ = hard_macro->getName();
904904

905-
x_ = hard_macro->getX();
906-
y_ = hard_macro->getY();
905+
odb::Rect shape;
906+
odb::Rect hard_macro_bbox = hard_macro->getBBox();
907907

908-
if (offset) {
909-
x_ += offset->x();
910-
y_ += offset->y();
908+
if (outline) {
909+
shape = hard_macro_bbox.intersect(*outline);
910+
shape.moveDelta(-outline->xMin(), -outline->yMin());
911+
} else {
912+
shape = hard_macro_bbox;
911913
}
912914

913-
width_ = hard_macro->getWidth();
914-
height_ = hard_macro->getHeight();
915-
area_ = width_ * static_cast<int64_t>(height_);
915+
x_ = shape.xMin();
916+
y_ = shape.yMin();
917+
width_ = shape.dx();
918+
height_ = shape.dy();
919+
area_ = shape.area();
916920

917921
cluster_ = hard_macro->getCluster();
918922
fixed_ = true;

src/mpl/src/object.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ class SoftMacro
384384
Cluster* cluster);
385385
SoftMacro(utl::Logger* logger,
386386
const HardMacro* hard_macro,
387-
const odb::Point* offset = nullptr);
387+
const odb::Rect* outline = nullptr);
388388

389389
const std::string& getName() const;
390390

src/mpl/test/BUILD

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ COMPULSORY_TESTS = [
3434
"centralization1",
3535
"clocked_macro",
3636
"keep_clustering_data",
37-
"fixed_macros",
37+
"fixed_macros1",
38+
"fixed_macros2",
3839
"fixed_covers",
3940
"macros_without_pins1",
4041
]
@@ -95,7 +96,8 @@ filegroup(
9596
"testcases/clocked_macro.lib",
9697
"testcases/clocked_macro.v",
9798
"testcases/fixed_ios1.def",
98-
"testcases/fixed_macros.def",
99+
"testcases/fixed_macros1.def",
100+
"testcases/fixed_macros2.def",
99101
"testcases/guides1.def",
100102
"testcases/guides1.v",
101103
"testcases/io_constraints1.def",

src/mpl/test/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ or_integration_tests(
2727
centralization1
2828
clocked_macro
2929
keep_clustering_data
30-
fixed_macros
30+
fixed_macros1
31+
fixed_macros2
3132
fixed_covers
3233
macros_without_pins1
3334
)

src/mpl/test/fixed_covers.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ read_lef "./Nangate45/Nangate45.lef"
55
read_lef "./Nangate45_io/dummy_pads.lef"
66
read_lef "./testcases/orientation_improve1.lef"
77

8-
read_def "./testcases/fixed_macros.def"
8+
read_def "./testcases/fixed_macros1.def"
99

1010
place_inst -cell DUMMY_BUMP -name "test_pad1" -orient R0 -status FIRM -loc "100 100"
1111

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ source "helpers.tcl"
66
read_lef "./Nangate45/Nangate45.lef"
77
read_lef "./testcases/orientation_improve1.lef"
88

9-
read_def "./testcases/fixed_macros.def"
9+
read_def "./testcases/fixed_macros1.def"
1010

1111
set_thread_count 0
1212
rtl_macro_placer -report_directory [make_result_dir] -halo_width 0.3
1313

14-
set def_file [make_result_file fixed_macros.def]
14+
set def_file [make_result_file fixed_macros1.def]
1515
write_def $def_file
1616

17-
diff_files fixed_macros.defok $def_file
17+
diff_files fixed_macros1.defok $def_file

0 commit comments

Comments
 (0)