From 66ecdc94599ae8d5025d9195b35240104608b6b6 Mon Sep 17 00:00:00 2001 From: andyfox-rushc Date: Tue, 22 Oct 2024 16:10:24 -0700 Subject: [PATCH] Detect if has modinsts during name search -- if so truncate name so pathName with parent works ok Signed-off-by: andyfox-rushc --- src/dbSta/src/dbNetwork.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/dbSta/src/dbNetwork.cc b/src/dbSta/src/dbNetwork.cc index 8f00ba745c9..c2c93ab462e 100644 --- a/src/dbSta/src/dbNetwork.cc +++ b/src/dbSta/src/dbNetwork.cc @@ -720,7 +720,13 @@ const char* dbNetwork::name(const Instance* instance) const name = mod_inst->getName(); } - if (hierarchy_) { + bool has_mod_insts = false; + dbModule* module = block_->getTopModule(); + if (module && module->getModInstCount() > 0) { + has_mod_insts = true; + } + + if (hierarchy_ || has_mod_insts) { size_t last_idx = name.find_last_of('/'); if (last_idx != string::npos) { name = name.substr(last_idx + 1); @@ -843,9 +849,7 @@ Instance* dbNetwork::parent(const Instance* instance) const if (instance == top_instance_) { return nullptr; } - if (!hasHierarchy()) { - return top_instance_; - } + dbInst* db_inst; dbModInst* mod_inst; staToDb(instance, db_inst, mod_inst);