Skip to content

Commit 4f65393

Browse files
authored
Merge pull request #8367 from gadfort/pdn-fix-edge-connect
pdn: fix pad edge connections
2 parents e48606a + f266f4c commit 4f65393

12 files changed

+114179
-35
lines changed

src/pdn/src/grid.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,6 +1295,13 @@ void CoreGrid::setupDirectConnect(
12951295
if (pad_connect->canConnect()) {
12961296
straps.insert(pad_connect.get());
12971297
addStrap(std::move(pad_connect));
1298+
} else {
1299+
debugPrint(getLogger(),
1300+
utl::PDN,
1301+
"Pad",
1302+
2,
1303+
"Rejecting pad cell pin {} due to lack of connectivity",
1304+
iterm->getName())
12981305
}
12991306
}
13001307
}

src/pdn/src/straps.cpp

Lines changed: 54 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,14 @@ void PadDirectConnectionStraps::initialize(ConnectionType type)
614614
pins_ = getPinsFormingRing();
615615
break;
616616
}
617+
618+
debugPrint(getLogger(),
619+
utl::PDN,
620+
"Pad",
621+
2,
622+
"{} has {} pins",
623+
getName(),
624+
pins_.size());
617625
}
618626

619627
std::map<odb::dbTechLayer*, std::vector<odb::dbBox*>>
@@ -653,8 +661,6 @@ std::vector<odb::dbBox*> PadDirectConnectionStraps::getPinsFacingCore()
653661

654662
const bool is_horizontal = is_west || is_east;
655663

656-
std::vector<odb::dbBox*> pins;
657-
658664
auto pins_by_layer = getPinsByLayer();
659665
if (!layers_.empty()) {
660666
// remove unspecified layers
@@ -669,37 +675,6 @@ std::vector<odb::dbBox*> PadDirectConnectionStraps::getPinsFacingCore()
669675
}
670676
}
671677

672-
// check for pin directions
673-
bool has_horizontal_pins = false;
674-
bool has_vertical_pins = false;
675-
for (const auto& [layer, layer_pins] : pins_by_layer) {
676-
if (layer->getDirection() == odb::dbTechLayerDir::HORIZONTAL) {
677-
has_horizontal_pins = true;
678-
}
679-
if (layer->getDirection() == odb::dbTechLayerDir::VERTICAL) {
680-
has_vertical_pins = true;
681-
}
682-
}
683-
684-
const bool has_multiple_directions = has_horizontal_pins && has_vertical_pins;
685-
686-
for (const auto& [layer, layer_pins] : pins_by_layer) {
687-
if (has_multiple_directions) {
688-
// only add pins that would yield correct routing directions,
689-
// otherwise keep non-preferred directions too
690-
if (is_horizontal) {
691-
if (layer->getDirection() != odb::dbTechLayerDir::HORIZONTAL) {
692-
continue;
693-
}
694-
} else {
695-
if (layer->getDirection() != odb::dbTechLayerDir::VERTICAL) {
696-
continue;
697-
}
698-
}
699-
}
700-
pins.insert(pins.end(), layer_pins.begin(), layer_pins.end());
701-
}
702-
703678
const odb::dbTransform transform = inst->getTransform();
704679

705680
// remove all pins that do not face the core
@@ -730,8 +705,52 @@ std::vector<odb::dbBox*> PadDirectConnectionStraps::getPinsFacingCore()
730705
};
731706
}
732707

733-
pins.erase(std::remove_if(pins.begin(), pins.end(), std::move(remove_func)),
734-
pins.end());
708+
for (auto& [layer, layerpins] : pins_by_layer) {
709+
layerpins.erase(
710+
std::remove_if(layerpins.begin(), layerpins.end(), remove_func),
711+
layerpins.end());
712+
}
713+
714+
for (auto itr = pins_by_layer.begin(); itr != pins_by_layer.end();) {
715+
if (itr->second.empty()) {
716+
// remove empty layer
717+
itr = pins_by_layer.erase(itr);
718+
} else {
719+
itr++;
720+
}
721+
}
722+
723+
// check for pin directions
724+
bool has_horizontal_pins = false;
725+
bool has_vertical_pins = false;
726+
for (const auto& [layer, layer_pins] : pins_by_layer) {
727+
if (layer->getDirection() == odb::dbTechLayerDir::HORIZONTAL) {
728+
has_horizontal_pins = true;
729+
}
730+
if (layer->getDirection() == odb::dbTechLayerDir::VERTICAL) {
731+
has_vertical_pins = true;
732+
}
733+
}
734+
735+
const bool has_multiple_directions = has_horizontal_pins && has_vertical_pins;
736+
737+
std::vector<odb::dbBox*> pins;
738+
for (const auto& [layer, layer_pins] : pins_by_layer) {
739+
if (has_multiple_directions) {
740+
// only add pins that would yield correct routing directions,
741+
// otherwise keep non-preferred directions too
742+
if (is_horizontal) {
743+
if (layer->getDirection() != odb::dbTechLayerDir::HORIZONTAL) {
744+
continue;
745+
}
746+
} else {
747+
if (layer->getDirection() != odb::dbTechLayerDir::VERTICAL) {
748+
continue;
749+
}
750+
}
751+
}
752+
pins.insert(pins.end(), layer_pins.begin(), layer_pins.end());
753+
}
735754

736755
if (!pins.empty()) {
737756
type_ = ConnectionType::Edge;

src/pdn/test/BUILD

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ COMPULSORY_TESTS = [
9999
"pads_black_parrot_max_width",
100100
"pads_black_parrot_no_connect",
101101
"pads_black_parrot_offset",
102+
"pads_connect_from_non_pref_edge",
102103
"power_switch",
103104
"power_switch_cut_rows",
104105
"power_switch_daisy",
@@ -176,6 +177,10 @@ filegroup(
176177
"asap7_vias/asap7sc7p5t_27_R_1x.lef",
177178
"asap7_vias/floorplan.def",
178179
"asap7_vias/floorplan_repair.def",
180+
"gf180/gf180mcu_6LM_1TM_9K_7t_tech.lef",
181+
"gf180/gf180mcu_fd_io.lef",
182+
"gf180/gf180mcu_fd_sc_mcu7t5v0.lef",
183+
"gf180_data/floorplan.def",
179184
"helpers.tcl",
180185
"nangate_bsg_black_parrot/Nangate45_maxwidth.lef",
181186
"nangate_bsg_black_parrot/dummy_pads.lef",

src/pdn/test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ or_integration_tests(
9898
pads_black_parrot_max_width
9999
pads_black_parrot_no_connect
100100
pads_black_parrot_offset
101+
pads_connect_from_non_pref_edge
101102
power_switch
102103
power_switch_cut_rows
103104
power_switch_daisy

src/pdn/test/gf180

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../test/gf180

0 commit comments

Comments
 (0)