Skip to content

Commit bdbfe04

Browse files
committed
odb: Expose hpwl api as public in WireLengthEvaluator and fix issue in reportEachNetHpwl.
Signed-off-by: Ted Hong <tedhong@google.com>
1 parent 76065ea commit bdbfe04

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/odb/include/odb/util.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,11 @@ class WireLengthEvaluator
5757
WireLengthEvaluator(dbBlock* block) : block_(block) {}
5858
int64_t hpwl() const;
5959
int64_t hpwl(int64_t& hpwl_x, int64_t& hpwl_y) const;
60+
int64_t hpwl(dbNet* net, int64_t& hpwl_x, int64_t& hpwl_y) const;
6061
void reportEachNetHpwl(utl::Logger* logger) const;
6162
void reportHpwl(utl::Logger* logger) const;
6263

6364
private:
64-
int64_t hpwl(dbNet* net, int64_t& hpwl_x, int64_t& hpwl_y) const;
65-
6665
dbBlock* block_;
6766
};
6867

src/odb/src/db/util.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -518,14 +518,15 @@ int64_t WireLengthEvaluator::hpwl(dbNet* net,
518518
int64_t& hpwl_x,
519519
int64_t& hpwl_y) const
520520
{
521+
hpwl_x = 0;
522+
hpwl_y = 0;
523+
521524
if (net->getSigType().isSupply() || net->isSpecial()) {
522525
return 0;
523526
}
524527

525528
Rect bbox = net->getTermBBox();
526529
if (bbox.isInverted()) {
527-
hpwl_x = 0;
528-
hpwl_y = 0;
529530
return 0;
530531
}
531532

@@ -538,10 +539,10 @@ int64_t WireLengthEvaluator::hpwl(dbNet* net,
538539
void WireLengthEvaluator::reportEachNetHpwl(utl::Logger* logger) const
539540
{
540541
for (dbNet* net : block_->getNets()) {
541-
int64_t tmp;
542+
int64_t tmp_x, tmp_y;
542543
logger->report("{} {}",
543544
net->getConstName(),
544-
block_->dbuToMicrons(hpwl(net, tmp, tmp)));
545+
block_->dbuToMicrons(hpwl(net, tmp_x, tmp_y)));
545546
}
546547
}
547548

0 commit comments

Comments
 (0)