@@ -250,7 +250,7 @@ void PatternRoute::constructDetours(GridGraphView<bool>& congestion_view)
250250 && !node->getPaths ()[0 ][0 ]->isOptional ());
251251 auto & path = node->getPaths ()[0 ][0 ];
252252 buildScaffolds (path);
253- unsigned direction
253+ int direction
254254 = (node->y () == path->y () ? MetalLayer::H : MetalLayer::V);
255255 if (!scaffoldNodes[direction][path->getIndex ()]
256256 && congestion_view.check (*node, *path)) {
@@ -261,7 +261,7 @@ void PatternRoute::constructDetours(GridGraphView<bool>& congestion_view)
261261 for (auto & childPaths : node->getPaths ()) {
262262 for (auto & path : childPaths) {
263263 buildScaffolds (path);
264- unsigned direction
264+ int direction
265265 = (node->y () == path->y () ? MetalLayer::H : MetalLayer::V);
266266 if (path->isOptional ()) {
267267 if (!scaffoldNodes[direction][node->getIndex ()]
@@ -289,7 +289,7 @@ void PatternRoute::constructDetours(GridGraphView<bool>& congestion_view)
289289 }
290290 }
291291 for (auto & child : node->getChildren ()) {
292- for (unsigned direction = 0 ; direction < 2 ; direction++) {
292+ for (int direction = 0 ; direction < 2 ; direction++) {
293293 if (scaffoldNodes[direction][child->getIndex ()]) {
294294 scaffolds[direction].emplace_back (
295295 std::make_shared<ScaffoldNode>(node));
@@ -304,7 +304,7 @@ void PatternRoute::constructDetours(GridGraphView<bool>& congestion_view)
304304 };
305305
306306 buildScaffolds (routing_dag_);
307- for (unsigned direction = 0 ; direction < 2 ; direction++) {
307+ for (int direction = 0 ; direction < 2 ; direction++) {
308308 if (scaffoldNodes[direction][routing_dag_->getIndex ()]) {
309309 scaffolds[direction].emplace_back (
310310 std::make_shared<ScaffoldNode>(nullptr ));
@@ -316,12 +316,12 @@ void PatternRoute::constructDetours(GridGraphView<bool>& congestion_view)
316316 std::function<void (const std::shared_ptr<ScaffoldNode>&,
317317 IntervalT&,
318318 std::vector<int >&,
319- unsigned ,
319+ int ,
320320 bool )>
321321 getTrunkAndStems = [&](const std::shared_ptr<ScaffoldNode>& scaffoldNode,
322322 IntervalT& trunk,
323323 std::vector<int >& stems,
324- unsigned direction,
324+ int direction,
325325 bool starting) {
326326 if (starting) {
327327 if (scaffoldNode->node ) {
@@ -362,9 +362,9 @@ void PatternRoute::constructDetours(GridGraphView<bool>& congestion_view)
362362 };
363363
364364 std::function<std::shared_ptr<PatternRoutingNode>(
365- std::shared_ptr<ScaffoldNode>, unsigned , int )>
365+ std::shared_ptr<ScaffoldNode>, int , int )>
366366 buildDetour = [&](const std::shared_ptr<ScaffoldNode>& scaffoldNode,
367- unsigned direction,
367+ int direction,
368368 int shiftAmount) {
369369 std::shared_ptr<PatternRoutingNode> treeNode = scaffoldNode->node ;
370370 if (treeNode->getFixedLayers ().IsValid ()) {
@@ -416,7 +416,7 @@ void PatternRoute::constructDetours(GridGraphView<bool>& congestion_view)
416416 return shiftedTreeNode;
417417 };
418418
419- for (unsigned direction = 0 ; direction < 2 ; direction++) {
419+ for (int direction = 0 ; direction < 2 ; direction++) {
420420 for (const std::shared_ptr<ScaffoldNode>& scaffold : scaffolds[direction]) {
421421 assert (scaffold->children .size () == 1 );
422422
@@ -428,30 +428,29 @@ void PatternRoute::constructDetours(GridGraphView<bool>& congestion_view)
428428 int originalLength = getTotalStemLength (stems, trunkPos);
429429 IntervalT shiftInterval (trunkPos);
430430 int maxLengthIncrease = trunk.range () * constants_.max_detour_ratio ;
431- while (shiftInterval.low - 1 >= 0
432- && getTotalStemLength (stems, shiftInterval.low - 1 )
431+ while (shiftInterval.low () - 1 >= 0
432+ && getTotalStemLength (stems, shiftInterval.low () - 1 )
433433 - originalLength
434434 <= maxLengthIncrease) {
435- shiftInterval.low -- ;
435+ shiftInterval.addToLow (- 1 ) ;
436436 }
437- while (shiftInterval.high + 1 < grid_graph_->getSize (1 - direction)
438- && getTotalStemLength (stems, shiftInterval.high - 1 )
437+ while (shiftInterval.high () + 1 < grid_graph_->getSize (1 - direction)
438+ && getTotalStemLength (stems, shiftInterval.high () - 1 )
439439 - originalLength
440440 <= maxLengthIncrease) {
441- shiftInterval.high ++ ;
441+ shiftInterval.addToHigh ( 1 ) ;
442442 }
443443 int step = 1 ;
444- while ((trunkPos - shiftInterval.low ) / (step + 1 )
445- + (shiftInterval.high - trunkPos) / (step + 1 )
444+ while ((trunkPos - shiftInterval.low () ) / (step + 1 )
445+ + (shiftInterval.high () - trunkPos) / (step + 1 )
446446 >= constants_.target_detour_count ) {
447447 step++;
448448 }
449449
450- shiftInterval.low
451- = trunkPos - (trunkPos - shiftInterval.low ) / step * step;
452- shiftInterval.high
453- = trunkPos + (shiftInterval.high - trunkPos) / step * step;
454- for (int pos = shiftInterval.low ; pos <= shiftInterval.high ;
450+ shiftInterval.Set (
451+ trunkPos - (trunkPos - shiftInterval.low ()) / step * step,
452+ trunkPos + (shiftInterval.high () - trunkPos) / step * step);
453+ for (int pos = shiftInterval.low (); pos <= shiftInterval.high ();
455454 pos += step) {
456455 int shiftAmount = (pos - trunkPos);
457456 if (shiftAmount == 0 ) {
@@ -540,8 +539,7 @@ void PatternRoute::calculateRoutingCosts(
540539 for (int pathIndex = 0 ; pathIndex < childPaths.size (); pathIndex++) {
541540 std::shared_ptr<PatternRoutingNode>& path = childPaths[pathIndex];
542541 calculateRoutingCosts (path);
543- unsigned direction
544- = node->x () == path->x () ? MetalLayer::V : MetalLayer::H;
542+ int direction = node->x () == path->x () ? MetalLayer::V : MetalLayer::H;
545543 assert ((*node)[1 - direction] == (*path)[1 - direction]);
546544 for (int layerIndex = constants_.min_routing_layer ;
547545 layerIndex < grid_graph_->getNumLayers ();
@@ -577,11 +575,11 @@ void PatternRoute::calculateRoutingCosts(
577575 + grid_graph_->getViaCost (layerIndex - 1 , *node);
578576 }
579577 IntervalT fixedLayers (node->getFixedLayers ());
580- fixedLayers.low = std::min (fixedLayers.low ,
581- static_cast <int >(grid_graph_->getNumLayers ()) - 1 );
582- fixedLayers. high = std::max (fixedLayers.high , constants_.min_routing_layer );
578+ fixedLayers.Set ( std::min (fixedLayers.low () ,
579+ static_cast <int >(grid_graph_->getNumLayers ()) - 1 ),
580+ std::max (fixedLayers.high () , constants_.min_routing_layer ) );
583581
584- for (int lowLayerIndex = 0 ; lowLayerIndex <= fixedLayers.low ;
582+ for (int lowLayerIndex = 0 ; lowLayerIndex <= fixedLayers.low () ;
585583 lowLayerIndex++) {
586584 std::vector<CostT> minChildCosts;
587585 std::vector<std::pair<int , int >> bestPaths;
@@ -603,7 +601,7 @@ void PatternRoute::calculateRoutingCosts(
603601 childCosts[child_index][layerIndex].second , layerIndex);
604602 }
605603 }
606- if (layerIndex >= fixedLayers.high ) {
604+ if (layerIndex >= fixedLayers.high () ) {
607605 CostT cost = viaCosts[layerIndex] - viaCosts[lowLayerIndex];
608606 for (CostT childCost : minChildCosts) {
609607 cost += childCost;
@@ -682,13 +680,13 @@ std::shared_ptr<GRTreeNode> PatternRoute::getRoutingTree(
682680 }
683681 }
684682 }
685- if (lowestRoutingNode->getLayerIdx () > node->getFixedLayers ().low ) {
683+ if (lowestRoutingNode->getLayerIdx () > node->getFixedLayers ().low () ) {
686684 lowestRoutingNode->addChild (std::make_shared<GRTreeNode>(
687- node->getFixedLayers ().low , node->x (), node->y ()));
685+ node->getFixedLayers ().low () , node->x (), node->y ()));
688686 }
689- if (highestRoutingNode->getLayerIdx () < node->getFixedLayers ().high ) {
687+ if (highestRoutingNode->getLayerIdx () < node->getFixedLayers ().high () ) {
690688 highestRoutingNode->addChild (std::make_shared<GRTreeNode>(
691- node->getFixedLayers ().high , node->x (), node->y ()));
689+ node->getFixedLayers ().high () , node->x (), node->y ()));
692690 }
693691 return routingNode;
694692}
0 commit comments