Allow nearest Track selection in Katana::RoutingPlane::getTrackByPosition().

* Change: In Katana::RoutingPlane::getTrackByPosition(), when requesting a
    track less than *one pitch* beyond the last one, return the last one
    instead of NULL. Only if the mode allows it (i.e. Nearest or Inferior).
This commit is contained in:
Jean-Paul Chaput 2018-04-13 15:00:57 +02:00
parent 580ca0892c
commit 80dcd264bb
2 changed files with 13 additions and 6 deletions

View File

@ -327,11 +327,15 @@ namespace Katana {
cdebug_log(159,0) << "* Nearest " << track << endl; cdebug_log(159,0) << "* Nearest " << track << endl;
if (not track)
throw Error( "NegociateWindow::createTracksegment(): No track near axis of %s."
, getString(autoSegment).c_str() );
if (track->getAxis() > uside.getVMax()) track = track->getPreviousTrack(); if (track->getAxis() > uside.getVMax()) track = track->getPreviousTrack();
if (track->getAxis() < uside.getVMin()) track = track->getNextTrack(); if (track->getAxis() < uside.getVMin()) track = track->getNextTrack();
if (not track) if (not track)
throw Error( "NegociateWindow::createTracksegment(): No track near axis of %s." throw Error( "NegociateWindow::createTracksegment(): No track near axis of %s (after adjust)."
, getString(autoSegment).c_str() ); , getString(autoSegment).c_str() );
cdebug_log(159,0) << "* GCell U-side " << uside << endl; cdebug_log(159,0) << "* GCell U-side " << uside << endl;

View File

@ -162,11 +162,14 @@ namespace Katana {
Track* RoutingPlane::getTrackByPosition ( DbU::Unit axis, uint32_t mode ) const Track* RoutingPlane::getTrackByPosition ( DbU::Unit axis, uint32_t mode ) const
{ {
return getTrackByIndex( getLayerGauge()->getTrackIndex( getAxisMin() size_t index = getLayerGauge()->getTrackIndex( getAxisMin(), getAxisMax(), axis, mode );
, getAxisMax() if (index == getTracksSize()) {
, axis if (not index) return NULL;
, mode if ((mode == Constant::Superior) or (mode == Constant::Exact)) return NULL;
) ); --index;
}
return getTrackByIndex( index );
} }