Skip to content

Commit eb4122f

Browse files
committed
grt: add function to write pin locations on the groute grid
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
1 parent 2a7c8d8 commit eb4122f

3 files changed

Lines changed: 30 additions & 0 deletions

File tree

src/grt/include/grt/GlobalRouter.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,8 @@ class GlobalRouter
288288
FastRouteCore* fastroute() const { return fastroute_; }
289289
Rudy* getRudy();
290290

291+
void writePinLocations(const char* file_name);
292+
291293
private:
292294
// Net functions
293295
Net* addNet(odb::dbNet* db_net);

src/grt/src/GlobalRouter.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4782,6 +4782,29 @@ std::vector<PinGridLocation> GlobalRouter::getPinGridPositions(
47824782
return pin_locs;
47834783
}
47844784

4785+
void GlobalRouter::writePinLocations(const char* file_name)
4786+
{
4787+
std::ofstream pin_loc_file;
4788+
pin_loc_file.open(file_name);
4789+
if (!pin_loc_file) {
4790+
logger_->error(
4791+
GRT, 271, "Global route pin locations file could not be opened.");
4792+
}
4793+
4794+
for (const auto [db_net, net] : db_net_map_) {
4795+
if (!net->getPins().empty()) {
4796+
pin_loc_file << net->getName() << " " << net->getNumPins() << "\n";
4797+
for (const Pin& pin : net->getPins()) {
4798+
const odb::Point& pin_pos = pin.getOnGridPosition();
4799+
pin_loc_file << pin.getName() << " " << pin_pos.getX() << " "
4800+
<< pin_pos.getY() << "\n";
4801+
}
4802+
pin_loc_file << "\n";
4803+
}
4804+
}
4805+
pin_loc_file.close();
4806+
}
4807+
47854808
////////////////////////////////////////////////////////////////
47864809

47874810
bool operator<(const RoutePt& p1, const RoutePt& p2)

src/grt/src/GlobalRouter.i

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,11 @@ void read_segments(const char* file_name)
252252
getGlobalRouter()->readSegments(file_name);
253253
}
254254

255+
void write_pin_locations(const char* file_name)
256+
{
257+
getGlobalRouter()->writePinLocations(file_name);
258+
}
259+
255260
} // namespace
256261

257262
%} // inline

0 commit comments

Comments
 (0)