Skip to content

Commit a4b5d14

Browse files
authored
Merge pull request #8081 from The-OpenROAD-Project-staging/secure-refactor-api-name
Refactor: Changed API names (getOrFindFlat*Net -> findFlat*Net)
2 parents f470d08 + 7bf8c7f commit a4b5d14

File tree

7 files changed

+33
-18
lines changed

7 files changed

+33
-18
lines changed

src/dbSta/include/db_sta/dbNetwork.hh

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,11 +298,26 @@ class dbNetwork : public ConcreteNetwork
298298
NetTermIterator* termIterator(const Net* net) const override;
299299
const Net* highestConnectedNet(Net* net) const override;
300300
bool isSpecial(Net* net);
301+
302+
// Get the flat net (dbNet) with the Net*.
303+
// If the net is a hierarchical net (dbModNet), return nullptr
301304
dbNet* flatNet(const Net* net) const;
302-
Net* getOrFindFlatNet(const Net* net) const;
303-
dbNet* getOrFindFlatDbNet(const Net* net) const;
304-
Net* getOrFindFlatNet(const Pin* pin) const;
305-
dbNet* getOrFindFlatDbNet(const Pin* pin) const;
305+
306+
// Given a net or pin that may be hierarchical, find the corresponding flat
307+
// dbNet by traversing the netlist.
308+
// If the net is already a flat net (dbNet), it is returned as is.
309+
// If the net is a hierarchical net (dbModNet), find the associated dbNet.
310+
dbNet* findFlatDbNet(const Net* net) const;
311+
dbNet* findFlatDbNet(const Pin* pin) const;
312+
313+
// Given a net that may be hierarchical, find the corresponding flat dbNet by
314+
// traversing the netlist and return it as Net*.
315+
// If the net is already a flat net, it is returned as is.
316+
// If the net is a hierarchical net (dbModNet), find the associated dbNet and
317+
// return it as Net*.
318+
Net* findFlatNet(const Net* net) const;
319+
Net* findFlatNet(const Pin* pin) const;
320+
306321
bool hasPort(const Net* net) const;
307322

308323
////////////////////////////////////////////////////////////////

src/dbSta/src/dbNetwork.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2655,7 +2655,7 @@ Net* dbNetwork::mergedInto(Net*)
26552655

26562656
bool dbNetwork::isSpecial(Net* net)
26572657
{
2658-
dbNet* db_net = getOrFindFlatDbNet(net);
2658+
dbNet* db_net = findFlatDbNet(net);
26592659
return (db_net && db_net->isSpecial());
26602660
}
26612661

@@ -3977,15 +3977,15 @@ void dbNetwork::checkAxioms()
39773977
// If the net is already a flat net, it is returned as is.
39783978
// If the net is a hierarchical net (dbModNet), find the associated dbNet and
39793979
// return it as Net*.
3980-
Net* dbNetwork::getOrFindFlatNet(const Net* net) const
3980+
Net* dbNetwork::findFlatNet(const Net* net) const
39813981
{
3982-
return dbToSta(getOrFindFlatDbNet(net));
3982+
return dbToSta(findFlatDbNet(net));
39833983
}
39843984

