Skip to content

Commit f3b3955

Browse files
authored
Merge pull request #7477 from eder-matheus/ppl_fix
ppl/odb: enure constraint regions are inside die area
2 parents a18ded1 + b42059e commit f3b3955

File tree

6 files changed

+460
-0
lines changed

6 files changed

+460
-0
lines changed

src/odb/src/db/dbBlock.cpp

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1730,6 +1730,8 @@ Polygon dbBlock::getBTermTopLayerGridRegion()
17301730

17311731
Rect dbBlock::findConstraintRegion(const Direction2D& edge, int begin, int end)
17321732
{
1733+
_dbBlock* block = (_dbBlock*) this;
1734+
block->ensureConstraintRegion(edge, begin, end);
17331735
Rect constraint_region;
17341736
const Rect& die_bounds = getDieArea();
17351737
if (edge == south) {
@@ -3633,4 +3635,36 @@ void _dbBlock::collectMemInfo(MemInfo& info)
36333635
info.children_["module_name_id_map"].add(_module_name_id_map);
36343636
}
36353637

3638+
void _dbBlock::ensureConstraintRegion(const Direction2D& edge,
3639+
int& begin,
3640+
int& end)
3641+
{
3642+
/// Ensure that the constraint region defined in the given edge is completely
3643+
/// inside the die area.
3644+
dbBlock* block = (dbBlock*) this;
3645+
const int input_begin = begin;
3646+
const int input_end = end;
3647+
const Rect& die_bounds = block->getDieArea();
3648+
if (edge == south || edge == north) {
3649+
begin = std::max(begin, die_bounds.xMin());
3650+
end = std::min(end, die_bounds.xMax());
3651+
} else if (edge == west || edge == east) {
3652+
begin = std::max(begin, die_bounds.yMin());
3653+
end = std::min(end, die_bounds.yMax());
3654+
}
3655+
3656+
if (input_begin != begin || input_end != end) {
3657+
utl::Logger* logger = getImpl()->getLogger();
3658+
logger->warn(utl::ODB,
3659+
11,
3660+
"Region {}-{} on edge {} modified to {}-{} to respect the "
3661+
"die area limits.",
3662+
block->dbuToMicrons(input_begin),
3663+
block->dbuToMicrons(input_end),
3664+
edge,
3665+
block->dbuToMicrons(begin),
3666+
block->dbuToMicrons(end));
3667+
}
3668+
}
3669+
36363670
} // namespace odb

src/odb/src/db/dbBlock.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ class _dbBlock : public _dbObject
314314
dbObjectTable* getObjectTable(dbObjectType type);
315315
void collectMemInfo(MemInfo& info);
316316
void clearSystemBlockagesAndObstructions();
317+
void ensureConstraintRegion(const Direction2D& edge, int& begin, int& end);
317318
};
318319

319320
dbOStream& operator<<(dbOStream& stream, const _dbBlock& block);

src/ppl/test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ or_integration_tests(
1919
add_constraint16
2020
add_constraint17
2121
add_constraint18
22+
add_constraint19
2223
add_constraint_debug
2324
add_constraint_error1
2425
add_constraint_error2

0 commit comments

Comments
 (0)