-
Notifications
You must be signed in to change notification settings - Fork 867
Cts fix sink count recursion #10134
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?
Cts fix sink count recursion #10134
Changes from all commits
892677c
db6e555
5c6fc67
6523d8b
643fcb4
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 |
|---|---|---|
|
|
@@ -362,8 +362,18 @@ void TritonCTS::countSinksPostDbWrite( | |
| int depth, | ||
| bool fullTree, | ||
| const std::unordered_set<odb::dbITerm*>& sinks, | ||
| const std::unordered_set<odb::dbInst*>& dummies) | ||
| const std::unordered_set<odb::dbInst*>& dummies, | ||
| std::unordered_set<odb::dbNet*>& visitedNets) | ||
| { | ||
| if (net->getSigType() != odb::dbSigType::CLOCK) { | ||
| logger_->error(CTS, | ||
| 369, | ||
| "Unexpected data net '{}' found during clock tree traversal", | ||
| net->getName()); | ||
| } | ||
| if (!visitedNets.insert(net).second) { | ||
| return; // cycle detected: this net was already visited on this path | ||
| } | ||
| odb::dbSet<odb::dbITerm> iterms = net->getITerms(); | ||
| int driverX = 0; | ||
| int driverY = 0; | ||
|
|
@@ -403,8 +413,18 @@ void TritonCTS::countSinksPostDbWrite( | |
| bool terminate = fullTree | ||
| ? (sinks.find(iterm) != sinks.end()) | ||
| : !builder->isAnyTreeBuffer(getClockFromInst(inst)); | ||
| odb::dbITerm* outputPin = iterm->getInst()->getFirstOutput(); | ||
| bool trueSink = true; | ||
|
|
||
| // Macro tree top net also drives the register tree top buffer, | ||
| // avoid the recursion going into the register tree. | ||
| if (builder->getTreeType() != TreeType::RegisterTree) { | ||
| if (!depth && builder->getTopBufferName() != inst->getName()) { | ||
| terminate = true; | ||
| trueSink = false; | ||
| } | ||
| } | ||
|
Comment on lines
+420
to
+425
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. This logic assumes that Consider checking if the top buffer name is non-empty before applying this termination logic. Additionally, it would be best to ensure if (builder->getTreeType() != TreeType::RegisterTree) {
const std::string& topBufferName = builder->getTopBufferName();
if (!depth && !topBufferName.empty() && topBufferName != inst->getName()) {
terminate = true;
trueSink = false;
}
} |
||
|
|
||
| odb::dbITerm* outputPin = iterm->getInst()->getFirstOutput(); | ||
| if (outputPin && outputPin->getNet() == net) { | ||
| // Skip feedback loop. When input pin and output pin are | ||
| // connected to the same net this can lead to infinite recursion. For | ||
|
|
@@ -413,26 +433,6 @@ void TritonCTS::countSinksPostDbWrite( | |
| trueSink = false; | ||
| } | ||
|
|
||
| if (!terminate && inst) { | ||
| if (inst->isBlock()) { | ||
| // Skip non-sink macro blocks | ||
| terminate = true; | ||
| trueSink = false; | ||
| } else { | ||
| sta::Cell* masterCell = network_->dbToSta(inst->getMaster()); | ||
| if (masterCell) { | ||
| sta::LibertyCell* libCell = network_->libertyCell(masterCell); | ||
| if (libCell) { | ||
| if (libCell->hasSequentials()) { | ||
| // Skip non-sink registers | ||
| terminate = true; | ||
| trueSink = false; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| if (!terminate) { | ||
| // ignore dummy buffer and inverters added to balance loads | ||
| if (outputPin && outputPin->getNet() != nullptr) { | ||
|
|
@@ -447,7 +447,8 @@ void TritonCTS::countSinksPostDbWrite( | |
| depth + 1, | ||
| fullTree, | ||
| sinks, | ||
| dummies); | ||
| dummies, | ||
| visitedNets); | ||
| } else { | ||
| std::string cellType = "Complex cell"; | ||
| odb::dbInst* inst = iterm->getInst(); | ||
|
|
@@ -529,6 +530,7 @@ void TritonCTS::writeDataToDb() | |
| CTS, 124, "Clock net \"{}\"", builder->getClock().getName()); | ||
| logger_->info(CTS, 125, " Sinks {}", sinks.size()); | ||
| } else { | ||
| std::unordered_set<odb::dbNet*> visitedNets; | ||
| countSinksPostDbWrite(builder.get(), | ||
| topClockNet, | ||
| sinkCount, | ||
|
|
@@ -540,7 +542,8 @@ void TritonCTS::writeDataToDb() | |
| 0, | ||
| reportFullTree, | ||
| sinks, | ||
| clkDummies); | ||
| clkDummies, | ||
| visitedNets); | ||
| logger_->info(CTS, 98, "Clock net \"{}\"", builder->getClock().getName()); | ||
| logger_->info(CTS, 99, " Sinks {}", sinkCount); | ||
| logger_->info(CTS, 100, " Leaf buffers {}", leafSinks); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.