Skip to content

Commit 2c0e0ef

Browse files
authored
Merge pull request #8000 from luis201420/ant_use_pin_on_dsu_graph
ANT: include the geometries of the pins of a net for the calculation of antenna violations
2 parents 01162dd + df27cac commit 2c0e0ef

File tree

1 file changed

+36
-6
lines changed

1 file changed

+36
-6
lines changed

src/ant/src/AntennaChecker.cc

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,9 @@ void AntennaChecker::saveGates(odb::dbNet* db_net,
205205
{
206206
std::map<PinType, std::vector<int>, PinTypeCmp> pin_nbrs;
207207
std::vector<int> ids;
208+
// struct to save pin polygons
209+
using LayerAndPin = std::pair<int, PinType>;
210+
std::vector<LayerAndPin> pin_polys;
208211
// iterate all instance pins
209212
for (odb::dbITerm* iterm : db_net->getITerms()) {
210213
odb::dbMTerm* mterm = iterm->getMTerm();
@@ -229,6 +232,8 @@ void AntennaChecker::saveGates(odb::dbNet* db_net,
229232
transform.apply(pin_rect);
230233
// convert rect -> polygon
231234
Polygon pin_pol = rectToPolygon(pin_rect);
235+
// Save polygon to add on DSU
236+
pin_polys.emplace_back(tech_layer->getRoutingLevel(), pin);
232237
// if has wire on same layer connect to pin
233238
ids = findNodesWithIntersection(node_by_layer_map[tech_layer], pin_pol);
234239
for (const int& index : ids) {
@@ -253,6 +258,13 @@ void AntennaChecker::saveGates(odb::dbNet* db_net,
253258
}
254259
}
255260
}
261+
// Sort pin polygon based by layer level (greatest first)
262+
std::sort(pin_polys.begin(),
263+
pin_polys.end(),
264+
[](const LayerAndPin& a, const LayerAndPin& b) {
265+
return a.first > b.first;
266+
});
267+
256268
// run DSU from min_layer to max_layer
257269
std::vector<int> dsu_parent(node_count);
258270
std::vector<int> dsu_size(node_count);
@@ -267,12 +279,30 @@ void AntennaChecker::saveGates(odb::dbNet* db_net,
267279
odb::dbTechLayer* iter = tech->findRoutingLayer(1);
268280
odb::dbTechLayer* lower_layer;
269281
while (iter) {
270-
// iterate each node of this layer to union set
271-
for (auto& node_it : node_by_layer_map[iter]) {
272-
int id_u = node_it->id;
273-
// if has lower layer
274-
lower_layer = iter->getLowerLayer();
275-
if (lower_layer) {
282+
// Get lower layer
283+
lower_layer = iter->getLowerLayer();
284+
if (lower_layer) {
285+
// Check only vias layer to add pin connections
286+
if (lower_layer->getRoutingLevel() != 0) {
287+
int layer_level = lower_layer->getRoutingLevel();
288+
// only include pin on layer below to the current
289+
while (!pin_polys.empty() && layer_level >= pin_polys.back().first) {
290+
PinType pin = pin_polys.back().second;
291+
int last_id = -1;
292+
pin_polys.pop_back();
293+
// Set union of all wires connected to pin
294+
for (const int& nbr_id : pin_nbrs[pin]) {
295+
if (last_id != -1
296+
&& dsu.find_set(last_id) != dsu.find_set(nbr_id)) {
297+
dsu.union_set(last_id, nbr_id);
298+
}
299+
last_id = nbr_id;
300+
}
301+
}
302+
}
303+
// iterate each node of this layer to union set
304+
for (auto& node_it : node_by_layer_map[iter]) {
305+
int id_u = node_it->id;
276306
// get lower neighbors and union
277307
for (const int& lower_it : node_it->low_adj) {
278308
int id_v = node_by_layer_map[lower_layer][lower_it]->id;

0 commit comments

Comments
 (0)