Skip to content

Commit 259a4a6

Browse files
committed
mpl2: prevent mpl2 flow to go on if there are fixed instances inside the area defined for the macro placement
Signed-off-by: Arthur Koucher <arthurkoucher@precisioninno.com>
1 parent 08da6f1 commit 259a4a6

File tree

8 files changed

+82
-76
lines changed

8 files changed

+82
-76
lines changed

src/mpl2/src/clusterEngine.cpp

Lines changed: 61 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -112,41 +112,23 @@ void ClusteringEngine::init()
112112
return;
113113
}
114114

115-
tree_->macro_with_halo_area = computeMacroWithHaloArea(unfixed_macros);
116-
117-
const odb::Rect die = block_->getDieArea();
118-
const odb::Rect core_box = block_->getCoreArea();
119-
120-
const float core_lx = block_->dbuToMicrons(core_box.xMin());
121-
const float core_ly = block_->dbuToMicrons(core_box.yMin());
122-
const float core_ux = block_->dbuToMicrons(core_box.xMax());
123-
const float core_uy = block_->dbuToMicrons(core_box.yMax());
115+
setFloorplanShape();
116+
searchForFixedInstsInsideFloorplanShape();
124117

125-
const float core_area = (core_ux - core_lx) * (core_uy - core_ly);
118+
tree_->macro_with_halo_area = computeMacroWithHaloArea(unfixed_macros);
126119
const float inst_area_with_halos
127120
= tree_->macro_with_halo_area + design_metrics_->getStdCellArea();
128121

129-
if (inst_area_with_halos > core_area) {
122+
if (inst_area_with_halos > tree_->floorplan_shape.getArea()) {
130123
logger_->error(MPL,
131124
16,
132125
"The instance area considering the macros' halos {} exceeds "
133-
"the core area {}",
126+
"the floorplan area {}",
134127
inst_area_with_halos,
135-
core_area);
128+
tree_->floorplan_shape.getArea());
136129
}
137130

138-
logger_->report(
139-
"Floorplan Outline: ({}, {}) ({}, {}), Core Outline: ({}, {}) ({}, {})",
140-
block_->dbuToMicrons(die.xMin()),
141-
block_->dbuToMicrons(die.yMin()),
142-
block_->dbuToMicrons(die.xMax()),
143-
block_->dbuToMicrons(die.yMax()),
144-
core_lx,
145-
core_ly,
146-
core_ux,
147-
core_uy);
148-
149-
reportDesignData(core_area);
131+
reportDesignData();
150132
}
151133

152134
float ClusteringEngine::computeMacroWithHaloArea(
@@ -175,6 +157,39 @@ std::vector<odb::dbInst*> ClusteringEngine::getUnfixedMacros()
175157
return unfixed_macros;
176158
}
177159

160+
void ClusteringEngine::setFloorplanShape()
161+
{
162+
const odb::Rect& core_box = block_->getCoreArea();
163+
const float core_lx = block_->dbuToMicrons(core_box.xMin());
164+
const float core_ly = block_->dbuToMicrons(core_box.yMin());
165+
const float core_ux = block_->dbuToMicrons(core_box.xMax());
166+
const float core_uy = block_->dbuToMicrons(core_box.yMax());
167+
168+
tree_->floorplan_shape = Rect(std::max(core_lx, tree_->global_fence.xMin()),
169+
std::max(core_ly, tree_->global_fence.yMin()),
170+
std::min(core_ux, tree_->global_fence.xMax()),
171+
std::min(core_uy, tree_->global_fence.yMax()));
172+
}
173+
174+
void ClusteringEngine::searchForFixedInstsInsideFloorplanShape()
175+
{
176+
odb::Rect floorplan_shape(
177+
block_->micronsToDbu(tree_->floorplan_shape.xMin()),
178+
block_->micronsToDbu(tree_->floorplan_shape.yMin()),
179+
block_->micronsToDbu(tree_->floorplan_shape.xMax()),
180+
block_->micronsToDbu(tree_->floorplan_shape.yMax()));
181+
182+
for (odb::dbInst* inst : block_->getInsts()) {
183+
if (inst->isFixed()
184+
&& inst->getBBox()->getBox().overlaps(floorplan_shape)) {
185+
logger_->error(MPL,
186+
50,
187+
"Found fixed instance {} inside the floorplan area.",
188+
inst->getName());
189+
}
190+
}
191+
}
192+
178193
Metrics* ClusteringEngine::computeModuleMetrics(odb::dbModule* module)
179194
{
180195
unsigned int num_std_cell = 0;
@@ -218,14 +233,26 @@ Metrics* ClusteringEngine::computeModuleMetrics(odb::dbModule* module)
218233
return tree_->maps.module_to_metrics[module].get();
219234
}
220235

