Skip to content

Commit 3351fe4

Browse files
committed
drt: Add drt layer length utility
Add a DRT analogue of `grt::route_layer_lenghts` for RC correlation experiments. Signed-off-by: Martin Povišer <[email protected]>
1 parent eb8cbad commit 3351fe4

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

src/drt/include/triton_route/TritonRoute.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class dbDatabase;
2020
class dbInst;
2121
class dbBTerm;
2222
class dbNet;
23+
class dbWire;
2324
} // namespace odb
2425

2526
namespace utl {
@@ -163,6 +164,7 @@ class TritonRoute
163164
const std::list<std::unique_ptr<frMarker>>& markers,
164165
const std::string& marker_name,
165166
odb::Rect drcBox = odb::Rect(0, 0, 0, 0)) const;
167+
std::vector<int> routeLayerLengths(odb::dbWire* wire) const;
166168
void checkDRC(const char* filename,
167169
int x1,
168170
int y1,

src/drt/src/TritonRoute.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,4 +1385,24 @@ void TritonRoute::reportDRC(const std::string& file_name,
13851385
tool_category->writeTR(file_name);
13861386
}
13871387

1388+
std::vector<int> TritonRoute::routeLayerLengths(odb::dbWire* wire) const
1389+
{
1390+
std::vector<int> lengths;
1391+
lengths.resize(db_->getTech()->getLayerCount());
1392+
odb::dbWireShapeItr shapes;
1393+
odb::dbShape s;
1394+
1395+
for (shapes.begin(wire); shapes.next(s);) {
1396+
if (!s.isVia()) {
1397+
lengths[s.getTechLayer()->getNumber()] += s.getLength();
1398+
} else {
1399+
if (s.getTechVia()) {
1400+
lengths[s.getTechVia()->getBottomLayer()->getNumber() + 1] += 1;
1401+
}
1402+
}
1403+
}
1404+
1405+
return lengths;
1406+
}
1407+
13881408
} // namespace drt

src/drt/src/TritonRoute.i

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313

1414
%include "../../Exception.i"
1515

16+
%import <stl.i>
17+
%import <std_vector.i>
18+
%template(vector_int) std::vector<int>;
19+
1620
%inline %{
1721

1822
int detailed_route_num_drvs()
@@ -218,4 +222,12 @@ void check_drc_cmd(const char* drc_file, int x1, int y1, int x2, int y2, const c
218222
const int num_threads = ord::OpenRoad::openRoad()->getThreadCount();
219223
router->checkDRC(drc_file, x1, y1, x2, y2, marker_name, num_threads);
220224
}
225+
226+
std::vector<int>
227+
route_layer_lengths(odb::dbWire* db_wire)
228+
{
229+
auto* router = ord::OpenRoad::openRoad()->getTritonRoute();
230+
return router->routeLayerLengths(db_wire);
231+
}
232+
221233
%} // inline

0 commit comments

Comments
 (0)