Skip to content

Commit

Permalink
Merge pull request #5495 from gadfort/fix-pad-site-orientation
Browse files Browse the repository at this point in the history
pad: handle IO sites with rotations
  • Loading branch information
maliberty authored Aug 2, 2024
2 parents 4495373 + 27652fb commit 4906b25
Show file tree
Hide file tree
Showing 5 changed files with 895 additions and 16 deletions.
90 changes: 74 additions & 16 deletions src/pad/src/ICeWall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,29 +315,81 @@ void ICeWall::makeIORow(odb::dbSite* horizontal_site,
die.xMax() - east_offset,
die.yMax() - north_offset);

const double dbus = block->getDbUnitsPerMicron();
debugPrint(logger_,
utl::PAD,
"Rows",
1,
"Outer bounds ({:.4f}, {:.4f}) - ({:.4f}, {:.4f})",
outer_io.xMin() / dbus,
outer_io.yMin() / dbus,
outer_io.xMax() / dbus,
outer_io.yMax() / dbus);

const odb::Rect corner_box(
0, 0, corner_site->getWidth(), corner_site->getHeight());
const odb::Rect horizontal_box(
0, 0, horizontal_site->getWidth(), horizontal_site->getHeight());
const odb::Rect vertical_box(
0, 0, vertical_site->getWidth(), vertical_site->getHeight());

const int cheight = corner_site->getHeight();
const int cwidth
= std::max(horizontal_site->getHeight(), corner_site->getWidth());

const int x_sites = std::floor(static_cast<double>(outer_io.dx() - 2 * cwidth)
/ vertical_site->getWidth());
/ vertical_box.minDXDY());
outer_io.set_xhi(outer_io.xMin() + 2 * cwidth
+ x_sites * vertical_site->getWidth());
+ x_sites * vertical_box.minDXDY());
const int y_sites
= std::floor(static_cast<double>(outer_io.dy() - 2 * cheight)
/ horizontal_site->getWidth());
/ horizontal_box.minDXDY());
outer_io.set_yhi(outer_io.yMin() + 2 * cheight
+ y_sites * horizontal_site->getWidth());
+ y_sites * horizontal_box.minDXDY());

const odb::Rect corner_origins(outer_io.xMin(),
outer_io.yMin(),
outer_io.xMax() - cwidth,
outer_io.yMax() - cheight);

debugPrint(logger_,
utl::PAD,
"Rows",
2,
"x-sites {} at {:.4f}",
x_sites,
vertical_box.minDXDY() / dbus);

debugPrint(logger_,
utl::PAD,
"Rows",
2,
"y-sites {} at {:.4f}",
y_sites,
horizontal_box.minDXDY() / dbus);

debugPrint(logger_,
utl::PAD,
"Rows",
1,
"Corner origins ({:.4f}, {:.4f}) - ({:.4f}, {:.4f})",
corner_origins.xMin() / dbus,
corner_origins.yMin() / dbus,
corner_origins.xMax() / dbus,
corner_origins.yMax() / dbus);

// Create corners
const int corner_sites
= std::max(horizontal_site->getHeight(), corner_site->getWidth())
/ corner_site->getWidth();
const int corner_sites = std::max(static_cast<uint>(horizontal_box.maxDXDY()),
corner_site->getWidth())
/ corner_site->getWidth();
debugPrint(logger_,
utl::PAD,
"Rows",
1,
"corner-sites {} at {:.4f}",
corner_sites,
corner_site->getWidth() / dbus);

auto create_corner
= [this, block, corner_site, corner_sites, ring_index, &rotation_cor](
const std::string& name,
Expand Down Expand Up @@ -372,7 +424,8 @@ void ICeWall::makeIORow(odb::dbSite* horizontal_site,
const odb::Point& origin,
const odb::dbOrientType& orient,
const odb::dbOrientType& row_rotation,
const odb::dbRowDir& direction) {
const odb::dbRowDir& direction,
int site_width) {
const std::string row_name = getRowName(name, ring_index);
odb::dbTransform rotation(orient);
rotation.concat(row_rotation);
Expand All @@ -384,43 +437,47 @@ void ICeWall::makeIORow(odb::dbSite* horizontal_site,
rotation.getOrient(),
direction,
sites,
site->getWidth());
site_width);
};
create_row(row_north_,
vertical_site,
x_sites,
{nw->getBBox().xMax(),
outer_io.yMax() - static_cast<int>(vertical_site->getHeight())},
outer_io.yMax() - static_cast<int>(vertical_box.maxDXDY())},
odb::dbOrientType::MX,
rotation_ver,
odb::dbRowDir::HORIZONTAL);
odb::dbRowDir::HORIZONTAL,
vertical_box.minDXDY());
odb::dbOrientType east_rotation_hor = odb::dbOrientType::R90;
if (vertical_site != horizontal_site) {
east_rotation_hor = odb::dbOrientType::R0;
}
create_row(row_east_,
horizontal_site,
y_sites,
{outer_io.xMax() - static_cast<int>(horizontal_site->getHeight()),
{outer_io.xMax() - static_cast<int>(horizontal_box.maxDXDY()),
se->getBBox().yMax()},
east_rotation_hor,
rotation_hor,
odb::dbRowDir::VERTICAL);
odb::dbRowDir::VERTICAL,
horizontal_box.minDXDY());
create_row(row_south_,
vertical_site,
x_sites,
{sw->getBBox().xMax(), outer_io.yMin()},
odb::dbOrientType::R0,
rotation_ver,
odb::dbRowDir::HORIZONTAL);
odb::dbRowDir::HORIZONTAL,
vertical_box.minDXDY());
const odb::dbOrientType west_rotation_hor = east_rotation_hor.flipY();
create_row(row_west_,
horizontal_site,
y_sites,
{outer_io.xMin(), sw->getBBox().yMax()},
west_rotation_hor,
rotation_hor,
odb::dbRowDir::VERTICAL);
odb::dbRowDir::VERTICAL,
horizontal_box.minDXDY());
}

void ICeWall::removeIORows()
Expand Down Expand Up @@ -761,7 +818,8 @@ void ICeWall::placeFiller(

row_interval -= placed_io;

const int site_width = row->getSite()->getWidth();
const int site_width
= std::min(row->getSite()->getWidth(), row->getSite()->getHeight());
int fill_group = 0;
for (Interval::iterator it = row_interval.begin(); it != row_interval.end();
it++) {
Expand Down
Loading

0 comments on commit 4906b25

Please sign in to comment.