221-
void ClusteringEngine::reportDesignData(const float core_area)
236+
void ClusteringEngine::reportDesignData()
222237
{
238+
const odb::Rect& die = block_->getDieArea();
239+
logger_->report(
240+
"Die Area: ({}, {}) ({}, {}), Floorplan Area: ({}, {}) ({}, {})",
241+
block_->dbuToMicrons(die.xMin()),
242+
block_->dbuToMicrons(die.yMin()),
243+
block_->dbuToMicrons(die.xMax()),
244+
block_->dbuToMicrons(die.yMax()),
245+
tree_->floorplan_shape.xMin(),
246+
tree_->floorplan_shape.yMin(),
247+
tree_->floorplan_shape.xMax(),
248+
tree_->floorplan_shape.yMax());
249+
223250
float util
224251
= (design_metrics_->getStdCellArea() + design_metrics_->getMacroArea())
225-
/ core_area;
226-
float core_util = design_metrics_->getStdCellArea()
227-
/ (core_area - design_metrics_->getMacroArea());
228-
252+
/ tree_->floorplan_shape.getArea();
253+
float floorplan_util
254+
= design_metrics_->getStdCellArea()
255+
/ (tree_->floorplan_shape.getArea() - design_metrics_->getMacroArea());
229256
logger_->report(
230257
"\tNumber of std cell instances: {}\n"
231258
"\tArea of std cell instances: {:.2f}\n"
@@ -235,9 +262,9 @@ void ClusteringEngine::reportDesignData(const float core_area)
235262
"\tHalo height: {:.2f}\n"
236263
"\tArea of macros with halos: {:.2f}\n"
237264
"\tArea of std cell instances + Area of macros: {:.2f}\n"
238-
"\tCore area: {:.2f}\n"
265+
"\tFloorplan area: {:.2f}\n"
239266
"\tDesign Utilization: {:.2f}\n"
240-
"\tCore Utilization: {:.2f}\n"
267+
"\tFloorplan Utilization: {:.2f}\n"
241268
"\tManufacturing Grid: {}\n",
242269
design_metrics_->getNumStdCell(),
243270
design_metrics_->getStdCellArea(),
@@ -247,9 +274,9 @@ void ClusteringEngine::reportDesignData(const float core_area)
247274
tree_->halo_height,
248275
tree_->macro_with_halo_area,
249276
design_metrics_->getStdCellArea() + design_metrics_->getMacroArea(),
250-
core_area,
277+
tree_->floorplan_shape.getArea(),
251278
util,
252-
core_util,
279+
floorplan_util,
253280
block_->getTech()->getManufacturingGrid());
254281
}
255282

src/mpl2/src/clusterEngine.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ struct PhysicalHierarchy
117117
float halo_width{0.0f};
118118
float halo_height{0.0f};
119119
float macro_with_halo_area{0.0f};
120+
Rect global_fence;
121+
Rect floorplan_shape;
120122

