-
Notifications
You must be signed in to change notification settings - Fork 795
odb: Add swapMaster sanity checker and fix net internality logic #9505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
261a625
4542c51
d6b5f06
15b1c01
1a601fa
0b2e66e
c332706
962c5e0
64a82a8
a998009
c8adaaa
8f86e2c
3096f08
63a6f3b
0c364cf
61f8934
21d54bd
805a1d9
1b3a3b6
66f9499
4659217
9a75c4e
9bb980a
a3180cb
afade03
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,6 +32,7 @@ | |
| #include "dbModNet.h" | ||
| #include "dbModuleModInstItr.h" | ||
| #include "dbModuleModInstModITermItr.h" | ||
| #include "dbSwapMasterSanityChecker.h" | ||
| #include "odb/dbBlockCallBackObj.h" | ||
| #include "odb/dbObject.h" | ||
| #include "odb/dbSet.h" | ||
|
|
@@ -775,6 +776,11 @@ dbModInst* dbModInst::swapMaster(dbModule* new_module) | |
| } | ||
| } | ||
|
|
||
| if (logger->debugCheck(utl::ODB, "replace_design_check_sanity", 1)) { | ||
| dbSwapMasterSanityChecker checker(new_mod_inst, new_module, logger); | ||
| checker.run(); | ||
| } | ||
|
Comment on lines
+779
to
+782
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| return new_mod_inst; | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -264,6 +264,15 @@ void dbModNet::dump() const | |
| getParent()->getName(), | ||
| getParent()->getId()); | ||
|
|
||
| dbNet* related_net = findRelatedNet(); | ||
| if (related_net != nullptr) { | ||
| logger->report(" Related dbNet: {} (id={})", | ||
| related_net->getName(), | ||
| related_net->getId()); | ||
| } else { | ||
| logger->report(" Related dbNet: <null>"); | ||
| } | ||
|
Comment on lines
+267
to
+274
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| logger->report(" ModITerms ({}):", getModITerms().size()); | ||
| for (dbModITerm* moditerm : getModITerms()) { | ||
| // For dbModITerm, get types from child dbModBTerm | ||
|
|
@@ -730,6 +739,18 @@ std::vector<dbModNet*> dbModNet::getNextModNetsInFanout() const | |
| return next_modnets; | ||
| } | ||
|
|
||
| dbModNet* dbModNet::getFirstParentModNet() const | ||
| { | ||
| for (dbModBTerm* mod_bterm : getModBTerms()) { | ||
| if (dbModITerm* parent_iterm = mod_bterm->getParentModITerm()) { | ||
| if (dbModNet* parent_net = parent_iterm->getModNet()) { | ||
| return parent_net; | ||
| } | ||
| } | ||
| } | ||
| return nullptr; | ||
|
Comment on lines
+742
to
+751
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
|
|
||
| dbModNet* dbModNet::findInHierarchy( | ||
| const std::function<bool(dbModNet*)>& condition, | ||
| dbHierSearchDir dir) const | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -889,6 +889,12 @@ void _dbModule::copyModuleInsts(dbModule* old_module, | |
| } | ||
|
|
||
| // Check if the flat net is an internal net within old_module | ||
| // - If the old net is an internal net, a new net should be created. | ||
| // - If the old net is an external net, a new net will be created later | ||
| // by boundary IO handling logic. | ||
| // - Note that if old modnet is connected to a dbModBTerm and its | ||
| // corresponding dbModITerm is unconnected (has_parent_modnet == false), | ||
| // a new net should be created. | ||
| // - If old_module is uninstantiated module, every net in the module is | ||
|
Comment on lines
+892
to
898
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| // an internal net. | ||
| // e.g., No module instance. | ||
|
|
@@ -901,6 +907,22 @@ void _dbModule::copyModuleInsts(dbModule* old_module, | |
| // net_name = u0/_001_ <-- External net crossing module | ||
| // boundary. | ||
| std::string old_net_name = old_net->getName(); | ||
| dbModNet* old_mod_net = old_iterm->getModNet(); | ||
| bool has_parent_modnet | ||
| = (old_mod_net && old_mod_net->getFirstParentModNet()); | ||
| if (old_net->isInternalTo(old_module) == false && has_parent_modnet) { | ||
| // Skip external net crossing module boundary. | ||
| // It will be connected later. | ||
| debugPrint(logger, | ||
| utl::ODB, | ||
| "replace_design", | ||
| 3, | ||
| " Skip: non-internal dbNet '{}' of old_module '{}'.\n", | ||
| old_net_name, | ||
| old_module->getHierarchicalName()); | ||
| continue; | ||
|
Comment on lines
+910
to
+923
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
|
|
||
| new_net_name += block->getBaseName(old_net_name.c_str()); | ||
| auto it = new_net_name_map.find(new_net_name); | ||
| if (it != new_net_name_map.end()) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment for
isInternalTois updated to reflect the new logic, but the phrasing "(excluding sub-modules)" might be slightly ambiguous. It could be clearer to state that it refers to iterms directly within instances of the given module, not recursively within sub-modules instantiated inside it. Also, the second bullet point is a bit long and could be rephrased for better readability.