@@ -382,12 +382,11 @@ void HTreeBuilder::computeLevelTopology(unsigned level,
382382 const unsigned numWires = (segmentLength - length) / charSegLength;
383383
384384 if (numWires >= 1 ) {
385- length += numWires * charSegLength;
386385 for (int wireCount = 0 ; wireCount < numWires; ++wireCount) {
387386 unsigned outCap = 0 , outSlew = 0 ;
388387 unsigned key = 0 ;
389388 if (options_->isSimpleSegmentEnabled ()) {
390- remainingLength = remainingLength - charSegLength;
389+ remainingLength -= charSegLength;
391390
392391 if (segmentLength >= vertexBufferLength && (wireCount + 1 >= numWires)
393392 && options_->isVertexBuffersEnabled ()) {
@@ -401,9 +400,8 @@ void HTreeBuilder::computeLevelTopology(unsigned level,
401400 outCap,
402401 true ,
403402 remainingLength);
404- remainingLength = remainingLength
405- + options_->getBufferDistance ()
406- / (techChar_->getLengthUnit ());
403+ remainingLength
404+ += options_->getBufferDistance () / (techChar_->getLengthUnit ());
407405 } else {
408406 if (remainingLength <= 0 ) {
409407 key = computeMinDelaySegment (charSegLength,
@@ -415,9 +413,8 @@ void HTreeBuilder::computeLevelTopology(unsigned level,
415413 outCap,
416414 true ,
417415 remainingLength);
418- remainingLength = remainingLength
419- + options_->getBufferDistance ()
420- / (techChar_->getLengthUnit ());
416+ remainingLength += options_->getBufferDistance ()
417+ / (techChar_->getLengthUnit ());
421418 } else {
422419 key = computeMinDelaySegment (charSegLength,
423420 inputSlew,
@@ -440,6 +437,12 @@ void HTreeBuilder::computeLevelTopology(unsigned level,
440437 outCap);
441438 }
442439
440+ if (key == std::numeric_limits<unsigned >::max ()) {
441+ // No tech char entry found.
442+ continue ;
443+ }
444+
445+ length += charSegLength;
443446 techChar_->reportSegment (key);
444447
445448 inputCap = std::max (outCap, minInputCap_);
0 commit comments