121123
bool has_io_clusters{true};
122124
bool has_only_macros{false};
@@ -176,9 +178,11 @@ class ClusteringEngine
176178
void init();
177179
Metrics* computeModuleMetrics(odb::dbModule* module);
178180
std::vector<odb::dbInst*> getUnfixedMacros();
181+
void setFloorplanShape();
182+
void searchForFixedInstsInsideFloorplanShape();
179183
float computeMacroWithHaloArea(
180184
const std::vector<odb::dbInst*>& unfixed_macros);
181-
void reportDesignData(float core_area);
185+
void reportDesignData();
182186
void createRoot();
183187
void setBaseThresholds();
184188
void createIOClusters();

src/mpl2/src/hier_rtlmp.cpp

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,7 @@ void HierRTLMP::setGlobalFence(float fence_lx,
129129
float fence_ux,
130130
float fence_uy)
131131
{
132-
global_fence_lx_ = fence_lx;
133-
global_fence_ly_ = fence_ly;
134-
global_fence_ux_ = fence_ux;
135-
global_fence_uy_ = fence_uy;
132+
tree_->global_fence = Rect(fence_lx, fence_ly, fence_ux, fence_uy);
136133
}
137134

138135
void HierRTLMP::setHaloWidth(float halo_width)
@@ -370,31 +367,15 @@ void HierRTLMP::setRootShapes()
370367
{
371368
auto root_soft_macro = std::make_unique<SoftMacro>(tree_->root.get());
372369

373-
const float core_lx
374-
= static_cast<float>(block_->dbuToMicrons(block_->getCoreArea().xMin()));
375-
const float root_lx = std::max(core_lx, global_fence_lx_);
376-
377-
const float core_ly
378-
= static_cast<float>(block_->dbuToMicrons(block_->getCoreArea().yMin()));
379-
const float root_ly = std::max(core_ly, global_fence_ly_);
380-
381-
const float core_ux
382-
= static_cast<float>(block_->dbuToMicrons(block_->getCoreArea().xMax()));
383-
const float root_ux = std::min(core_ux, global_fence_ux_);
384-
385-
const float core_uy
386-
= static_cast<float>(block_->dbuToMicrons(block_->getCoreArea().yMax()));
387-
const float root_uy = std::min(core_uy, global_fence_uy_);
388-
389-
const float root_area = (root_ux - root_lx) * (root_uy - root_ly);
390-
const float root_width = root_ux - root_lx;
370+
const float root_area = tree_->floorplan_shape.getArea();
371+
const float root_width = tree_->floorplan_shape.getWidth();
391372
const std::vector<std::pair<float, float>> root_width_list
392373
= {std::pair<float, float>(root_width, root_width)};
393374

394375
root_soft_macro->setShapes(root_width_list, root_area);
395376
root_soft_macro->setWidth(root_width); // This will set height automatically
396-
root_soft_macro->setX(root_lx);
397-
root_soft_macro->setY(root_ly);
377+
root_soft_macro->setX(tree_->floorplan_shape.xMin());
378+
root_soft_macro->setY(tree_->floorplan_shape.yMin());
398379
tree_->root->setSoftMacro(std::move(root_soft_macro));
399380
}
400381

src/mpl2/src/hier_rtlmp.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -272,12 +272,6 @@ class HierRTLMP
272272
std::string report_directory_;
273273
std::string macro_placement_file_;
274274

275-
// User can specify a global region for some designs
276-
float global_fence_lx_ = std::numeric_limits<float>::max();
277-
float global_fence_ly_ = std::numeric_limits<float>::max();
278-
float global_fence_ux_ = 0.0;
279-
float global_fence_uy_ = 0.0;
280-
281275
const int num_runs_ = 10; // number of runs for SA
282276
int num_threads_ = 10; // number of threads
283277
const int random_seed_ = 0; // random seed for deterministic

src/mpl2/src/object.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,13 +629,13 @@ struct Rect
629629
float yMax() const { return uy; }
630630

631631
float getX() const { return (lx + ux) / 2.0; }
632-
633632
float getY() const { return (ly + uy) / 2.0; }
634633

635634
float getWidth() const { return ux - lx; }
636-
637635
float getHeight() const { return uy - ly; }
638636

