Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 50 additions & 6 deletions src/cts/src/HTreeBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1268,12 +1268,29 @@ void HTreeBuilder::run()
computeLevelTopology(level, regionWidth, regionHeight);

if (isNumberOfSinksTooSmall(numSinksPerSubRegion)) {
logger_->info(CTS,
32,
" Stop criterion found. Max number of sinks is {}.",
options_->getMaxFanout() ? options_->getMaxFanout()
: numMaxLeafSinks_);
break;
if (options_->getMaxWl()) {
double maxHPWL = topologyForEachLevel_.back().getLargestSinkRegionHPWL(
wireSegmentUnit_);
if (maxHPWL < options_->getMaxWl()) {
logger_->info(CTS,
38,
" Stop criterion found. Sink region hpwl "
"is smaller than max wirelength ({:.3f} um) and max "
"number of sinks is {}.",
static_cast<double>(options_->getMaxWl())
/ options_->getDbUnits(),
options_->getMaxFanout() ? options_->getMaxFanout()
: numMaxLeafSinks_);
break;
}
} else {
logger_->info(CTS,
32,
" Stop criterion found. Max number of sinks is {}.",
options_->getMaxFanout() ? options_->getMaxFanout()
: numMaxLeafSinks_);
break;
}
}
}

Expand Down Expand Up @@ -1825,6 +1842,33 @@ void HTreeBuilder::initSecondLevelSinks(
}
}

double HTreeBuilder::LevelTopology::getLargestSinkRegionHPWL(
const unsigned wireSegmentUnit) const
{
double bestHpwl = 0.0;
for (unsigned i = 0; i < branchSinkLocs_.size(); ++i) {
const auto& sinks = branchSinkLocs_[i];
if (sinks.size() < 2) {
continue;
}
double minX = sinks[0].getX();
double maxX = minX;
double minY = sinks[0].getY();
double maxY = minY;
for (unsigned j = 1; j < sinks.size(); ++j) {
minX = std::min(minX, sinks[j].getX());
maxX = std::max(maxX, sinks[j].getX());
minY = std::min(minY, sinks[j].getY());
maxY = std::max(maxY, sinks[j].getY());
}
const double hpwl = ((maxX - minX) + (maxY - minY));
if (hpwl > bestHpwl) {
bestHpwl = hpwl;
}
}
return bestHpwl * wireSegmentUnit;
}

void HTreeBuilder::computeBranchSinks(
const LevelTopology& topology,
const unsigned branchIdx,
Expand Down
2 changes: 2 additions & 0 deletions src/cts/src/HTreeBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ class HTreeBuilder : public TreeBuilder
return branchSinkLocs_[branchIdx];
}

double getLargestSinkRegionHPWL(unsigned wireSegmentUnit) const;

void setOutputSlew(unsigned slew) { outputSlew_ = slew; }
unsigned getOutputSlew() const { return outputSlew_; }
void setOutputCap(unsigned cap) { outputCap_ = cap; }
Expand Down
5 changes: 4 additions & 1 deletion src/cts/src/TritonCTS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ void TritonCTS::runTritonCts()
sinkBuffers_.clear();
regTreeRootBufIndex_ = 0;
delayBufIndex_ = 0;
options_->setMaxWl(0);
options_->removeOwner();
logger_->info(CTS, 500, "Runtime: {:.2f}s", timer.elapsed());
}
Expand Down Expand Up @@ -244,7 +245,9 @@ void TritonCTS::setupCharacterization()

double maxWlMicrons
= resizer_->findMaxWireLength(/* don't issue error */ false) * 1e+6;
options_->setMaxWl(block_->micronsToDbu(maxWlMicrons));
if (maxWlMicrons > 0) {
options_->setMaxWl(block_->micronsToDbu(maxWlMicrons));
}
Comment on lines +248 to +250

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reset stale max wire length

When a previous clock_tree_synthesis run computed a positive maxWl_, this branch leaves that value in options_ if a later run/design has no positive findMaxWireLength result (for example, no clock wire RC; runTritonCts clears builders/state but does not recreate CtsOptions). HTreeBuilder will then still see getMaxWl() as enabled and apply an obsolete geometric/wirelength threshold to the new run instead of the intended no-max-WL behavior, so the non-positive case should explicitly clear/set maxWl_ to 0.

Useful? React with 👍 / 👎.


// A new characteriztion is always created.
techChar_ = std::make_unique<TechChar>(
Expand Down
Loading
Loading