@@ -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
0 commit comments