637+
float getArea() const { return getWidth() * getHeight(); }
638+
639639
void setLoc(float x,
640640
float y,
641641
float core_lx,

src/mpl2/test/guides1.ok

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Using 2 tracks default min distance between IO pins.
1313
[INFO PPL-0003] Number of I/O w/sink 0
1414
[INFO PPL-0004] Number of I/O w/o sink 3
1515
[INFO PPL-0012] I/O nets HPWL: 0.00 um.
16-
Floorplan Outline: (0, 0) (150, 125), Core Outline: (0, 0) (149.91, 124.6)
16+
Die Area: (0, 0) (150, 125), Floorplan Area: (0, 0) (149.91, 124.6)
1717
Number of std cell instances: 400
1818
Area of std cell instances: 1808.79
1919
Number of macros: 1
@@ -22,9 +22,9 @@ Floorplan Outline: (0, 0) (150, 125), Core Outline: (0, 0) (149.91, 124.6)
2222
Halo height: 4.00
2323
Area of macros with halos: 11664.00
2424
Area of std cell instances + Area of macros: 11808.79
25-
Core area: 18678.79
25+
Floorplan area: 18678.79
2626
Design Utilization: 0.63
27-
Core Utilization: 0.21
27+
Floorplan Utilization: 0.21
2828
Manufacturing Grid: 10
2929

3030
[WARNING MPL-0014] No Liberty data found for std cells. Continuing without dataflow.

src/mpl2/test/guides2.ok

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[WARNING STA-1171] ./testcases/macro_only.lib line 32, default_max_transition is 0.0.
44
[INFO ODB-0128] Design: macro_only
55
[INFO ODB-0253] Updated 10 components.
6-
Floorplan Outline: (0, 0) (450, 450), Core Outline: (4.94, 4.2) (444.98, 443.8)
6+
Die Area: (0, 0) (450, 450), Floorplan Area: (4.94, 4.2) (444.98, 443.8)
77
Number of std cell instances: 0
88
Area of std cell instances: 0.00
99
Number of macros: 10
@@ -12,9 +12,9 @@ Floorplan Outline: (0, 0) (450, 450), Core Outline: (4.94, 4.2) (444.98, 443.8)
1212
Halo height: 4.00
1313
Area of macros with halos: 187920.00
1414
Area of std cell instances + Area of macros: 166000.00
15-
Core area: 193441.58
15+
Floorplan area: 193441.58
1616
Design Utilization: 0.86
17-
Core Utilization: 0.00
17+
Floorplan Utilization: 0.00
1818
Manufacturing Grid: 10
1919

2020
[WARNING MPL-0026] Design has no IO pins!

src/mpl2/test/macro_only.ok

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[WARNING STA-1171] ./testcases/macro_only.lib line 32, default_max_transition is 0.0.
44
[INFO ODB-0128] Design: macro_only
55
[INFO ODB-0253] Updated 10 components.
6-
Floorplan Outline: (0, 0) (450, 450), Core Outline: (4.94, 4.2) (444.98, 443.8)
6+
Die Area: (0, 0) (450, 450), Floorplan Area: (4.94, 4.2) (444.98, 443.8)
77
Number of std cell instances: 0
88
Area of std cell instances: 0.00
99
Number of macros: 10
@@ -12,9 +12,9 @@ Floorplan Outline: (0, 0) (450, 450), Core Outline: (4.94, 4.2) (444.98, 443.8)
1212
Halo height: 4.00
1313
Area of macros with halos: 187920.00
1414
Area of std cell instances + Area of macros: 166000.00
15-
Core area: 193441.58
15+
Floorplan area: 193441.58
1616
Design Utilization: 0.86
17-
Core Utilization: 0.00
17+
Floorplan Utilization: 0.00
1818
Manufacturing Grid: 10
1919

2020
[WARNING MPL-0026] Design has no IO pins!

0 commit comments

Comments
 (0)