39853985
// Given a net that may be hierarchical, find the corresponding flat dbNet.
39863986
// If the net is already a flat net (dbNet), it is returned as is.
39873987
// If the net is a hierarchical net (dbModNet), find the associated dbNet.
3988-
dbNet* dbNetwork::getOrFindFlatDbNet(const Net* net) const
3988+
dbNet* dbNetwork::findFlatDbNet(const Net* net) const
39893989
{
39903990
if (!net) {
39913991
return nullptr;
@@ -4010,14 +4010,14 @@ dbNet* dbNetwork::getOrFindFlatDbNet(const Net* net) const
40104010

40114011
// Find the flat net connected to the pin.
40124012
// This function handles both internal instance pins and top-level port pins.
4013-
Net* dbNetwork::getOrFindFlatNet(const Pin* pin) const
4013+
Net* dbNetwork::findFlatNet(const Pin* pin) const
40144014
{
4015-
return dbToSta(getOrFindFlatDbNet(pin));
4015+
return dbToSta(findFlatDbNet(pin));
40164016
}
40174017

40184018
// Find the flat net (dbNet) connected to the pin in the OpenDB database.
40194019
// This function handles both internal instance pins and top-level port pins.
4020-
dbNet* dbNetwork::getOrFindFlatDbNet(const Pin* pin) const
4020+
dbNet* dbNetwork::findFlatDbNet(const Pin* pin) const
40214021
{
40224022
dbNet* db_net = nullptr;
40234023
if (isTopLevelPort(pin)) {

src/est/src/EstimateParasitics.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -993,7 +993,7 @@ SteinerTree* EstimateParasitics::makeSteinerTree(const Pin* drvr_pin)
993993
/*
994994
Handle hierarchy. Make sure all traversal on dbNets.
995995
*/
996-
odb::dbNet* db_net = db_network_->getOrFindFlatDbNet(drvr_pin);
996+
odb::dbNet* db_net = db_network_->findFlatDbNet(drvr_pin);
997997
Net* net = db_network_->dbToSta(db_net);
998998

999999
debugPrint(logger_, EST, "steiner", 1, "Net {}", sdc_network->pathName(net));

src/gui/src/staGuiInterface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ sta::Net* ClockTree::getNet(const sta::Pin* pin) const
724724
{
725725
sta::Term* term = network_->term(pin);
726726
sta::Net* net = term ? network_->net(term) : network_->net(pin);
727-
return network_->getOrFindFlatNet(net);
727+
return network_->findFlatNet(net);
728728
}
729729

730730
bool ClockTree::isLeaf(const sta::Pin* pin) const

src/rsz/src/BufferedNet.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,7 @@ static BufferedNetPtr makeBufferedNet(
743743
BufferedNetPtr Resizer::makeBufferedNetGroute(const Pin* drvr_pin,
744744
const Corner* corner)
745745
{
746-
dbNet* db_net = db_network_->getOrFindFlatDbNet(drvr_pin);
746+
dbNet* db_net = db_network_->findFlatDbNet(drvr_pin);
747747
const Net* net = db_network_->dbToSta(db_net);
748748
assert(db_net != nullptr);
749749
std::vector<grt::PinGridLocation> pin_grid_locs

src/rsz/src/Resizer.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3999,8 +3999,8 @@ void Resizer::cloneClkInverter(Instance* inv)
39993999
inv_cell->bufferPorts(in_port, out_port);
40004000
Pin* in_pin = network_->findPin(inv, in_port);
40014001
Pin* out_pin = network_->findPin(inv, out_port);
4002-
Net* in_net = db_network_->getOrFindFlatNet(in_pin);
4003-
dbNet* in_net_db = db_network_->getOrFindFlatDbNet(in_net);
4002+
Net* in_net = db_network_->findFlatNet(in_pin);
4003+
dbNet* in_net_db = db_network_->findFlatDbNet(in_net);
40044004
Net* out_net = network_->isTopLevelPort(out_pin)
40054005
? network_->net(network_->term(out_pin))
40064006
: network_->net(out_pin);

src/rsz/src/UnbufferMove.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,8 @@ bool UnbufferMove::canRemoveBuffer(Instance* buffer, bool honorDontTouchFixed)
303303
Pin* out_pin = db_network_->findPin(buffer, out_port);
304304
Net* in_net = db_network_->net(in_pin);
305305
Net* out_net = db_network_->net(out_pin);
306-
dbNet* in_db_net = db_network_->getOrFindFlatDbNet(in_net);
307-
dbNet* out_db_net = db_network_->getOrFindFlatDbNet(out_net);
306+
dbNet* in_db_net = db_network_->findFlatDbNet(in_net);
307+
dbNet* out_db_net = db_network_->findFlatDbNet(out_net);
308308
// honor net dont-touch on input net or output net
309309
if ((in_db_net && in_db_net->isDoNotTouch())
310310
|| (out_db_net && out_db_net->isDoNotTouch())) {

0 commit comments

Comments
 (0)