Skip to content

Commit 13180d9

Browse files
authored
Merge pull request #8595 from titan73/fix_pd_y_gap
ifp: Fix y gap between power domains
2 parents 43df049 + 8356c06 commit 13180d9

11 files changed

+911
-358
lines changed

src/ifp/src/InitFloorplan.cc

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -467,10 +467,6 @@ void InitFloorplan::updateVoltageDomain(const int core_lx,
467467
const int core_ux,
468468
const int core_uy)
469469
{
470-
// The unit for power_domain_y_space is the site height. The real space is
471-
// power_domain_y_space * site_dy
472-
const int power_domain_y_space = 6;
473-
474470
// checks if a group is defined as a voltage domain, if so it creates a region
475471
for (dbGroup* group : block_->getGroups()) {
476472
if (group->getType() == dbGroupType::VOLTAGE_DOMAIN
@@ -499,7 +495,28 @@ void InitFloorplan::updateVoltageDomain(const int core_lx,
499495

500496
int total_row_count = rows.size();
501497

498+
// Search the minimum site width & height as base unit for snapping and
499+
// gap calculation
500+
int min_site_dx = std::numeric_limits<int>::max();
501+
int min_site_dy = std::numeric_limits<int>::max();
502502
std::vector<dbRow*>::iterator row_itr = rows.begin();
503+
for (int row_processed = 0; row_processed < total_row_count;
504+
row_processed++) {
505+
dbRow* row = *row_itr;
506+
auto site = row->getSite();
507+
int site_dy = site->getHeight();
508+
if (site_dy < min_site_dy) {
509+
min_site_dy = site_dy;
510+
}
511+
int site_dx = site->getWidth();
512+
if (site_dx < min_site_dx) {
513+
min_site_dx = site_dx;
514+
}
515+
}
516+
// Space is 6 times the minimum site height
517+
const int power_domain_y_space = 6 * min_site_dy;
518+
519+
row_itr = rows.begin();
503520
for (int row_processed = 0; row_processed < total_row_count;
504521
row_processed++) {
505522
dbRow* row = *row_itr;
@@ -508,17 +525,18 @@ void InitFloorplan::updateVoltageDomain(const int core_lx,
508525
int row_y_max = row_bbox.yMax();
509526
auto site = row->getSite();
510527

511-
int site_dy = site->getHeight();
512528
int site_dx = site->getWidth();
513529

514530
// snap inward to site grid
515-
domain_x_min = odb::makeSiteLoc(domain_x_min, site_dx, false, 0);
516-
domain_x_max = odb::makeSiteLoc(domain_x_max, site_dx, true, 0);
531+
domain_x_min = odb::makeSiteLoc(domain_x_min, min_site_dx, false, 0);
532+
domain_x_max = odb::makeSiteLoc(domain_x_max, min_site_dx, true, 0);
533+
domain_y_min = odb::makeSiteLoc(domain_y_min, min_site_dy, false, 0);
534+
domain_y_max = odb::makeSiteLoc(domain_y_max, min_site_dy, true, 0);
517535

518536
// check if the rows overlapped with the area of a defined voltage
519537
// domains + margin
520-
if (row_y_max + power_domain_y_space * site_dy <= domain_y_min
521-
|| row_y_min >= domain_y_max + power_domain_y_space * site_dy) {
538+
if (row_y_max + power_domain_y_space <= domain_y_min
539+
|| row_y_min >= domain_y_max + power_domain_y_space) {
522540
row_itr++;
523541
} else {
524542
string row_name = row->getName();
@@ -527,7 +545,7 @@ void InitFloorplan::updateVoltageDomain(const int core_lx,
527545
row_itr++;
528546

529547
// lcr stands for left core row
530-
int lcr_x_max = domain_x_min - power_domain_y_space * site_dy;
548+
int lcr_x_max = domain_x_min - power_domain_y_space;
531549
// in case there is at least one valid site width on the left, create
532550
// left core rows
533551
if (lcr_x_max > core_lx + site_dx) {
@@ -552,7 +570,7 @@ void InitFloorplan::updateVoltageDomain(const int core_lx,
552570
}
553571

554572
// rcr stands for right core row
555-
int rcr_x_min = domain_x_max + power_domain_y_space * site_dy;
573+
int rcr_x_min = domain_x_max + power_domain_y_space;
556574
// snap to the site grid rightward
557575
rcr_x_min = odb::makeSiteLoc(rcr_x_min, site_dx, false, 0);
558576

src/ifp/test/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ COMPULSORY_TESTS = [
1818
"init_floorplan8",
1919
"init_floorplan9",
2020
"init_floorplan10",
21+
"init_floorplan_dbl_row",
2122
"init_floorplan_even_rows",
2223
"init_floorplan_flip_sites",
2324
"init_floorplan_odd_rows",

src/ifp/test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ or_integration_tests(
1313
init_floorplan8
1414
init_floorplan9
1515
init_floorplan10
16+
init_floorplan_dbl_row
1617
init_floorplan_even_rows
1718
init_floorplan_flip_sites
1819
init_floorplan_odd_rows

src/ifp/test/init_floorplan8.defok

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ ROW ROW_29_2 FreePDK45_38x28_10R_NP_162NW_34O 136800 123200 FS DO 324 BY 1 STEP
3737
ROW ROW_30_2 FreePDK45_38x28_10R_NP_162NW_34O 136800 126000 N DO 324 BY 1 STEP 380 0 ;
3838
ROW ROW_31_2 FreePDK45_38x28_10R_NP_162NW_34O 136800 128800 FS DO 324 BY 1 STEP 380 0 ;
3939
ROW ROW_32_2 FreePDK45_38x28_10R_NP_162NW_34O 136800 131600 N DO 324 BY 1 STEP 380 0 ;
40-
ROW ROW_33_2 FreePDK45_38x28_10R_NP_162NW_34O 136800 134400 FS DO 324 BY 1 STEP 380 0 ;
40+
ROW ROW_33 FreePDK45_38x28_10R_NP_162NW_34O 40280 134400 FS DO 578 BY 1 STEP 380 0 ;
4141
ROW ROW_34 FreePDK45_38x28_10R_NP_162NW_34O 40280 137200 N DO 578 BY 1 STEP 380 0 ;
4242
ROW ROW_35 FreePDK45_38x28_10R_NP_162NW_34O 40280 140000 FS DO 578 BY 1 STEP 380 0 ;
4343
ROW ROW_36 FreePDK45_38x28_10R_NP_162NW_34O 40280 142800 N DO 578 BY 1 STEP 380 0 ;

0 commit comments

Comments
 (0)