Skip to content

Commit

Permalink
mpl2: print module hierarchy for debugging
Browse files Browse the repository at this point in the history
Signed-off-by: Arthur Koucher <arthurckoucher@gmail.com>
  • Loading branch information
AcKoucher committed Jun 20, 2024
1 parent 5556c2d commit cb49ace
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
48 changes: 48 additions & 0 deletions src/mpl2/src/hier_rtlmp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,28 @@ void HierRTLMP::initMacroPlacer()
{
block_ = db_->getChip()->getBlock();

logger_->report("\n\nAll Modules (Total: {})", block_->getModules().size());
for (auto module : block_->getModules()) {
logger_->report("{}", module->getName());
}

int std_cell_count = 0, macro_count = 0;
for (auto inst : block_->getInsts()) {
if (inst->isBlock()) {
++macro_count;
} else {
++std_cell_count;
}
}

logger_->report("\n\nModules in Hierarchy [Total Insts: {} (Std Cells: {}, Macros: {})]:",
block_->getInsts().size(),
std_cell_count,
macro_count);

reportChildrenModules(block_->getTopModule(), 0);
logger_->report("\n");

odb::Rect die = block_->getDieArea();
odb::Rect core_box = block_->getCoreArea();

Expand Down Expand Up @@ -499,6 +521,32 @@ void HierRTLMP::reportLogicalHierarchyInformation(float core_area,
block_->getTech()->getManufacturingGrid());
}

void HierRTLMP::reportChildrenModules(odb::dbModule* parent, int level)
{
std::string indent;
for (int i = 0; i < level; ++i) {
indent += '\t';
}

int std_cell_count = 0, macro_count = 0;
for (auto inst : parent->getInsts()) {
if (inst->isBlock()) {
++macro_count;
} else {
++std_cell_count;
}
}

logger_->report("\n{}", indent + parent->getName());
logger_->report("{} Number of Std Cells: {}", indent, std_cell_count);
logger_->report("{} Number of Macros: {}", indent, macro_count);

for (auto child_module_inst : parent->getChildren()) {
odb::dbModule* child = child_module_inst->getMaster();
reportChildrenModules(child, level + 1);
}
}

void HierRTLMP::initPhysicalHierarchy()
{
setDefaultThresholds();
Expand Down
1 change: 1 addition & 0 deletions src/mpl2/src/hier_rtlmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ class HierRTLMP
void writeMacroPlacement(const std::string& file_name);

private:
void reportChildrenModules(odb::dbModule* parent, int level);
using IOSpans = std::map<Boundary, std::pair<float, float>>;

// General Hier-RTLMP flow functions
Expand Down

0 comments on commit cb49ace

Please sign in to comment.