Skip to content

Commit 796d725

Browse files
committed
Avoided a string comparison with "<top>"
Signed-off-by: Jaehyun Kim <[email protected]>
1 parent a89a1c7 commit 796d725

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

src/odb/src/db/dbModule.cpp

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -866,12 +866,10 @@ void _dbModule::copyModuleInsts(dbModule* old_module,
866866
}
867867

868868
// Check if the flat net is an internal net within old_module
869-
// - If old_module is in a top level (uninstantiated module),
870-
// every net in the module is an internal net.
871-
// e.g., modinst_name = "<top>" because there is no modinst.
869+
// - If old_module is uninstantiated module, every net in the module is
870+
// an internal net.
871+
// e.g., No module instance.
872872
// net_name = "_001_" <-- Internal net.
873-
// There can be no external net crossing module boundary because
874-
// the module is not instantiated.
875873
//
876874
// - Otherwise, an internal net should have the hierarchy prefix
877875
// (= module instance hierarchical name).
@@ -880,20 +878,20 @@ void _dbModule::copyModuleInsts(dbModule* old_module,
880878
// net_name = u0/_001_ <-- External net crossing module
881879
// boundary.
882880
std::string old_net_name = old_net->getName();
883-
std::string modinst_name = old_module->getHierarchicalName();
884-
if (modinst_name != "<top>"
885-
&& old_net_name.compare(0, modinst_name.length(), modinst_name)
886-
!= 0) {
887-
// Skip external net crossing module boundary.
888-
// It will be connected later.
889-
debugPrint(logger,
890-
utl::ODB,
891-
"replace_design",
892-
3,
893-
"Skip: dbNet '{}'. Hierarchy_prefix='{}'\n",
894-
old_net_name,
895-
modinst_name);
896-
continue;
881+
if (old_module->getModInst() != nullptr) {
882+
std::string modinst_name = old_module->getHierarchicalName();
883+
if (old_net_name.compare(0, modinst_name.length(), modinst_name) != 0) {
884+
// Skip external net crossing module boundary.
885+
// It will be connected later.
886+
debugPrint(logger,
887+
utl::ODB,
888+
"replace_design",
889+
3,
890+
"Skip: dbNet '{}'. Hierarchy_prefix='{}'\n",
891+
old_net_name,
892+
modinst_name);
893+
continue;
894+
}
897895
}
898896
new_net_name += block->getBaseName(old_net_name.c_str());
899897

0 commit comments

Comments
 (0)