Skip to content

Commit 9cb765a

Browse files
authored
Merge pull request #7894 from The-OpenROAD-Project-staging/mpl-halo-fit-error
mpl: error and report data when a macro does not fit in the core
2 parents ab27d75 + b5dfc55 commit 9cb765a

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

src/mpl/src/clusterEngine.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@ Metrics* ClusteringEngine::computeModuleMetrics(odb::dbModule* module)
189189
unsigned int num_macro = 0;
190190
float macro_area = 0.0;
191191

192+
const odb::Rect& core = block_->getCoreArea();
193+
192194
for (odb::dbInst* inst : module->getInsts()) {
193195
if (isIgnoredInst(inst)) {
194196
continue;
@@ -202,6 +204,19 @@ Metrics* ClusteringEngine::computeModuleMetrics(odb::dbModule* module)
202204

203205
auto macro = std::make_unique<HardMacro>(
204206
inst, tree_->halo_width, tree_->halo_height);
207+
208+
const int macro_dbu_width = block_->micronsToDbu(macro->getWidth());
209+
const int macro_dbu_height = block_->micronsToDbu(macro->getHeight());
210+
211+
if (macro_dbu_width > core.dx() || macro_dbu_height > core.dy()) {
212+
logger_->error(
213+
MPL,
214+
6,
215+
"Found macro that does not fit in the core.\nName: {}\n{}",
216+
inst->getName(),
217+
generateMacroAndCoreDimensionsTable(macro.get(), core));
218+
}
219+
205220
tree_->maps.inst_to_hard[inst] = std::move(macro);
206221
} else {
207222
num_std_cell += 1;
@@ -2310,6 +2325,24 @@ int ClusteringEngine::getNumberOfIOs(Cluster* target) const
23102325

23112326
///////////////////////////////////////////////
23122327

2328+
std::string ClusteringEngine::generateMacroAndCoreDimensionsTable(
2329+
const HardMacro* hard_macro,
2330+
const odb::Rect& core) const
2331+
{
2332+
std::string table;
2333+
2334+
table += fmt::format("\n | Macro + Halos | Core ");
2335+
table += fmt::format("\n-----------------------------------------");
2336+
table += fmt::format("\n Width | {:>17.2f} | {:>8.2f}",
2337+
hard_macro->getWidth(),
2338+
block_->dbuToMicrons(core.dx()));
2339+
table += fmt::format("\n Height | {:>17.2f} | {:>8.2f}\n",
2340+
hard_macro->getHeight(),
2341+
block_->dbuToMicrons(core.dy()));
2342+
2343+
return table;
2344+
}
2345+
23132346
void ClusteringEngine::reportThresholds() const
23142347
{
23152348
logger_->report("\n Level {} | Min | Max", level_);

src/mpl/src/clusterEngine.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ class ClusteringEngine
169169

170170
void init();
171171
Metrics* computeModuleMetrics(odb::dbModule* module);
172+
std::string generateMacroAndCoreDimensionsTable(const HardMacro* hard_macro,
173+
const odb::Rect& core) const;
172174
std::vector<odb::dbInst*> getUnfixedMacros();
173175
void setDieArea();
174176
void setFloorplanShape();

0 commit comments

Comments
 (0)