Skip to content

Commit f1a0114

Browse files
committed
ppl: check if slot idx is negative
Signed-off-by: Eder Monteiro <[email protected]>
1 parent 5e78e00 commit f1a0114

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

src/ppl/src/HungarianMatching.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,14 @@ HungarianMatching::HungarianMatching(Section& section,
4343
Netlist* netlist,
4444
Core* core,
4545
std::vector<Slot>& slots,
46-
Logger* logger)
46+
Logger* logger,
47+
odb::dbDatabase* db)
4748
: netlist_(netlist),
4849
core_(core),
4950
pin_indices_(section.pin_indices),
5051
pin_groups_(section.pin_groups),
51-
slots_(slots)
52+
slots_(slots),
53+
db_(db)
5254
{
5355
num_io_pins_ = section.pin_indices.size();
5456
num_pin_groups_ = netlist_->numIOGroups();
@@ -149,6 +151,17 @@ void HungarianMatching::getFinalAssignment(std::vector<IOPin>& assigment,
149151
mirrored_pin.setPlaced();
150152
assigment.push_back(mirrored_pin);
151153
slot_index = getSlotIdxByPosition(mirrored_pos);
154+
if (slot_index < 0) {
155+
odb::dbTechLayer* layer
156+
= db_->getTech()->findRoutingLayer(mirrored_pin.getLayer());
157+
logger_->error(utl::PPL,
158+
82,
159+
"Mirrored position ({}, {}) at layer {} is not a "
160+
"valid position for pin placement.",
161+
mirrored_pos.getX(),
162+
mirrored_pos.getY(),
163+
layer->getName());
164+
}
152165
slots_[slot_index].used = true;
153166
}
154167
break;

src/ppl/src/HungarianMatching.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ class HungarianMatching
6565
Netlist* netlist,
6666
Core* core,
6767
std::vector<Slot>& slots,
68-
Logger* logger);
68+
Logger* logger,
69+
odb::dbDatabase* db);
6970
virtual ~HungarianMatching() = default;
7071
void findAssignment();
7172
void findAssignmentForGroups();
@@ -94,6 +95,7 @@ class HungarianMatching
9495
Edge edge_;
9596
const int hungarian_fail = std::numeric_limits<int>::max();
9697
Logger* logger_;
98+
odb::dbDatabase* db_;
9799

98100
void createMatrix();
99101
void createMatrixForGroups();

src/ppl/src/IOPlacer.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,14 +1209,16 @@ void IOPlacer::findPinAssignment(std::vector<Section>& sections)
12091209
netlist_io_pins_.get(),
12101210
core_.get(),
12111211
top_layer_slots_,
1212-
logger_);
1212+
logger_,
1213+
db_);
12131214
hg_vec.push_back(hg);
12141215
} else {
12151216
HungarianMatching hg(sections[idx],
12161217
netlist_io_pins_.get(),
12171218
core_.get(),
12181219
slots_,
1219-
logger_);
1220+
logger_,
1221+
db_);
12201222
hg_vec.push_back(hg);
12211223
}
12221224
}

0 commit comments

Comments
 (0)