Skip to content

Commit

Permalink
Merge pull request The-OpenROAD-Project#5050 from The-OpenROAD-Projec…
Browse files Browse the repository at this point in the history
…t-staging/drt-frInst-getInstTerm

drt: convert frInst::getInstTerm to index rather than name lookup
  • Loading branch information
maliberty authored May 5, 2024
2 parents 4efc41f + 205df32 commit fd1b211
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 11 deletions.
9 changes: 2 additions & 7 deletions src/drt/src/db/obj/frInst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,9 @@ void frInst::updateXform(dbTransform& xform, Point& size)
xform.setOffset(p);
}

frInstTerm* frInst::getInstTerm(const std::string& name)
frInstTerm* frInst::getInstTerm(const int index)
{
for (auto& it : instTerms_) {
if (it->getTerm()->getName() == name) {
return it.get();
}
}
return nullptr;
return instTerms_.at(index).get();
}

} // namespace drt
2 changes: 1 addition & 1 deletion src/drt/src/db/obj/frInst.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class frInst : public frRef
static void updateXform(dbTransform& xform, Point& size);
Rect getBoundaryBBox() const;

frInstTerm* getInstTerm(const std::string& name);
frInstTerm* getInstTerm(int index);

private:
frString name_;
Expand Down
3 changes: 2 additions & 1 deletion src/drt/src/io/io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1170,8 +1170,9 @@ void io::Parser::setAccessPoints(odb::dbDatabase* db)
if (inst == nullptr) {
continue;
}
int iterm_index = 0;
for (auto db_term : db_inst->getITerms()) {
auto term = inst->getInstTerm(db_term->getMTerm()->getName());
auto term = inst->getInstTerm(iterm_index++);
if (term == nullptr) {
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion src/drt/src/pa/FlexPA_prep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2241,7 +2241,7 @@ bool FlexPA::isSkipInstTerm(frInstTerm* in)
auto instClass = unique_insts_.getClass(in->getInst());
if (instClass != nullptr) {
for (auto& inst : *instClass) {
frInstTerm* it = inst->getInstTerm(in->getTerm()->getName());
frInstTerm* it = inst->getInstTerm(in->getIndexInOwner());
if (!in_net) {
if (it->getNet()) {
return false;
Expand Down
3 changes: 2 additions & 1 deletion src/drt/src/pa/FlexPA_unique.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ class UniqueInsts
// Mapp all instances to their representative unique instance
std::map<frInst*, frInst*, frBlockObjectComp> inst2unique_;
// Maps all instances to the set of instances with the same unique inst
std::map<frInst*, std::set<frInst*, frBlockObjectComp>*> inst2Class_;
std::unordered_map<frInst*, std::set<frInst*, frBlockObjectComp>*>
inst2Class_;
// Maps a unique instance to its pin access index
std::map<frInst*, int, frBlockObjectComp> unique2paidx_;
// Maps a unique instance to its index in unique_
Expand Down

0 comments on commit fd1b211

Please sign in to comment.