Skip to content

Commit e48606a

Browse files
authored
Merge pull request #8182 from gs-chaitanya/latest_working_branch
Support for Rectilinear Dies in PPL
2 parents f979260 + 52bdd10 commit e48606a

File tree

9 files changed

+1537
-48
lines changed

9 files changed

+1537
-48
lines changed

src/ppl/include/ppl/IOPlacer.h

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ enum class Edge
6666
bottom,
6767
left,
6868
right,
69-
invalid
69+
invalid,
70+
polygonEdge,
7071
};
7172

7273
enum class Direction
@@ -147,8 +148,14 @@ class IOPlacer
147148
IOPin& first_pin);
148149
void placeFallbackGroup(const std::pair<std::vector<int>, bool>& group,
149150
int place_slot);
150-
void findSlots(const std::set<int>& layers, Edge edge);
151-
std::vector<Point> findLayerSlots(int layer, Edge edge);
151+
void findSlots(const std::set<int>& layers,
152+
Edge edge,
153+
odb::Line line,
154+
bool is_die_polygon);
155+
std::vector<Point> findLayerSlots(int layer,
156+
Edge edge,
157+
odb::Line line,
158+
bool is_die_polygon);
152159
void initTopLayerGrid();
153160
void findSlotsForTopLayer();
154161
void filterObstructedSlotsForTopLayer();
@@ -170,9 +177,14 @@ class IOPlacer
170177
void checkPinsInMultipleGroups();
171178
bool overlappingConstraints(const Constraint& c1, const Constraint& c2);
172179
void createSectionsPerEdge(Edge edge, const std::set<int>& layers);
180+
void createSectionsPerEdgePolygon(odb::Line poly_edge,
181+
const std::set<int>& layers);
182+
bool isPointOnLine(const odb::Point& point, const odb::Line& line) const;
173183
void createSections();
184+
void createSectionsPolygon();
174185
void addGroupToFallback(const std::vector<int>& pin_group, bool order);
175186
bool assignPinsToSections(int assigned_pins_count);
187+
bool assignPinsToSectionsPolygon(int assigned_pins_count);
176188
bool assignPinToSection(IOPin& io_pin,
177189
int idx,
178190
std::vector<Section>& sections);
@@ -202,14 +214,16 @@ class IOPlacer
202214
void excludeInterval(Interval interval);
203215

204216
void updateOrientation(IOPin& pin);
217+
bool isPointInsidePolygon(odb::Point point, const odb::Polygon& polygon);
218+
void updateOrientationPolygon(IOPin& pin);
205219
void updatePinArea(IOPin& pin);
206220
void movePinToTrack(odb::Point& pos,
207221
int layer,
208222
int width,
209223
int height,
210224
const Rect& die_boundary);
211225
Interval getIntervalFromPin(IOPin& io_pin, const Rect& die_boundary);
212-
bool checkBlocked(Edge edge, const odb::Point& pos, int layer);
226+
bool checkBlocked(Edge edge, odb::Line, const odb::Point& pos, int layer);
213227
std::vector<Interval> findBlockedIntervals(const odb::Rect& die_area,
214228
const odb::Rect& box);
215229
void getBlockedRegionsFromMacros();

src/ppl/src/Core.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ int Core::getPerimeter() const
2020
return (x + y) * 2;
2121
}
2222

23+
std::vector<odb::Line> Core::getDieAreaEdges()
24+
{
25+
return die_area_edges_;
26+
}
27+
2328
odb::Point Core::getMirroredPosition(const odb::Point& position) const
2429
{
2530
odb::Point mirrored_pos = position;

src/ppl/src/Core.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ class Core
3030
const std::map<int, int>& min_area_y,
3131
const std::map<int, int>& min_width_x,
3232
const std::map<int, int>& min_width_y,
33-
const int& database_unit)
33+
const int& database_unit,
34+
const std::vector<odb::Line>& die_area_edges)
3435
: boundary_(boundary),
3536
min_dst_pins_x_(min_dst_pins_x),
3637
min_dst_pins_y_(min_dst_pins_y),
@@ -42,7 +43,8 @@ class Core
4243
min_area_y_(min_area_y),
4344
min_width_x_(min_width_x),
4445
min_width_y_(min_width_y),
45-
database_unit_(database_unit)
46+
database_unit_(database_unit),
47+
die_area_edges_(die_area_edges)
4648
{
4749
}
4850

@@ -60,6 +62,7 @@ class Core
6062
int getDatabaseUnit() const { return database_unit_; }
6163
int getPerimeter() const;
6264
odb::Point getMirroredPosition(const odb::Point& position) const;
65+
std::vector<odb::Line> getDieAreaEdges();
6366

6467
private:
6568
Rect boundary_;
@@ -74,6 +77,7 @@ class Core
7477
std::map<int, int> min_width_x_;
7578
std::map<int, int> min_width_y_;
7679
int database_unit_;
80+
std::vector<odb::Line> die_area_edges_; // stores edges of the polygon
7781
};
7882

7983
} // namespace ppl

src/ppl/src/HungarianMatching.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,10 @@ void HungarianMatching::getFinalAssignment(std::vector<IOPin>& assignment,
135135
io_pin.setLayer(slots_[slot_index].layer);
136136
io_pin.setPlaced();
137137
io_pin.setEdge(slots_[slot_index].edge);
138+
// Set line information only for polygon edges
139+
if (slots_[slot_index].edge == Edge::polygonEdge) {
140+
io_pin.setLine(slots_[slot_index].containing_line);
141+
}
138142
assignment.push_back(io_pin);
139143
slots_[slot_index].used = true;
140144

@@ -317,6 +321,10 @@ void HungarianMatching::getAssignmentForGroups(std::vector<IOPin>& assignment,
317321
io_pin.setPosition(slots_[slot_index + pin_cnt].pos);
318322
io_pin.setLayer(slots_[slot_index + pin_cnt].layer);
319323
io_pin.setEdge(slots_[slot_index + pin_cnt].edge);
324+
// Set line information only for polygon edges
325+
if (slots_[slot_index + pin_cnt].edge == Edge::polygonEdge) {
326+
io_pin.setLine(slots_[slot_index + pin_cnt].containing_line);
327+
}
320328
assignment.push_back(io_pin);
321329
slots_[slot_index + pin_cnt].used = true;
322330
slots_[slot_index + pin_cnt].blocked = true;

0 commit comments

Comments
 (0)