Correct interval capacity computation around zero in RoutingLayerGauge.

* Bug: In CRL::RoutingLayerGauge::divide() & getTrackNumber(), the number
    of traks crossing an edge was wrongly computed for GCells around the
    zero coordinate, this was due to the change in rouding direction
    around zero. It was starting to show for routing gauges with an offset.
      Note: to simplificate the computation of the capacity of an interval,
    all the track over a Cell are computed from (0,0). The Cell abutment
    box has to be choosen relative to that. The tracks positions are fixed
    all over the Cell (or chip if it is one).
This commit is contained in:
Jean-Paul Chaput 2018-04-13 14:59:40 +02:00
parent 6b4baad8b9
commit cabbab5140
1 changed files with 23 additions and 11 deletions

View File

@ -174,19 +174,19 @@ namespace CRL {
void RoutingLayerGauge::divide ( DbU::Unit dividend, long& quotient, long& modulo ) const
{
quotient = ( dividend - _offset ) / _pitch;
quotient = ( dividend - _offset ) / _pitch - ((dividend < _offset) ? 1 : 0);
modulo = ( dividend - _offset ) % _pitch;
}
unsigned RoutingLayerGauge::getTrackNumber ( DbU::Unit start, DbU::Unit stop ) const
{
if ( start > stop )
throw Error ( badInterval
, getString(this).c_str()
, DbU::getValueString(start).c_str()
, DbU::getValueString(stop).c_str()
);
if (start > stop)
throw Error( badInterval
, getString(this).c_str()
, DbU::getValueString(start).c_str()
, DbU::getValueString(stop).c_str()
);
long startModulo;
long startQuotient;
@ -194,14 +194,26 @@ namespace CRL {
long stopQuotient;
long trackNumber;
divide ( start, startQuotient, startModulo );
divide ( stop , stopQuotient , stopModulo );
divide( start, startQuotient, startModulo );
divide( stop , stopQuotient , stopModulo );
if ( startModulo != 0 ) startQuotient += 1;
// cerr << "getTrackNumber() " << getLayer()->getName()
// << " start:" << startQuotient << " modulo:" << startModulo
// << " stop:" << stopQuotient << " modulo:" << stopModulo
// << endl;
if (startModulo != 0) startQuotient += 1;
if (stopModulo == 0) stopQuotient -= 1;
trackNumber = stopQuotient - startQuotient + 1;
return ( (trackNumber>0) ? trackNumber : 0 );
// cerr << "getTrackNumber() " << getLayer()->getName()
// << " [" << DbU::getValueString(start) << " " << DbU::getValueString(stop)
// << "] tracks:" << trackNumber
// << " start:" << startQuotient << " stop:" << stopQuotient
// << endl;
return (trackNumber>0) ? trackNumber : 0;
}