@@ -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.\n Name: {}\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+
23132346void ClusteringEngine::reportThresholds () const
23142347{
23152348 logger_->report (" \n Level {} | Min | Max" , level_);
0 commit comments