diff --git a/kite/src/BuildBlockages.cpp b/kite/src/BuildBlockages.cpp deleted file mode 100644 index 9f239b50..00000000 --- a/kite/src/BuildBlockages.cpp +++ /dev/null @@ -1,445 +0,0 @@ - -// -*- C++ -*- -// -// This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved -// -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | -// | C O R I O L I S | -// | K i t e - D e t a i l e d R o u t e r | -// | | -// | Author : Jean-Paul CHAPUT | -// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | -// | =============================================================== | -// | C++ Module : "./QueryBlockages.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x - - -#include -#include - -#include "hurricane/DataBase.h" -#include "hurricane/Technology.h" -#include "hurricane/BasicLayer.h" -#include "hurricane/RegularLayer.h" -#include "hurricane/Query.h" -#include "kite/RoutingPlane.h" -#include "kite/TrackBlockage.h" -#include "kite/Track.h" -#include "kite/KiteEngine.h" - - -namespace { - - using namespace std; - using Hurricane::tab; - using Hurricane::inltrace; - using Hurricane::DbU; - using Hurricane::Box; - using Hurricane::Interval; - using Hurricane::Query; - using Hurricane::Go; - using Hurricane::Rubber; - using Hurricane::Layer; - using Hurricane::BasicLayer; - using Hurricane::RegularLayer; - using Hurricane::Transformation; - using namespace Kite; - - -// ------------------------------------------------------------------- -// Class : "::BlockagesPlanes". - - - class BlockagesPlanes { - private: - class Track { - public: - Track ( Kite::Track* ); - void add ( Interval ); - inline DbU::Unit getAxis () const; - void dump ( DbU::Unit width ); - private: - Kite::Track* _ktrack; - list _blockages; - }; - private: - class Plane { - public: - Plane ( RoutingPlane* ); - ~Plane (); - void merge ( Box boundingBox ); - inline unsigned int getDirection () const; - inline const Layer* getLayer () const; - inline DbU::Unit getHalfWireWidth () const; - inline DbU::Unit getHalfPitch () const; - void dump (); - private: - RoutingPlane* _routingPlane; - Interval _axisSpan; - vector _tracks; - }; - public: - static Track* createTrack ( Kite::Track* ); - public: - BlockagesPlanes ( KiteEngine* ); - ~BlockagesPlanes (); - bool hasPlane ( const BasicLayer* ); - bool setActivePlane ( const BasicLayer* ); - inline Plane* getActivePlane () const; - void add ( Box boundingBox ); - void dump (); - private: - KiteEngine* _kite; - map _planes; - Plane* _activePlane; - }; - - - BlockagesPlanes::Track::Track ( Kite::Track* ktrack ) - : _ktrack(ktrack) - , _blockages() - { } - - - inline DbU::Unit BlockagesPlanes::Track::getAxis () const { return _ktrack->getAxis(); } - - - void BlockagesPlanes::Track::add ( Interval obstacle ) - { - if ( (obstacle.getVMax() <= _ktrack->getMin()) - or (obstacle.getVMin() >= _ktrack->getMax()) ) return; - - list::iterator imerge = _blockages.end(); - list::iterator iblockage = _blockages.begin(); - - while ( iblockage != _blockages.end() ) { - if ( obstacle.getVMax() < (*iblockage).getVMin() ) break; - - if ( obstacle.intersect(*iblockage) ) { - if ( imerge == _blockages.end() ) { - imerge = iblockage; - (*imerge).merge ( obstacle ); - } else { - (*imerge).merge ( *iblockage ); - iblockage = _blockages.erase ( iblockage ); - continue; - } - } - iblockage++; - } - - if ( imerge == _blockages.end() ) { - _blockages.insert ( iblockage, obstacle ); - ltrace(190) << "| Add on " << DbU::getValueString(_ktrack->getAxis()) << " " << obstacle << endl; - } - } - - - void BlockagesPlanes::Track::dump ( DbU::Unit width ) - { - list::iterator iinterval = _blockages.begin(); - - if ( _ktrack->getDirection() == Constant::Horizontal ) { - DbU::Unit ymin = _ktrack->getAxis() - width/2; - DbU::Unit ymax = _ktrack->getAxis() + width/2; - - for ( ; iinterval != _blockages.end() ; iinterval++ ) { - Box bb ( (*iinterval).getVMin(), ymin, (*iinterval).getVMax(), ymax ); - TrackBlockage::create ( _ktrack, bb ); - } - } else { - DbU::Unit xmin = _ktrack->getAxis() - width/2; - DbU::Unit xmax = _ktrack->getAxis() + width/2; - - for ( ; iinterval != _blockages.end() ; iinterval++ ) { - Box bb ( xmin, (*iinterval).getVMin(), xmax, (*iinterval).getVMax() ); - TrackBlockage::create ( _ktrack, bb ); - } - } - } - - - BlockagesPlanes::Plane::Plane ( RoutingPlane* plane ) - : _routingPlane(plane) - , _axisSpan (plane->getAxisMin(),plane->getAxisMax()) - , _tracks () - { - Kite::Track* ktrack = plane->getTrackByIndex(0); - - for ( ; ktrack != NULL ; ktrack=ktrack->getNext() ) { - _tracks.push_back ( BlockagesPlanes::createTrack(ktrack) ); - } - } - - - BlockagesPlanes::Plane::~Plane () - { - for ( size_t i=0 ; i<_tracks.size() ; i++ ) delete _tracks[i]; - } - - - inline unsigned int BlockagesPlanes::Plane::getDirection () const { return _routingPlane->getDirection(); } - inline const Layer* BlockagesPlanes::Plane::getLayer () const { return _routingPlane->getLayer(); } - inline DbU::Unit BlockagesPlanes::Plane::getHalfWireWidth () const { return _routingPlane->getLayerGauge()->getHalfWireWidth(); } - inline DbU::Unit BlockagesPlanes::Plane::getHalfPitch () const { return _routingPlane->getLayerGauge()->getHalfPitch(); } - - - void BlockagesPlanes::Plane::merge ( Box boundingBox ) - { - ltrace(190) << "| Add on plane " << _routingPlane->getLayer() << " " << boundingBox << endl; - - DbU::Unit delta = getHalfPitch() - getHalfWireWidth() - DbU::lambda(0.1); - - if ( getDirection() == Constant::Horizontal ) { - boundingBox.inflate ( 0, delta, 0, delta ); - - ltrace(190) << "Track range: " << DbU::getValueString(boundingBox.getYMin()) - << ":" << DbU::getValueString(boundingBox.getYMax()) << endl; - for ( size_t i=0 ; (i<_tracks.size()) and (_tracks[i]->getAxis() < boundingBox.getYMax()) ; i++ ) { - if ( _tracks[i]->getAxis() < boundingBox.getYMin() ) continue; - - _tracks[i]->add ( Interval(boundingBox.getXMin(),boundingBox.getXMax()) ); - } - } else { - boundingBox.inflate ( delta, 0, delta, 0 ); - for ( size_t i=0 ; (i<_tracks.size()) and (_tracks[i]->getAxis() < boundingBox.getXMax()) ; i++ ) { - if ( _tracks[i]->getAxis() < boundingBox.getXMin() ) continue; - - _tracks[i]->add ( Interval(boundingBox.getYMin(),boundingBox.getYMax()) ); - } - } - } - - - void BlockagesPlanes::Plane::dump () - { - for ( size_t i=0 ; i<_tracks.size() ; i++ ) _tracks[i]->dump(DbU::lambda(2.0)); - } - - - BlockagesPlanes::Track* BlockagesPlanes::createTrack ( Kite::Track* ktrack ) - { return new Track ( ktrack ); } - - - BlockagesPlanes::BlockagesPlanes ( KiteEngine* kite ) - : _kite (kite) - , _planes () - , _activePlane(NULL) - { - RoutingGauge* rg = _kite->getConfiguration()->getRoutingGauge(); - size_t gaugeDepth = rg->getDepth (); - - for ( size_t depth=0 ; depth(rg->getRoutingLayer(depth)); - if ( not routingLayer ) continue; - - const BasicLayer* blockageLayer = routingLayer->getBasicLayer()->getBlockageLayer(); - if ( not blockageLayer ) continue; - - _planes.insert ( make_pair(blockageLayer,new Plane(_kite->getRoutingPlaneByIndex(depth))) ); - } - } - - - BlockagesPlanes::~BlockagesPlanes () - { - while ( not _planes.empty() ) { - delete _planes.begin()->second; - _planes.erase ( _planes.begin() ); - } - } - - - bool BlockagesPlanes::hasPlane ( const BasicLayer* basicLayer ) - { return (_planes.find(basicLayer) != _planes.end()); } - - - bool BlockagesPlanes::setActivePlane ( const BasicLayer* basicLayer ) - { - map::iterator iplane = _planes.find(basicLayer); - if ( iplane == _planes.end() ) return false; - - _activePlane = iplane->second; - return true; - } - - - inline BlockagesPlanes::Plane* BlockagesPlanes::getActivePlane () const - { return _activePlane; } - - - void BlockagesPlanes::add ( Box boundingBox ) - { - if ( not _activePlane ) return; - _activePlane->merge ( boundingBox ); - } - - - void BlockagesPlanes::dump () - { - map::iterator iplane = _planes.begin(); - for ( ; iplane != _planes.end() ; iplane++ ) { - iplane->second->dump(); - } - } - - - -// ------------------------------------------------------------------- -// Class : "::QueryBlockages". - - - class QueryBlockages : public Query { - public: - QueryBlockages ( KiteEngine* ); - virtual bool hasGoCallback () const; - virtual bool hasPlane ( const BasicLayer* ); - virtual void setBasicLayer ( const BasicLayer* ); - virtual void goCallback ( Go* ); - virtual void rubberCallback ( Rubber* ); - virtual void extensionGoCallback ( Go* ); - virtual void masterCellCallback (); - void addBlockage ( const Go* go - , const BasicLayer* basicLayer - , const Box& area - , const Transformation& transformation - ); - virtual void doQuery (); - inline void dump (); - inline unsigned int getBlockagesCount () const; - private: - KiteEngine* _kite; - BlockagesPlanes _blockagesPlanes; - unsigned int _blockagesCount; - }; - - - QueryBlockages::QueryBlockages ( KiteEngine* kite ) - : Query () - , _kite (kite) - , _blockagesPlanes(kite) - , _blockagesCount (0) - { - setCell ( kite->getCell() ); - setArea ( kite->getCell()->getBoundingBox() ); - setBasicLayer ( NULL ); - setFilter ( Query::DoTerminalCells|Query::DoComponents ); - } - - - inline unsigned int QueryBlockages::getBlockagesCount () const - { return _blockagesCount; } - - - inline void QueryBlockages::dump () - { return _blockagesPlanes.dump(); } - - - bool QueryBlockages::hasPlane ( const BasicLayer* basicLayer ) - { return _blockagesPlanes.hasPlane(basicLayer); } - - - void QueryBlockages::setBasicLayer ( const BasicLayer* basicLayer ) - { - _blockagesPlanes.setActivePlane ( basicLayer ); - Query::setBasicLayer ( basicLayer ); - } - - - void QueryBlockages::doQuery () - { - if ( not _blockagesPlanes.getActivePlane() ) return; - Query::doQuery (); - } - - - void QueryBlockages::masterCellCallback () - { } - - - bool QueryBlockages::hasGoCallback () const - { return true; } - - - void QueryBlockages::goCallback ( Go* go ) - { - addBlockage ( go, getBasicLayer(), getArea(), getTransformation() ); - } - - - void QueryBlockages::addBlockage ( const Go* go - , const BasicLayer* basicLayer - , const Box& area - , const Transformation& transformation - ) - { - const Component* component = dynamic_cast(go); - if ( component ) { - _blockagesCount++; - Box bb ( transformation.getBox(component->getBoundingBox(basicLayer)) ); - ltrace(190) << "Blockage: " << bb << " in " << basicLayer->getName() << endl; - - _blockagesPlanes.add ( bb ); - } - } - - - void QueryBlockages::rubberCallback ( Rubber* ) - { } - - - void QueryBlockages::extensionGoCallback ( Go* ) - { } - - -} // End of anonymous namespace. - - -namespace Kite { - - - using Hurricane::DataBase; - using Hurricane::Technology; - using Hurricane::BasicLayer; - using Hurricane::ForEachIterator; - - - void KiteEngine::buildBlockages () - { - cmess1 << " o Building blockages." << endl; - - if ( not _blockageNet ) { - _blockageNet = getCell()->getNet("blockagenet"); - if ( not _blockageNet ) - _blockageNet = Net::create ( getCell(), "blockagenet" ); - } - - QueryBlockages query ( this ); - Technology* technology = DataBase::getDB()->getTechnology(); - - forEach ( BasicLayer*, iLayer, technology->getBasicLayers() ) { - if ( iLayer->getMaterial() != BasicLayer::Material::blockage ) continue; - if ( not query.hasPlane(*iLayer) ) continue; - - cmess1 << " - Blockages in " << iLayer->getName() << " ..." << endl; - - query.setBasicLayer ( *iLayer ); - query.doQuery (); - } - query.dump (); - cmess1 << " - " << query.getBlockagesCount() << " blockages found." << endl; - - Session::revalidate (); - } - - -} // End of Kite namespace. diff --git a/kite/src/CMakeLists.txt b/kite/src/CMakeLists.txt index 14f1aec6..59ce39dd 100644 --- a/kite/src/CMakeLists.txt +++ b/kite/src/CMakeLists.txt @@ -12,7 +12,6 @@ kite/DataNegociate.h kite/TrackElement.h kite/TrackElements.h kite/TrackSegment.h - kite/TrackBlockage.h kite/TrackFixedSegment.h kite/TrackMarker.h kite/Track.h @@ -23,9 +22,6 @@ kite/RoutingEvent.h kite/RoutingEventQueue.h kite/RoutingEventHistory.h - kite/GCell.h - kite/GCellGrid.h - kite/GCellRoutingSet.h kite/RoutingPlane.h kite/NegociateWindow.h kite/Configuration.h @@ -39,7 +35,6 @@ TrackElement.cpp TrackElements.cpp TrackSegment.cpp - TrackBlockage.cpp TrackFixedSegment.cpp TrackMarker.cpp Track.cpp @@ -50,11 +45,7 @@ RoutingEvent.cpp RoutingEventQueue.cpp RoutingEventHistory.cpp - GCell.cpp - GCellGrid.cpp - GCellRoutingSet.cpp RoutingPlane.cpp - BuildBlockages.cpp BuildPowerRails.cpp ProtectRoutingPads.cpp PreProcess.cpp diff --git a/kite/src/DataNegociate.cpp b/kite/src/DataNegociate.cpp index 2e499561..b6e87740 100644 --- a/kite/src/DataNegociate.cpp +++ b/kite/src/DataNegociate.cpp @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved // // =================================================================== // @@ -44,12 +44,8 @@ namespace Kite { : _routingEvent(NULL) , _trackSegment(trackSegment) , _cost (trackSegment) - , _gcellOrder ((unsigned int)-1) , _state (RipupPerpandiculars) , _stateCount (1) - , _leftBorder (false) - , _rightBorder (false) - , _ring (false) //, _z (RoutingGauge::getLayerDepth(trackSegment->getLayer())) { } @@ -59,9 +55,7 @@ namespace Kite { void DataNegociate::update () - { - _cost.update ( _trackSegment ); - } + { _cost.update ( _trackSegment ); } string DataNegociate::_getString () const @@ -78,7 +72,6 @@ namespace Kite { record->add ( getSlot ( "_routingEvent", _routingEvent ) ); record->add ( getSlot ( "_trackSegment", _trackSegment ) ); record->add ( getSlot ( "_cost" , &_cost ) ); - record->add ( getSlot ( "_gcellOrder" , _gcellOrder ) ); //record->add ( getSlot ( "_z" , _z ) ); return record; diff --git a/kite/src/GCell.cpp b/kite/src/GCell.cpp deleted file mode 100644 index a1f00394..00000000 --- a/kite/src/GCell.cpp +++ /dev/null @@ -1,576 +0,0 @@ - -// -*- C++ -*- -// -// This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved -// -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | -// | C O R I O L I S | -// | K i t e - D e t a i l e d R o u t e r | -// | | -// | Author : Jean-Paul CHAPUT | -// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | -// | =============================================================== | -// | C++ Module : "./GCell.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x - - -#include -#include -#include - -#include "hurricane/DebugSession.h" -#include "hurricane/Bug.h" -#include "hurricane/Error.h" -#include "hurricane/Warning.h" -#include "hurricane/Component.h" -#include "hurricane/RoutingPad.h" -#include "katabatic/AutoSegment.h" -#include "katabatic/AutoContact.h" -#include "kite/DataNegociate.h" -#include "kite/TrackSegment.h" -#include "kite/RoutingPlane.h" -#include "kite/GCell.h" -#include "kite/GCellGrid.h" -#include "kite/NegociateWindow.h" - - -namespace { - - using namespace Hurricane; - using namespace Kite; - - - TrackElement* getCandidate ( RoutingPad* rp, Box bb ) - { - size_t depth = Session::getConfiguration()->getLayerDepth ( rp->getLayer() ); - if ( depth > 2 ) return NULL; - - DebugSession::open ( rp->getNet(), 200 ); - - //if ( (depth != 0) and (depth != 2) ) return NULL; - - ltrace(200) << "depth: " << depth << " " << rp->getSourcePosition() << " " << rp << endl; - - if ( depth%2 == 0 ) { - // Propagate from vertical Terminals. - forEach ( Contact*, icontact, rp->getSlaveComponents().getSubSet() ) { - if ( not bb.contains(icontact->getCenter()) ) continue; - - forEach ( Segment*, isegment, icontact->getSlaveComponents().getSubSet() ) { - TrackElement* autoSegment = Session::lookup(*isegment); - if ( not autoSegment or autoSegment->isFixed() ) continue; - - DebugSession::close (); - return autoSegment; - } - } - } else { -#if DISABLED - // Propage from Horizontal Terminals. - bool hasM3protect = false; - AutoContact* toContact = NULL; - - forEach ( Contact*, icontact, rp->getSlaveComponents().getSubSet() ) { - if ( not bb.contains(icontact->getCenter()) ) continue; - - forEach ( Segment*, isegment, icontact->getSlaveComponents().getSubSet() ) { - TrackElement* autoSegment = Session::lookup(*isegment); - if ( not autoSegment ) continue; - if ( autoSegment->isFixed() ) { - if ( Session::getConfiguration()->getLayerDepth(autoSegment->getLayer()) == 2 ) { - ltrace(200) << "M3 protection found for " << rp << endl; - hasM3protect = true; - } - continue; - } - toContact = autoSegment->base()->getAutoSource(); - if ( toContact->base() == *icontact ) - toContact = autoSegment->base()->getAutoTarget(); - } - } - - // Find M3 associated to this terminal. - if ( hasM3protect ) { - if ( toContact ) { - ltrace(200) << "toContact: " << toContact << endl; - forEach ( Segment*, isegment, toContact->base()->getSlaveComponents().getSubSet() ) { - ltrace(200) << "| slave: " << *isegment << endl; - if ( Session::getConfiguration()->getLayerDepth(isegment->getLayer()) == 2 ) { - TrackElement* autoSegment = Session::lookup(*isegment); - ltrace(200) << "M3 candidate: " << autoSegment << endl; - DebugSession::close (); - return autoSegment; - } - } - } - } -#endif - } - - DebugSession::close (); - return NULL; - } - - -} - - -namespace Kite { - - - using std::cerr; - using std::endl; - using std::swap; - using std::numeric_limits; - using Hurricane::tab; - using Hurricane::inltrace; - using Hurricane::ltracein; - using Hurricane::ltraceout; - using Hurricane::roundfp; - using Hurricane::Bug; - using Hurricane::Error; - using Hurricane::Warning; - using Hurricane::ForEachIterator; - using Hurricane::Component; - using Hurricane::RoutingPad; - - using Katabatic::AutoContact; - - -// ------------------------------------------------------------------- -// Class : "Kite::GCell::CompareByDensity". -// -// lhs < rhs --> true - - - bool GCell::CompareByDensity::operator() ( GCell* lhs, GCell* rhs ) - { - //int difference = floatCompare ( lhs->base()->getDensity(), rhs->base()->getDensity() ); - //if ( abs(difference) > 1000 ) return difference > 0; - - float difference = roundfp ( lhs->base()->getDensity() - rhs->base()->getDensity() ); - if ( difference != 0.0 ) return (difference > 0.0); - - if ( lhs->getIndex() < rhs->getIndex() ) return true; - return false; - } - - -// ------------------------------------------------------------------- -// Class : "Kite::GCell::CompareByStiffness". -// -// lhs < rhs --> true - - - bool GCell::CompareByStiffness::operator() ( GCell* lhs, GCell* rhs ) - { - if ( lhs->isRouted() xor rhs->isRouted() ) return rhs->isRouted(); - - float difference = roundfp ( lhs->getStiffness() - rhs->getStiffness() ); - if ( difference != 0.0 ) return (difference > 0.0); - - return lhs->getIndex() < rhs->getIndex(); - } - - -// ------------------------------------------------------------------- -// Class : "Kite::GCell". - - - GCell::GCell ( GCellGrid* grid, Katabatic::GCell* gcell ) - : _gcellGrid (grid) - , _base (gcell) - , _segments () - , _order (numeric_limits::max()) - , _isInRoutingSet (false) - , _isRouted (false) - { - if ( !gcell ) - cerr << Bug("GCell:GCell() - NULL base.") << endl; - - _leftSegments [0] = NULL; - _leftSegments [1] = NULL; - _rightSegments[0] = NULL; - _rightSegments[1] = NULL; - } - - - GCell* GCell::create ( GCellGrid* grid, Katabatic::GCell* gcell ) - { - GCell* kiteGCell = new GCell ( grid, gcell ); - - ltrace(90) << "Kite::GCell::create() - " << (void*)kiteGCell << " " << kiteGCell << endl; - - return kiteGCell; - } - - - GCell::~GCell () - { } - - - void GCell::destroy () - { - ltrace(90) << "Kite::GCell::destroy() - " << (void*)this << " " << this << endl; - ltracein(90); - - for ( size_t i=0 ; i < _segments.size() ; i++ ) { - if ( !_segments[i]->getTrack() ) - _segments[i]->destroy (); - else { - cerr << Error("%s still bound to a track!\n" - " (not deleted: let's get the memory leak)" - ,getString(_segments[i]).c_str() - ) << endl; - } - } - delete this; - - ltraceout(90); - } - - - GCell* GCell::getLeft () const - { - return _gcellGrid->getGCellLeft(this); - } - - - GCell* GCell::getRight () const - { - return _gcellGrid->getGCellRight(this); - } - - - GCell* GCell::getUp () const - { - return _gcellGrid->getGCellUp(this); - } - - - GCell* GCell::getDown () const - { - return _gcellGrid->getGCellDown(this); - } - - - bool GCell::areDensityConnex ( GCell* a, GCell* b ) - { return Katabatic::GCell::areDensityConnex ( a->base(), b->base() ); } - - - GCell* GCell::getLowestOrder ( TrackElement* trackSegment ) - { - vector gcells; - trackSegment->getGCells ( gcells ); - - if ( gcells.empty() ) return NULL; - - size_t ilower = 0; - for ( size_t i=0 ; igetOrder() < gcells[ilower]->getOrder() ) - ilower = i; - - return gcells[ilower]; - } - - - void GCell::loadRouting ( unsigned int order ) - { - _segments.clear (); - _order = order; - - ltrace(200) << "GCell::loadRouting() - " << this << " Session:" << Session::getOrder() << endl; - ltracein(200); - - Segment* segment; - AutoSegment* autoSegment; - - ltrace(149) << "AutoSegments from AutoContacts" << endl; - vector* contacts = getContacts(); - for ( size_t i=0 ; isize() ; i++ ) { - forEach ( Component*, component, (*contacts)[i]->getSlaveComponents() ) { - segment = dynamic_cast(*component); - autoSegment = Session::base()->lookup ( segment ); - ltrace(149) << autoSegment << endl; - if ( autoSegment ) { - addTrackSegment ( this, autoSegment, true ); - } - } - } - - // // Effective deletion of rejecteds. - // set::iterator ireject = rejecteds.begin(); - // for ( ; ireject != rejecteds.end() ; ireject++ ) { - // } - - ltrace(149) << "Horizontal overcell AutoSegments" << endl; - vector* segments = getHSegments(); - for ( size_t i=0 ; isize() ; i++ ) { - addTrackSegment ( this, (*segments)[i], true ); - } - - ltrace(149) << "Vertical overcell AutoSegments" << endl; - segments = getVSegments(); - for ( size_t i=0 ; isize() ; i++ ) { - addTrackSegment ( this, (*segments)[i], true ); - } - - ltrace(149) << "_segments.size():" << _segments.size() << endl; - ltraceout(200); - } - - - void GCell::computeBorder () - { - ltrace(200) << "GCell::computeBorder() " << this << endl; - ltracein(200); - - vector* contacts = _base->getContacts(); - TrackElement* candidate; - DataNegociate* data; - Box bb = getBoundingBox(); - size_t iLeft = 0; - size_t iRight = 0; - - for ( size_t icontact=0 ; icontact < contacts->size() ; icontact++ ) { - Component* anchor = (*contacts)[icontact]->getAnchor(); - RoutingPad* rp = dynamic_cast(anchor); - - if ( not rp ) continue; - - // size_t depth = Session::getConfiguration()->getLayerDepth ( rp->getLayer() ); - // if ( (depth != 0) and (depth != 2) ) continue; - - // ltrace(200) << "depth: " << depth << " " << rp << endl; - - candidate = getCandidate ( rp, bb ); - if ( not candidate ) continue; - - data = candidate->getDataNegociate(); - if ( not data ) continue; - - // Ugly: hardwired pitch usage. - if ( (rp->getX() - getX() < DbU::lambda(11.0)) and (iLeft < 2) ) { - //data->setLeftBorder(true); - ltrace(200) << "Left Segments[" << iLeft << "]: " << candidate << endl; - _leftSegments[iLeft++] = candidate; - continue; - } - - if ( (getXMax() - rp->getX() < DbU::lambda(11.0)) and (iRight < 2) ) { - //data->setRightBorder(true); - ltrace(200) << "Right Segment[" << iRight << "]: " << candidate << endl; - _rightSegments[iRight++] = candidate; - } - } - - ltraceout(200); - } - - - TrackElement* GCell::addTrackSegment ( GCell* gcell, AutoSegment* autoSegment, bool loading ) - { - ltrace(200) << "GCell::addTrackSegment() - " << autoSegment << endl; - ltracein(159); - - // Special case: fixed AutoSegments must not interfere with blockages. - // Ugly: uses of getExtensionCap(). - if ( autoSegment->isFixed() ) { - RoutingPlane* plane = Session::getKiteEngine()->getRoutingPlaneByLayer(autoSegment->getLayer()); - Track* track = plane->getTrackByPosition ( autoSegment->getAxis() ); - size_t begin; - size_t end; - Interval fixedSpan; - Interval blockageSpan; - - autoSegment->getCanonical ( fixedSpan ); - fixedSpan.inflate ( Session::getExtensionCap()-1 ); - - track->getOverlapBounds ( fixedSpan, begin, end ); - for ( ; (begin < end) ; begin++ ) { - - TrackElement* other = track->getSegment(begin); - ltrace(200) << "| overlap: " << other << endl; - - if ( not other->isBlockage() ) continue; - - other->getCanonical ( blockageSpan ); - blockageSpan.inflate(Session::getExtensionCap()); - - ltrace(200) << " fixed:" << fixedSpan << " vs. blockage:" << blockageSpan << endl; - - if ( not fixedSpan.intersect(blockageSpan) ) continue; - - // Overlap between fixed & blockage. - ltrace(200) << "* Blockage overlap: " << autoSegment << endl; - Session::destroyRequest ( autoSegment ); - - cinfo << Warning("Overlap between fixed %s and blockage at %s." - ,getString(autoSegment).c_str(),getString(blockageSpan).c_str()) << endl; - - return NULL; - } - } - - Interval span; - autoSegment = autoSegment->getCanonical ( span ); - - bool created; - TrackElement* trackSegment = TrackSegment::create ( autoSegment, NULL, created ); - DataNegociate* data = trackSegment->getDataNegociate (); - GCell* previousGCell = trackSegment->getGCell(); - - if ( not loading ) - ltrace(159) << "* lookup: " << autoSegment << endl; - - if ( created ) - ltrace(159) << "* " << trackSegment << endl; - - if ( not created and not loading ) { - ltrace(200) << "TrackSegment already exists (and not in loading stage)." << endl; - ltrace(200) << "Previous owning GCell: " << previousGCell << endl; - if ( previousGCell != gcell ) { - previousGCell->removeTrackSegment ( trackSegment ); - trackSegment->setGCell ( NULL ); - } - } - - vector gcells; - trackSegment->getGCells ( gcells ); - GCell* lowest = gcells[0]; - bool validPrevious = false; - - for ( size_t igcell=0 ; igcellgetOrder() < lowest->getOrder()) { - lowest = gcells[igcell]; - } - if ( gcells[igcell] == previousGCell ) validPrevious = true; - } - if ( not validPrevious ) previousGCell = NULL; - - if ( not gcell ) { - gcell = lowest; - if ( previousGCell and (gcell->getOrder() == previousGCell->getOrder()) ) - gcell = previousGCell; - ltrace(200) << "New owner: " << gcell << endl; - } else if ( created ) { - if ( (lowest != gcell) && (lowest->getOrder() != gcell->getOrder() ) ) { - cerr << Bug("Not the right lowest: %s",getString(lowest).c_str()) << endl; - } - } - - if ( (gcell->getOrder() > Session::getOrder()) and not (data->isRing() or data->isBorder()) ) { - cinfo << "[INFO] GCell::addTrackSegment() - Owning GCell is not in active set (" - << gcell->getOrder() << " > Session:" << Session::getOrder() << ")." - << "\n " << trackSegment - << endl; - } - - if ( not trackSegment->getGCell() ) { - trackSegment->setGCell ( gcell ); - gcell->addTrackSegment ( trackSegment ); - - if ( loading ) { - RoutingPlane* plane = Session::getKiteEngine()->getRoutingPlaneByLayer(autoSegment->getLayer()); - Track* track = plane->getTrackByPosition ( autoSegment->getAxis() ); - Interval uside = gcell->getUSide ( Constant::perpandicular(autoSegment->getDirection()), false ); - - if ( track->getAxis() > uside.getVMax() ) track = track->getPrevious(); - if ( track->getAxis() < uside.getVMin() ) track = track->getNext(); - - trackSegment->setAxis ( track->getAxis(), Katabatic::Realignate|Katabatic::AxisSet ); - trackSegment->invalidate (); - - if ( created and trackSegment->isFixed() ) { - Session::addInsertEvent ( trackSegment, track ); - } - } - } - - ltraceout(159); - - return trackSegment; - } - - - void GCell::addTrackSegment ( TrackElement* trackSegment ) - { - _segments.push_back ( trackSegment ); - } - - - void GCell::removeTrackSegment ( TrackElement* trackSegment ) - { - if ( _segments.empty() ) return; - - size_t i = 0; - for ( ; i<_segments.size() ; i++ ) - if ( _segments[i] == trackSegment ) { - swap ( _segments[i], _segments[_segments.size()-1] ); - break; - } - - if ( i < _segments.size() ) _segments.pop_back (); - } - - - double GCell::getOwnedWireLength () const - { - double ownedWL = 0; - - for ( size_t i=0 ; i<_segments.size() ; i++ ) { - ownedWL += DbU::getLambda ( _segments[i]->getLength() ); - } - - return ownedWL; - } - - - void GCell::anticipateRouting ( unsigned int order ) - { - if ( order < _order ) { - setRouted ( true ); - loadRouting ( order ); - // _order = order; - // for ( size_t isegment=0 ; isegment<_segments.size() ; ++isegment ) { - // DataNegociate* data = _segments[isegment]->getDataNegociate(); - // data->setGCellOrder ( order ); - // data->resetBorder (); - // } - } - } - - - string GCell::_getTypeName() const - { return "Kite::GCell"; } - - - string GCell::_getString () const - { - string s = _base->_getString(); - s.erase ( s.size()-1 ); - s += " o:"; - s += ((_order == numeric_limits::max()) ? "-" : getString(_order)); - s += " "; - s += ((_isRouted) ? "R" : "-"); - s += ">"; - return s; - } - - - Record* GCell::_getRecord () const - { return _base->_getRecord(); } - - - -} // End of Kite namespace. diff --git a/kite/src/GCellGrid.cpp b/kite/src/GCellGrid.cpp deleted file mode 100644 index 09c1c0f3..00000000 --- a/kite/src/GCellGrid.cpp +++ /dev/null @@ -1,154 +0,0 @@ - -// -*- C++ -*- -// -// This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved -// -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | -// | C O R I O L I S | -// | K i t e - D e t a i l e d R o u t e r | -// | | -// | Author : Jean-Paul CHAPUT | -// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | -// | =============================================================== | -// | C++ Module : "./GCellGrid.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x - - -#include - -#include "hurricane/Cell.h" -#include "katabatic/GCellGrid.h" -#include "kite/GCell.h" -#include "kite/GCellGrid.h" -#include "kite/KiteEngine.h" - - -namespace Kite { - - - using std::cerr; - using std::endl; - - using Hurricane::tab; - using Hurricane::inltrace; - using Hurricane::ltracein; - using Hurricane::ltraceout; - - -// ------------------------------------------------------------------- -// Class : "GCellGrid". - - - GCellGrid::GCellGrid ( KiteEngine* kite ) - : Katabatic::Grid(kite->getCell()->getBoundingBox()) - , _kite(kite) - { } - - - void GCellGrid::_postCreate () - { - // Clone the grid from Katabatic Here. - Katabatic::GCellGrid* base = _kite->base()->getGCellGrid(); - vector* baseGCells = base->getGCellVector(); - - ltrace(80) << "Kite GCell Matrix [" << baseGCells->size() << "]" << endl; - - for ( size_t i=0 ; isize() ; i++ ) - _gcells.push_back ( GCell::create(this,(*baseGCells)[i]) ); - - _rows = base->getRows(); - _columns = base->getColumns(); - _rawSize = base->getRawSize(); - _xGraduations = base->getXGrads(); - _yGraduations = base->getYGrads(); - } - - - GCellGrid::~GCellGrid () - { } - - - void GCellGrid::_preDestroy () - { - ltrace(90) << "Kite::GCellGrid::_preDestroy()" << endl; - ltracein(90); - - vector::iterator it = _gcells.begin(); - vector::iterator end = _gcells.end (); - for ( ; it != end ; it++ ) (*it)->destroy (); - - ltraceout(90); - } - - - Cell* GCellGrid::getCell () const - { - return _kite->getCell(); - } - - - GCellGrid* GCellGrid::create ( KiteEngine* kite ) - { - GCellGrid* subFCellGrid = new Kite::GCellGrid ( kite ); - - subFCellGrid->_postCreate (); - - return subFCellGrid; - } - - - double GCellGrid::getTotalWireLength () const - { - double totalWL = 0; - for ( size_t i=0 ; i < _gcells.size() ; i++ ) { - totalWL += _gcells[i]->getOwnedWireLength (); - } - return totalWL; - } - - - void GCellGrid::_check () const - { - cerr << " o Checking Kite GCell Grid." << endl; - for ( size_t i=0 ; i < _gcells.size() ; i++ ) { - if ( _gcells[i]->base() == NULL ) { - cerr << "[CHECK] _gcells[" << i << "]: " << (void*)_gcells[i] << " has NULL base." << endl; - } - } - cerr << " - Successful." << endl; - } - - - string GCellGrid::_getTypeName () const - { - return "Kite::GCellGrid"; - } - - - string GCellGrid::_getString () const - { - return "<" + _getTypeName() + " " - + getString(getRows()) + "x" + getString(getColumns()) + ">"; - } - - - Record* GCellGrid::_getRecord () const - { - Record* record = Katabatic::Grid::_getRecord (); - record->add ( getSlot ( "_kite", _kite ) ); - return record; - - return record; - } - - -} // End of Kite namespace. diff --git a/kite/src/GCellRoutingSet.cpp b/kite/src/GCellRoutingSet.cpp deleted file mode 100644 index 4d5ad49e..00000000 --- a/kite/src/GCellRoutingSet.cpp +++ /dev/null @@ -1,402 +0,0 @@ - -// -*- C++ -*- -// -// This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved -// -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | -// | C O R I O L I S | -// | K i t e - D e t a i l e d R o u t e r | -// | | -// | Author : Jean-Paul CHAPUT | -// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | -// | =============================================================== | -// | C++ Module : "./GCellRoutingSet.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x - - -#include -#include -#include -#include -#include -#include - -#include "hurricane/Error.h" -#include "hurricane/Contact.h" -#include "hurricane/Segment.h" -#include "hurricane/RoutingPad.h" -#include "katabatic/AutoSegment.h" -#include "kite/GCell.h" -#include "kite/GCellGrid.h" -#include "kite/GCellRoutingSet.h" -#include "kite/DataNegociate.h" - - -namespace Kite { - - - using std::numeric_limits; - using std::queue; - using std::cerr; - using std::endl; - using std::ostringstream; - using std::setprecision; - using Hurricane::roundfp; - using Hurricane::tab; - using Hurricane::inltrace; - using Hurricane::ltracein; - using Hurricane::ltraceout; - using Hurricane::Error; - using Katabatic::getVectorString; - - - const char* usedGCellSeed = - "GCellRoutingSet::create() : %s is already in a GCellRoutingSet.\n"; - - -// ------------------------------------------------------------------- -// Class : "GCellRoutingSet". - - - GCellRoutingSet::GCellRoutingSet ( GCell* gcell, float expandStep, float minDensity ) - : _order (numeric_limits::max()) - , _minDensity (minDensity) - , _minDensities (new float [gcell->getDepth()]) - , _gcells (1,gcell) - , _borderSegments() - , _statistics () - { - gcell->setInRoutingSet ( true ); - - if ( _minDensity > expandStep ) _minDensity -= expandStep; - else _minDensity = 0.0; - _minDensity = roundfp ( _minDensity ); - for ( unsigned int i=0 ; i < gcell->getDepth() ; i++ ) { - _minDensities[i] = gcell->getDensity(i) * expandStep; - _minDensities[i] = roundfp ( _minDensities[i] ); - } - ltrace(200) << getVectorString(_minDensities,gcell->getDepth()) << endl; - } - - - void GCellRoutingSet::_postCreate () - { - ltrace(90) << "Kite::GCellRoutingSet::_postCreate() - " << (void*)this << " " << this << endl; - ltracein(90); - - ltraceout(90); - } - - - GCellRoutingSet::~GCellRoutingSet () - { - delete [] _minDensities; - } - - - void GCellRoutingSet::_preDestroy () - { } - - - void GCellRoutingSet::destroy () - { - _preDestroy (); - delete this; - } - - - GCellRoutingSet* GCellRoutingSet::create ( GCell* gcell, float expandStep ) - { - if ( gcell->isInRoutingSet() ) - throw Error ( usedGCellSeed, getString(gcell).c_str() ); - - GCellRoutingSet* rs = new GCellRoutingSet ( gcell - , expandStep - , gcell->getDensity() - ); - rs->_postCreate (); - - return rs; - } - - - void GCellRoutingSet::setRouted ( bool state ) - { - for ( size_t igcell=0 ; igcell<_gcells.size() ; ++igcell ) - _gcells[igcell]->setRouted ( true ); - } - - - vector& GCellRoutingSet::getOwnedSegments ( vector& segments ) const - { - for ( size_t i=0 ; i<_gcells.size() ; i++ ) { - if ( _gcells[i]->isRouted() ) continue; - - const vector& gcellSegments = _gcells[i]->getOwnedSegments(); - for ( size_t j=0 ; jisFixed() ) - segments.push_back ( gcellSegments[j] ); - } -// segments.insert ( segments.end() -// , _gcells[i]->getOwnedSegments().begin() -// , _gcells[i]->getOwnedSegments().end() -// ); - } - - for ( size_t i=0 ; i<_borderSegments.size() ; i++ ) { - TrackElement* segment = _borderSegments[i]._segment; - DataNegociate* data = segment->getDataNegociate(); - data->setGCellOrder ( _order ); - segments.push_back ( segment ); - } - - return segments; - } - - - void GCellRoutingSet::expand ( GCellGrid* grid ) - { -#if defined(CHECK_DETERMINISM) - cerr << "Order: Expanding " << this << endl; -#endif - - ltrace(200) << "Expanding: " << this << endl; - ltracein(200); - ltrace(200) << getVectorString(_minDensities,_gcells.front()->getDepth()) << endl; - - queue densityQueue; - densityQueue.push ( _gcells.front() ); - - while ( !densityQueue.empty() ) { - GCell* current = densityQueue.front (); - GCell* neighbor = NULL; - densityQueue.pop (); - - ltrace(200) << "Popping Density: " << current << endl; - - for ( size_t i=0 ; i<4 ; i++ ) { - switch ( i ) { - case 0: neighbor = grid->getGCellLeft (current); break; - case 1: neighbor = grid->getGCellRight(current); break; - case 2: neighbor = grid->getGCellUp (current); break; - case 3: neighbor = grid->getGCellDown (current); break; - } - - if ( neighbor ) { -#if defined(CHECK_DETERMINISM) - cerr << "Order: Looking at neighbor " << neighbor << endl; -#endif - float densities[32]; - neighbor->base()->getDensities ( densities ); - ltrace(200) << "Neighbor: " << neighbor << " " << getVectorString(densities,5) << endl; - } - - if ( neighbor and !neighbor->isInRoutingSet() ) { - if ( not neighbor->isAboveDensity(_minDensity) - and not GCell::areDensityConnex(current,neighbor) ) - continue; - -#if defined(CHECK_DETERMINISM) - cerr << "Order: Agglomerate " << neighbor << endl; -#endif - ltrace(200) << "Agglomerating: " << neighbor << endl; - - neighbor->setInRoutingSet ( true ); - _gcells.push_back ( neighbor ); - densityQueue.push ( neighbor ); - } - } - } - - // De-notching pass. - for ( size_t i=0 ; i<_gcells.size() ; i++ ) densityQueue.push ( _gcells[i] ); - - while ( not densityQueue.empty() ) { - GCell* current = densityQueue.front(); - GCell* neighbor = NULL; - - densityQueue.pop(); - - for ( size_t i=0 ; i<4 ; i++ ) { - switch ( i ) { - case 0: neighbor = grid->getGCellLeft (current); break; - case 1: neighbor = grid->getGCellRight(current); break; - case 2: neighbor = grid->getGCellUp (current); break; - case 3: neighbor = grid->getGCellDown (current); break; - } - - if ( not neighbor ) continue; - -#if defined(CHECK_DETERMINISM) - cerr << "Order: Denotching, looking at neighbor " << neighbor << endl; -#endif - if ( neighbor->isInRoutingSet() ) continue; - - GCell* left = grid->getGCellLeft (neighbor); - GCell* right = grid->getGCellRight(neighbor); - GCell* up = grid->getGCellUp (neighbor); - GCell* down = grid->getGCellDown (neighbor); - - bool hasLeft = (left) ? left ->isInRoutingSet() : true; - bool hasRight = (right) ? right->isInRoutingSet() : true; - bool hasUp = (up) ? up ->isInRoutingSet() : true; - bool hasDown = (down) ? down ->isInRoutingSet() : true; - - if ( (not (hasLeft and hasRight)) and (not (hasUp and hasDown)) ) continue; - -#if defined(CHECK_DETERMINISM) - cerr << "Order: Denotching, Agglomerate " << neighbor << endl; -#endif - ltrace(200) << "Denotching, Agglomerating: " << neighbor << endl; - - neighbor->setInRoutingSet ( true ); - _gcells.push_back ( neighbor ); - densityQueue.push ( neighbor ); - } - } - - ltrace(200) << "GCellRoutingSet (final): " << this << endl; - for ( size_t i=0 ; i<_gcells.size() ; i++ ) - ltrace(200) << "| " << _gcells[i] << endl; - - _statistics.setGCellsCount ( _gcells.size() ); - _statistics.setSegmentsCount ( 0 ); - for ( size_t i=0 ; i<_gcells.size() ; i++ ) { - const vector& gcellSegments = _gcells[i]->getOwnedSegments(); - _statistics.incSegmentsCount ( gcellSegments.size() ); - } - - ltraceout(200); - } - - - void GCellRoutingSet::loadBorder ( GCellGrid* grid ) - { - ltrace(200) << "loadBorder() " << this << endl; - unsigned int order = _order; - TrackElement* segment = NULL; - DataNegociate* data; - - for ( size_t igcell=0 ; igcell<_gcells.size() ; igcell++ ) { - if ( _gcells[igcell]->getOrder() < order ) continue; - - GCell* neighbor = NULL; - - for ( size_t i=0 ; i<2 ; i++ ) { - switch ( i ) { - case 0: neighbor = grid->getGCellLeft (_gcells[igcell]); break; - case 1: neighbor = grid->getGCellRight(_gcells[igcell]); break; - } - if ( not neighbor or (neighbor->getOrder() <= order) ) continue; - - neighbor->computeBorder (); - - for ( size_t iRight=0 ; iRight<2 ; iRight++ ) { - segment = neighbor->getRightRp(iRight); - if ( segment == NULL ) break; - - data = (segment) ? segment->getDataNegociate() : NULL; - if ( data ) { - if ( (i == 0) and (data->getGCellOrder() > order) and not data->isRing() ) { - ltrace(200) << "| border: [" << data->getGCellOrder() - << " > " << order << "] " << segment << endl; - data->setRightBorder ( true ); - _borderSegments.push_back ( BorderSegment(segment,data->getGCellOrder()) ); - } else - data->resetBorder(); - } - } - - for ( size_t iLeft=0 ; iLeft<2 ; iLeft++ ) { - segment = neighbor->getLeftRp(iLeft); - if ( segment == NULL ) break; - - data = (segment) ? segment->getDataNegociate() : NULL; - if ( data ) { - if ( (i == 1) and (data->getGCellOrder() > order) and not data->isRing() ) { - ltrace(200) << "| border: [" << data->getGCellOrder() - << " > " << order << "] " << segment << endl; - data->setLeftBorder ( true ); - _borderSegments.push_back ( BorderSegment(segment,data->getGCellOrder()) ); - } else - data->resetBorder(); - } - } - } - } - } - - - void GCellRoutingSet::freeBorder () - { - for ( size_t j=0 ; j<_borderSegments.size() ; j++ ) { - DataNegociate* data = _borderSegments[j]._segment->getDataNegociate(); - if ( not data->isBorder() ) continue; - - data->resetBorder (); - data->setGCellOrder ( _borderSegments[j]._order ); - Session::addRemoveEvent ( _borderSegments[j]._segment ); - //_borderSegments[j]._segment->base()->setFixed(true); - } - Session::revalidate (); - - vector().swap ( _borderSegments ); - } - - - unsigned int& GCellRoutingSet::loadRouting ( unsigned int& order ) - { - _order = order; - //cerr << "RoutingSet order:" << order << endl; - - for ( size_t i=0 ; i<_gcells.size() ; i++ ) - _gcells[i]->loadRouting ( order ); - - return ++order; - } - - - string GCellRoutingSet::_getTypeName () const - { return "GCellRoutingSet"; } - - - string GCellRoutingSet::_getString () const - { - ostringstream s; - - s << "::max()) ? getString(_order) : "-") - << " " << _gcells.front() << setprecision(9) - << " [" << ":" << _minDensity - << "] " << _gcells.size() - << ">"; - return s.str(); - - //return "::max()) ? getString(_order) : "-") - // + " " + getString(_gcells.front()) - // + " [" + /*getString(_minDensity)*/ + ":" + getString(_minDensity) - // + "] " + getString(_gcells.size()) - // + ">"; - } - - - Record* GCellRoutingSet::_getRecord () const - { - Record* record = new Record ( getString(this) ); - record->add ( getSlot ( "_gcells" , &_gcells ) ); - record->add ( getSlot ( "_order" , _order ) ); - record->add ( getSlot ( "_minDensity", _minDensity ) ); - - return record; - } - - -} // End of Kite namespace. diff --git a/kite/src/GraphicKiteEngine.cpp b/kite/src/GraphicKiteEngine.cpp index 5485a765..c8c4e16f 100644 --- a/kite/src/GraphicKiteEngine.cpp +++ b/kite/src/GraphicKiteEngine.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -95,6 +96,11 @@ namespace Kite { void GraphicKiteEngine::initKatabaticGCell ( CellWidget* widget ) { widget->getDrawingPlanes().setPen ( Qt::NoPen ); + + KiteEngine* kite = KiteEngine::get ( widget->getCell() ); + if ( kite ) { + kite->getGCellGrid()->setDensityMode ( Katabatic::GCellGrid::MaxDensity ); + } } @@ -108,7 +114,7 @@ namespace Kite { const Katabatic::GCell* gcell = static_cast(go); QPainter& painter = widget->getPainter(); - size_t density = (size_t)( gcell->getMaxHVDensity() * 255.0 ); + size_t density = (size_t)( gcell->getDensity() * 255.0 ); if ( density > 255 ) density = 255; painter.setBrush diff --git a/kite/src/KiteEngine.cpp b/kite/src/KiteEngine.cpp index 066f80d8..fbe31440 100644 --- a/kite/src/KiteEngine.cpp +++ b/kite/src/KiteEngine.cpp @@ -41,18 +41,16 @@ #include "hurricane/Vertical.h" #include "hurricane/Horizontal.h" #include "hurricane/UpdateSession.h" - #include "crlcore/Measures.h" #include "knik/Vertex.h" #include "knik/Edge.h" #include "knik/Graph.h" #include "knik/KnikEngine.h" #include "katabatic/AutoContact.h" +#include "katabatic/GCellGrid.h" #include "kite/DataNegociate.h" -#include "kite/GCellGrid.h" #include "kite/RoutingPlane.h" #include "kite/Session.h" -#include "kite/GCellRoutingSet.h" #include "kite/NegociateWindow.h" #include "kite/KiteEngine.h" @@ -85,6 +83,7 @@ namespace Kite { using CRL::Measures; using CRL::MeasuresSet; using Knik::KnikEngine; + using Katabatic::AutoContact; using Katabatic::ChipTools; @@ -116,7 +115,6 @@ namespace Kite { , _blockageNet (NULL) , _configuration (new Configuration(getKatabaticConfiguration())) , _routingPlanes () - , _kiteGrid (NULL) , _negociateWindow (NULL) , _trackSegmentLut () , _minimumWL (0.0) @@ -133,8 +131,6 @@ namespace Kite { #ifdef KNIK_NOT_EMBEDDED size_t maxDepth = getRoutingGauge()->getDepth(); - _kiteGrid = GCellGrid::create ( this ); - _routingPlanes.reserve ( maxDepth ); for ( size_t depth=0 ; depth < maxDepth ; depth++ ) { _routingPlanes.push_back ( RoutingPlane::create ( this, depth ) ); @@ -192,17 +188,9 @@ namespace Kite { { if ( segment->isBlockage() ) return 0; - if ( segment->getDataNegociate() ) { - if ( segment->getDataNegociate()->isBorder() ) - return _configuration->getRipupLimit(Configuration::BorderRipupLimit); - - if ( segment->getDataNegociate()->isRing() ) - return _configuration->getRipupLimit(Configuration::GlobalRipupLimit); - } - if ( segment->isStrap () ) return _configuration->getRipupLimit(Configuration::StrapRipupLimit); if ( segment->isGlobal() ) { - vector gcells; + Katabatic::GCellVector gcells; segment->getGCells(gcells); if ( gcells.size() > 2 ) return _configuration->getRipupLimit(Configuration::LongGlobalRipupLimit); @@ -276,7 +264,7 @@ namespace Kite { // Decrease the edge's capacity only under the core area. const ChipTools& chipTools = getChipTools(); float corePercent = getEdgeCapacityPercent(); - float coronaPercent = 0.85; + float coronaPercent = 0.80; forEach ( Knik::Vertex*, ivertex, _knik->getRoutingGraph()->getVertexes() ) { for ( int i=0 ; i<2 ; ++i ) { @@ -315,7 +303,6 @@ namespace Kite { void KiteEngine::createDetailedGrid () { KatabaticEngine::createDetailedGrid (); - _kiteGrid = GCellGrid::create ( this ); size_t maxDepth = getRoutingGauge()->getDepth(); @@ -384,9 +371,9 @@ namespace Kite { ltrace(300) << "Capacity from: " << (void*)element << ":" << element << ":" << elementCapacity << endl; - GCell* gcell = _kiteGrid->getGCell ( Point(element->getSourceU(),track->getAxis()) ); - GCell* end = _kiteGrid->getGCell ( Point(element->getTargetU(),track->getAxis()) ); - GCell* right = NULL; + Katabatic::GCell* gcell = getGCellGrid()->getGCell ( Point(element->getSourceU(),track->getAxis()) ); + Katabatic::GCell* end = getGCellGrid()->getGCell ( Point(element->getTargetU(),track->getAxis()) ); + Katabatic::GCell* right = NULL; if ( not gcell ) { cerr << Warning("annotageGlobalGraph(): TrackElement outside GCell grid.") << endl; continue; @@ -427,9 +414,9 @@ namespace Kite { ltrace(300) << "Capacity from: " << (void*)element << ":" << element << ":" << elementCapacity << endl; - GCell* gcell = _kiteGrid->getGCell ( Point(track->getAxis(),element->getSourceU()) ); - GCell* end = _kiteGrid->getGCell ( Point(track->getAxis(),element->getTargetU()) ); - GCell* up = NULL; + Katabatic::GCell* gcell = getGCellGrid()->getGCell ( Point(track->getAxis(),element->getSourceU()) ); + Katabatic::GCell* end = getGCellGrid()->getGCell ( Point(track->getAxis(),element->getTargetU()) ); + Katabatic::GCell* up = NULL; if ( not gcell ) { cerr << Warning("annotageGlobalGraph(): TrackElement outside GCell grid.") << endl; continue; @@ -465,8 +452,16 @@ namespace Kite { createGlobalGraph ( mode ); + //DebugSession::addToTrace ( getCell(), "nb(0)" ); + //DebugSession::addToTrace ( getCell(), "ram_adri(0)" ); + //DebugSession::addToTrace ( getCell(), "rsdnbr_sd(9)" ); //DebugSession::addToTrace ( getCell(), "mips_r3000_1m_dp_res_re(21)" ); + //DebugSession::addToTrace ( getCell(), "mips_r3000_1m_dp_soper_se(20)" ); //DebugSession::addToTrace ( getCell(), "mips_r3000_1m_dp_res_re(20)" ); + //DebugSession::addToTrace ( getCell(), "mips_r3000_1m_dp_addsub32_carith_se_gi_1_29" ); + //DebugSession::addToTrace ( getCell(), "mips_r3000_1m_dp_instaddbracry_sd_gi_1_21" ); + //DebugSession::addToTrace ( getCell(), "mips_r3000_1m_dp_addsub32_carith_se_pi_3_29" ); + //DebugSession::addToTrace ( getCell(), "mips_r3000_1m_dp_res_se(28)" ); //DebugSession::addToTrace ( getCell(), "mips_r3000_core.mips_r3000_1m_dp.etat32_otheri_sd_2.enx" ); //DebugSession::addToTrace ( getCell(), "mips_r3000_core.mips_r3000_1m_dp.yoper_se(26)" ); //DebugSession::addToTrace ( getCell(), "mips_r3000_core.mips_r3000_1m_dp.toper_se(5)" ); @@ -519,17 +514,14 @@ namespace Kite { { if ( _negociateWindow ) return; - unsigned int rows = _kiteGrid->getRows(); - unsigned int columns = _kiteGrid->getColumns(); - startMeasures (); Session::open ( this ); cmess1 << " o Running Negociate Algorithm" << endl; - _negociateWindow = NegociateWindow::create ( this, 0, 0, columns, rows ); - _negociateWindow->loadRouting (); + _negociateWindow = NegociateWindow::create ( this ); + _negociateWindow->setGCells ( *(getGCellGrid()->getGCellVector()) ); preProcess (); _computeCagedConstraints (); _negociateWindow->run ( slowMotion ); @@ -554,7 +546,7 @@ namespace Kite { cmess2 << " o Post-checking Knik capacity overload " << (edgeCapacity*100.0) << "%." << endl; - _kiteGrid->base()->checkEdgeSaturation ( edgeCapacity ); + getGCellGrid()->checkEdgeSaturation ( edgeCapacity ); _check ( overlaps ); Session::close (); @@ -677,13 +669,13 @@ namespace Kite { forEach ( Net*, inet, getCell()->getNets() ) { forEach ( Segment*, isegment, inet->getComponents().getSubSet() ) { AutoSegment* autoSegment = ktbtSession->lookup ( *isegment ); - if ( !autoSegment ) continue; - if ( !autoSegment->isCanonical() ) continue; + if ( not autoSegment ) continue; + if ( not autoSegment->isCanonical() ) continue; TrackElement* trackSegment = Session::lookup ( *isegment ); - if ( !trackSegment ) { + if ( not trackSegment ) { coherency = false; - cerr << Bug("%p %s whithout Track Segment" + cerr << Bug("%p %s without Track Segment" ,autoSegment ,getString(autoSegment).c_str() ) << endl; @@ -731,8 +723,6 @@ namespace Kite { _routingPlanes[depth]->destroy (); } - _kiteGrid->destroy (); - _kiteGrid = NULL; Session::close (); } diff --git a/kite/src/KiteMain.cpp b/kite/src/KiteMain.cpp index f2b78792..fafbdc19 100644 --- a/kite/src/KiteMain.cpp +++ b/kite/src/KiteMain.cpp @@ -126,7 +126,7 @@ int main ( int argc, char *argv[] ) ( "edge,e" , poptions::value(&edgeCapacity)->default_value(65.0) , "The egde density ratio applied on global router's edges." ) ( "cell,c" , poptions::value() - , "The name of the cell to load, whithout extension." ) + , "The name of the cell to load, without extension." ) ( "save,s" , poptions::bool_switch(&saveDesign)->default_value(false) , "Save the routed design."); diff --git a/kite/src/NegociateWindow.cpp b/kite/src/NegociateWindow.cpp index 4faa4759..bba8697a 100644 --- a/kite/src/NegociateWindow.cpp +++ b/kite/src/NegociateWindow.cpp @@ -23,9 +23,15 @@ // x-----------------------------------------------------------------x +#include #include #include +#include +#include +namespace bfs = boost::filesystem; + +#include "hurricane/Warning.h" #include "hurricane/Bug.h" #include "hurricane/RoutingPad.h" #include "hurricane/Net.h" @@ -33,15 +39,16 @@ #include "crlcore/Utilities.h" #include "crlcore/AllianceFramework.h" #include "crlcore/Measures.h" +#include "katabatic/AutoContact.h" +#include "katabatic/GCellGrid.h" #include "kite/DataNegociate.h" #include "kite/TrackElement.h" #include "kite/TrackMarker.h" #include "kite/TrackCost.h" #include "kite/Track.h" +#include "kite/TrackSegment.h" #include "kite/RoutingPlane.h" -#include "kite/GCellGrid.h" -#include "kite/GCellRoutingSet.h" #include "kite/RoutingEventQueue.h" #include "kite/RoutingEventHistory.h" #include "kite/NegociateWindow.h" @@ -50,13 +57,115 @@ namespace { - using namespace std; using namespace Hurricane; using namespace CRL; using namespace Kite; + class Histogram { + public: + Histogram ( double range, double step, size_t nbSets ); + ~Histogram (); + void addSample ( double, size_t iset ); + void toStream ( ostream& ); + void toFile ( bfs::path& ); + void toGnuplot ( string design ); + void normalize ( double totalSamples, size_t iset ); + private: + double _range; + double _step; + vector< vector > _sets; + }; + + + Histogram::Histogram ( double range, double step, size_t nbSets ) + : _range (range) + , _step (step) + , _sets () + { + size_t binSize = (size_t)rint ( _range / _step ); + for ( size_t iset=0 ; iset() ); + for ( size_t i=0 ; i _sets.front().size() ) binIndex = _sets.front().size() - 1; + + _sets[iset][binIndex] += 1.0; + } + + + void Histogram::normalize ( double totalSamples, size_t iset ) + { + for ( size_t i=0 ; i<_sets[iset].size() ; ++i ) _sets[iset][i] /= totalSamples; + } + + + void Histogram::toStream ( ostream& o ) + { + o << setprecision(3); + + for ( size_t i=0 ; i<_sets.front().size() ; ++i ) { + for ( size_t iset=0 ; iset<_sets.size() ; ++iset ) { + o << _sets[iset][i] << " "; + } + o << "\n"; + } + } + + + void Histogram::toFile ( bfs::path& path ) + { + bfs::ofstream fd ( path ); + toStream ( fd ); + fd.close (); + } + + + void Histogram::toGnuplot ( string design ) + { + bfs::path datFile = design + ".densityHist.dat"; + toFile ( datFile ); + + bfs::path pltFile = design + ".densityHist.plt"; + bfs::ofstream fd ( pltFile ); + + fd << "set grid\n"; + fd << "set grid noxtics\n"; + fd << "set xrange [-0.5:9.5]\n"; + fd << "set xtics ( "; + for ( size_t i=0 ; i<10 ; ++i ) { + fd << ((i) ? " ," : "") << "\"<" << ((i+1)*10) << "%%\" " << i; + } + fd << " )\n"; + + fd << "set yrange [0:.4]\n"; + fd << "set ytics ( "; + for ( float i=0.0 ; i<=40.0 ; i+=10.0 ) { + fd << ((i != 0.0) ? " ," : "") << "\"" << i << "%%\" " << (i/100.0); + } + fd << " )\n"; + + fd << "set style histogram cluster gap 1\n"; + fd << "set style fill solid noborder\n"; + fd << "set boxwidth 1\n"; + fd << "plot \"" << design << ".densityHist.dat\" using 1 title \"Avg. density\" with histogram linecolor rgb \"green\", \\\n"; + fd << " \"" << design << ".densityHist.dat\" using 2 title \"Peak. density\" with histogram linecolor rgb \"red\"\n"; + + fd.close (); + } + + void NegociateOverlapCost ( const TrackElement* segment, TrackCost& cost ) { Interval intersect = segment->getCanonicalInterval(); @@ -64,7 +173,7 @@ namespace { if ( not intersect.intersect ( cost.getInterval() ) ) return; if ( segment->isBlockage() or segment->isFixed() ) { - //ltrace(200) << "Infinite cost from: " << segment << endl; + ltrace(200) << "Infinite cost from: " << segment << endl; cost.setInfinite (); cost.setOverlap (); cost.setHardOverlap (); @@ -81,30 +190,22 @@ namespace { DataNegociate* data = segment->getDataNegociate (); if ( not data ) return; - if ( data->getGCellOrder() >= Session::getOrder() ) { - cost.mergeRipupCount ( data->getRipupCount() ); - if ( segment->isLocal() ) { - cost.mergeDataState ( data->getState() ); - if ( data->getState() >= DataNegociate::LocalVsGlobal ) { - ltrace(200) << "MaximumSlack/LocalVsGlobal for " << segment << endl; - } + cost.mergeRipupCount ( data->getRipupCount() ); + if ( segment->isLocal() ) { + cost.mergeDataState ( data->getState() ); + if ( data->getState() >= DataNegociate::LocalVsGlobal ) { + ltrace(200) << "MaximumSlack/LocalVsGlobal for " << segment << endl; } } - if ( /*(data->getGCellOrder() < Session::getOrder()) or*/ - ((data->isRing() or data->isBorder()) and (data->getRipupCount() > 3)) ) { - ltrace(200) << "Infinite cost from: " << segment << endl; - cost.setFixed (); - cost.setInfinite (); - cost.setOverlap (); - cost.setHardOverlap (); - return; - } - - if ( ( data->getGCellOrder() < Session::getOrder() ) - or ( ( data->getCost().getRightMinExtend() >= cost.getInterval().getVMin() ) - and ( data->getCost().getLeftMinExtend () <= cost.getInterval().getVMax() ) ) ) - cost.setHardOverlap (); + // if ( data->getRipupCount() > 3 ) { + // ltrace(200) << "Infinite cost from: " << segment << endl; + // cost.setFixed (); + // cost.setInfinite (); + // cost.setOverlap (); + // cost.setHardOverlap (); + // return; + // } cost.setOverlap (); cost.incTerminals ( data->getCost().getTerminals()*100 ); @@ -139,13 +240,13 @@ namespace { namespace Kite { - using std::cerr; using std::endl; using std::setw; using std::left; using std::right; using std::setprecision; + using Hurricane::Warning; using Hurricane::Bug; using Hurricane::tab; using Hurricane::inltrace; @@ -153,81 +254,33 @@ namespace Kite { using Hurricane::ltraceout; using Hurricane::ForEachIterator; using CRL::addMeasure; - - -// ------------------------------------------------------------------- -// Class : "NegociateWindow::RingSegment". - - - bool NegociateWindow::RingSegment::orderReached ( const NegociateWindow::RingSegment& segment ) - { - return ( segment.getOrder() <= Session::getOrder() ); - } - - - - NegociateWindow::RingSegment::RingSegment ( TrackElement* segment ) - : _segment(segment), _order(0) - { - DataNegociate* data = segment->getDataNegociate (); - if ( data ) _order = data->getGCellOrder (); - } + using Katabatic::AutoContact; // ------------------------------------------------------------------- // Class : "NegociateWindow". - NegociateWindow::NegociateWindow ( KiteEngine* kite - , unsigned int columnMin - , unsigned int rowMin - , unsigned int columnMax - , unsigned int rowMax - ) - : _slowMotion (0) - , _interrupt (false) - , _kite (kite) - , _gridBox (NULL) - , _criticalGCells () - , _gcellOrder (0) - , _gcellRoutingSets() - , _eventQueue () - , _eventHistory () - , _ring () - { - _gridBox = GridBox::create ( _kite->getGCellGrid() - , columnMin - , rowMin - , columnMax - , rowMax - ); - } + NegociateWindow::NegociateWindow ( KiteEngine* kite ) + : _slowMotion (0) + , _interrupt (false) + , _kite (kite) + , _gcells () + , _segments () + , _eventQueue () + , _eventHistory() + { } - NegociateWindow* NegociateWindow::create ( KiteEngine* kite - , unsigned int columnMin - , unsigned int rowMin - , unsigned int columnMax - , unsigned int rowMax - ) + NegociateWindow* NegociateWindow::create ( KiteEngine* kite ) { - NegociateWindow* negociateWindow = new NegociateWindow ( kite - , columnMin - , rowMin - , columnMax - , rowMax - ); + NegociateWindow* negociateWindow = new NegociateWindow ( kite ); return negociateWindow; } NegociateWindow::~NegociateWindow () - { - for ( size_t i=0 ; i<_gcellRoutingSets.size() ; i++ ) - _gcellRoutingSets[i]->destroy (); - - if ( _gridBox ) delete _gridBox; - } + { } void NegociateWindow::destroy () @@ -238,53 +291,10 @@ namespace Kite { { return _kite->getCell(); } - void NegociateWindow::addToRing ( TrackElement* segment ) + void NegociateWindow::setGCells ( const Katabatic::GCellVector& gcells ) { - ltrace(200) << "addToRing: " << segment << endl; - - _ring.push_back ( RingSegment(segment) ); - - DataNegociate* data = segment->getDataNegociate (); - data->setRing ( true ); - data->setGCellOrder ( Session::getOrder() ); - - _eventQueue.add ( segment, 0 ); - } - - - void NegociateWindow::loadRouting () - { - vector gcells; - GCellGrid* grid = getKiteEngine()->getGCellGrid(); - - forEach ( GCell*, igcell, grid->getGCells() ) { - gcells.push_back ( *igcell ); - igcell->updateDensity (); - } - - sort ( gcells.begin(), gcells.end(), GCell::CompareByDensity() ); - -#if defined(CHECK_DETERMINISM) - cerr << "Order: After sort<>" << endl; - for ( size_t i=0 ; i < gcells.size() ; i++ ) { - cerr << "Order: " - << setw(9) << left << setprecision(6) << gcells[i]->base()->getDensity() - << setw(5) << right << gcells[i]->getIndex() - << " " << gcells[i] << endl; - } -#endif - - unsigned int order = 0; - for ( size_t i=0 ; i < gcells.size() ; i++ ) { - if ( not gcells[i]->isInRoutingSet() ) { - Session::setOrder ( order ); - GCellRoutingSet* rs = GCellRoutingSet::create ( gcells[i], _kite->getExpandStep() ); - rs->expand ( grid ); - rs->loadRouting ( order ); - - _gcellRoutingSets.push_back ( rs ); - } - } + _gcells = gcells; + //sort ( _gcells.begin(), _gcells.end(), Katabatic::GCell::CompareGCellById() ); loadRoutingPads ( this ); Session::revalidate (); @@ -297,12 +307,7 @@ namespace Kite { segment->getDataNegociate()->update(); } - getKiteEngine()->setMinimumWL ( grid->getTotalWireLength() ); - -#if defined(CHECK_DATABASE) - unsigned int overlaps = 0; - Session::getKiteEngine()->_check(overlaps,"after LoadRouting"); -#endif + _statistics.setGCellsCount ( _gcells.size() ); } @@ -320,49 +325,159 @@ namespace Kite { } - void NegociateWindow::_unloadRing () + TrackElement* NegociateWindow::addTrackSegment ( AutoSegment* autoSegment, bool loading ) { - _ring.erase ( remove_if(_ring.begin(),_ring.end(),RingSegment::orderReached), _ring.end() ); - for ( size_t i=0 ; i<_ring.size() ; ++i ) { - if ( _ring[i].getSegment()->getTrack() != NULL ) - Session::addRemoveEvent ( _ring[i].getSegment() ); + ltrace(200) << "NegociateWindow::addTrackSegment() - " << autoSegment << endl; + ltracein(159); + + // Special case: fixed AutoSegments must not interfere with blockages. + // Ugly: uses of getExtensionCap(). + if ( autoSegment->isFixed() ) { + RoutingPlane* plane = Session::getKiteEngine()->getRoutingPlaneByLayer(autoSegment->getLayer()); + Track* track = plane->getTrackByPosition ( autoSegment->getAxis() ); + size_t begin; + size_t end; + Interval fixedSpan; + Interval blockageSpan; + + autoSegment->getCanonical ( fixedSpan ); + fixedSpan.inflate ( Session::getExtensionCap()-1 ); + + track->getOverlapBounds ( fixedSpan, begin, end ); + for ( ; (begin < end) ; begin++ ) { + + TrackElement* other = track->getSegment(begin); + ltrace(200) << "| overlap: " << other << endl; + + if ( not other->isBlockage() ) continue; + + other->getCanonical ( blockageSpan ); + blockageSpan.inflate(Session::getExtensionCap()); + + ltrace(200) << " fixed:" << fixedSpan << " vs. blockage:" << blockageSpan << endl; + + if ( not fixedSpan.intersect(blockageSpan) ) continue; + + // Overlap between fixed & blockage. + ltrace(200) << "* Blockage overlap: " << autoSegment << endl; + Session::destroyRequest ( autoSegment ); + + cerr << Warning("Overlap between fixed %s and blockage at %s." + ,getString(autoSegment).c_str(),getString(blockageSpan).c_str()) << endl; + + return NULL; + } } - Session::revalidate (); + Interval span; + autoSegment = autoSegment->getCanonical ( span ); + + bool created; + TrackElement* trackSegment = TrackSegment::create ( autoSegment, NULL, created ); + + if ( not loading ) + ltrace(159) << "* lookup: " << autoSegment << endl; + + if ( created ) { + ltrace(159) << "* " << trackSegment << endl; + + RoutingPlane* plane = Session::getKiteEngine()->getRoutingPlaneByLayer(autoSegment->getLayer()); + Track* track = plane->getTrackByPosition ( autoSegment->getAxis() ); + Interval uside = autoSegment->getAutoSource()->getGCell()->getUSide ( Constant::perpandicular(autoSegment->getDirection())/*, false */); + + if ( track->getAxis() > uside.getVMax() ) track = track->getPrevious(); + if ( track->getAxis() < uside.getVMin() ) track = track->getNext(); + + trackSegment->setAxis ( track->getAxis(), Katabatic::Realignate|Katabatic::AxisSet ); + trackSegment->invalidate (); + + if ( trackSegment->isFixed() ) { + Session::addInsertEvent ( trackSegment, track ); + } else { + _segments.push_back ( trackSegment ); + } + } + + if ( not created and not loading ) { + ltrace(200) << "TrackSegment already exists (and not in loading stage)." << endl; + } + + ltraceout(159); + + return trackSegment; } - void NegociateWindow::_loadRing () + double NegociateWindow::computeWirelength () { - unsigned int order = Session::getOrder (); - for ( size_t i=0 ; i<_ring.size() ; i++ ) { - TrackElement* segment = _ring[i].getSegment(); - DataNegociate* data = segment->getDataNegociate (); + set accounteds; + double totalWL = 0.0; - data->resetRipupCount (); - data->resetStateCount (); - data->setGCellOrder ( order ); - if ( _ring[i].getOrder() == order ) { - ltrace(200) << "Removing from ring: " << segment << endl; - data->setRing ( false ); + for ( size_t igcell=0 ; igcell<_gcells.size() ; ++igcell ) { + double gcellWL = 0.0; + Segment* segment; + TrackElement* trackSegment; + + vector* contacts = _gcells[igcell]->getContacts(); + for ( size_t i=0 ; isize() ; i++ ) { + forEach ( Hook*, ihook, (*contacts)[i]->getBodyHook()->getSlaveHooks() ) { + Hook* sourceHook = dynamic_cast(*ihook); + if ( not sourceHook ) continue; + + segment = dynamic_cast(sourceHook->getComponent()); + trackSegment = Session::lookup ( segment ); + if ( trackSegment ) { + if ( accounteds.find(trackSegment) != accounteds.end() ) continue; + + accounteds.insert ( trackSegment ); + gcellWL += DbU::getLambda ( trackSegment->getLength() ); + } + } } - _eventQueue.add ( segment, 0 ); + // Partial sum to limit rounding errors. + totalWL += gcellWL; } - _eventQueue.commit (); + + return totalWL; } - size_t NegociateWindow::_negociate ( const vector& segments ) + void NegociateWindow::_createRouting ( Katabatic::GCell* gcell ) { - ltrace(150) << "NegociateWindow::_negociate() - " << segments.size() << endl; + ltrace(200) << "NegociateWindow::_createRouting() - " << gcell << endl; + ltracein(200); + + Segment* segment; + AutoSegment* autoSegment; + + ltrace(149) << "AutoSegments from AutoContacts" << endl; + vector* contacts = gcell->getContacts(); + for ( size_t i=0 ; isize() ; i++ ) { + forEach ( Component*, component, (*contacts)[i]->getSlaveComponents() ) { + segment = dynamic_cast(*component); + autoSegment = Session::base()->lookup ( segment ); + ltrace(149) << autoSegment << endl; + if ( autoSegment and autoSegment->isCanonical() ) { + addTrackSegment ( autoSegment, true ); + } + } + } + + ltrace(149) << "_segments.size():" << _segments.size() << endl; + ltraceout(200); + } + + + size_t NegociateWindow::_negociate () + { + ltrace(150) << "NegociateWindow::_negociate() - " << _segments.size() << endl; ltracein(149); unsigned long limit = _kite->getEventsLimit(); _eventHistory.clear(); - _eventQueue.load ( segments ); - _loadRing (); + _eventQueue.load ( _segments ); size_t count = 0; while ( not _eventQueue.empty() and not isInterrupted() ) { @@ -370,11 +485,11 @@ namespace Kite { event->process ( _eventQueue, _eventHistory ); if (tty::enabled()) { - cmess1 << " " << tty::cr; cmess1.flush (); } else { - cmess2 << " id:" << event->getSegment()->getId() << " " << event->getSegment()->getNet()->getName() @@ -384,23 +499,6 @@ namespace Kite { if ( RoutingEvent::getProcesseds() >= limit ) setInterrupt ( true ); count++; - -#if ENABLE_STIFFNESS - if ( not (RoutingEvent::getProcesseds() % 1000) ) { - sort ( _criticalGCells.begin(), _criticalGCells.end(), GCell::CompareByStiffness() ); - for ( size_t igcell=0 ; igcell<_criticalGCells.size() ; ++igcell ) { - if ( _criticalGCells[igcell]->getStiffness () < 0.7 ) break; - if ( _criticalGCells[igcell]->getSegmentCount() < 20 ) continue; - - cerr << " - Anticipate: " << _criticalGCells[igcell] - << ":" << _criticalGCells[igcell]->getStiffness() << endl; - - _criticalGCells[igcell]->anticipateRouting ( Session::getOrder() ); - _eventQueue.load ( _criticalGCells[igcell]->getOwnedSegments() ); - _criticalGCells[igcell]->setRouted ( true ); - } - } -#endif } if (count and tty::enabled()) cmess1 << endl; count = 0; @@ -420,12 +518,12 @@ namespace Kite { event->process ( _eventQueue, _eventHistory ); if (tty::enabled()) { - cmess1 << " " << tty::cr; cmess1.flush (); } else { - cmess1 << " " << endl; } } @@ -434,7 +532,6 @@ namespace Kite { size_t eventsCount = _eventHistory.size(); - _unloadRing (); _eventHistory.clear(); _eventQueue.clear(); @@ -448,74 +545,39 @@ namespace Kite { // Session::open ( _kiteEngine ); // } + _statistics.setEventsCount ( eventsCount ); ltraceout(149); return eventsCount; } - void NegociateWindow::_runOnGCellRoutingSet ( GCellRoutingSet* rs ) - { -#if defined(CHECK_DETERMINISM) - cerr << "Order: Routing set: " << rs << endl; -#endif - - ltrace(200) << "Routing " << rs << endl; - ltracein(200); - - cmess1 << " - Routing " << rs << endl; - - vector gcells = rs->getGCells (); - for ( size_t i=0 ; igetOrder() ); - - vector segments; - rs->loadBorder ( getKiteEngine()->getGCellGrid() ); - rs->getOwnedSegments ( segments ); - rs->setRouted ( true ); - rs->getStatistics ().setEventsCount ( _negociate(segments) ); - rs->freeBorder (); - - ltraceout(200); - } - - void NegociateWindow::run ( int slowMotion ) { ltrace(150) << "NegociateWindow::run()" << endl; ltracein(149); - _criticalGCells = *(getKiteEngine()->getGCellGrid()->getGCellVector()); - TrackElement::setOverlapCostCB ( NegociateOverlapCost ); RoutingEvent::resetProcesseds (); - // sort ( gcells.begin(), gcells.end(), GCell::CompareByStiffness() ); - // for ( size_t j=0 ; jgetStiffness() << endl; - // } + for ( size_t igcell=0 ; igcell<_gcells.size() ; ++igcell ) { + _createRouting ( _gcells[igcell] ); + } + Session::revalidate (); + + getKiteEngine()->setMinimumWL ( computeWirelength() ); + +#if defined(CHECK_DATABASE) + unsigned int overlaps = 0; + Session::getKiteEngine()->_check(overlaps,"after _createRouting(GCell*)"); +#endif _slowMotion = slowMotion; - _gcellOrder = 0; - for ( size_t i=0 ; (i<_gcellRoutingSets.size()) && !isInterrupted() ; i++ ) { - _runOnGCellRoutingSet ( _gcellRoutingSets[i] ); - - // sort ( gcells.begin(), gcells.end(), GCell::CompareByStiffness() ); - // for ( size_t j=0 ; jgetStiffness() << endl; - // } - } + _negociate (); Session::get()->isEmpty(); # if defined(CHECK_DATABASE) - unsigned int overlaps = 0; _kite->_check ( overlaps, "after negociation" ); # endif @@ -526,29 +588,31 @@ namespace Kite { void NegociateWindow::printStatistics () const { cmess1 << " o Computing statistics." << endl; - - Statistics globalStatistics; - size_t biggestEventsCount = 0; - size_t biggestRSsize = 0; - for ( size_t i=0; i<_gcellRoutingSets.size() ; i++ ) { - Statistics& statistics = _gcellRoutingSets[i]->getStatistics(); - globalStatistics += statistics; - - if ( statistics.getEventsCount() > biggestEventsCount ) - biggestEventsCount = statistics.getEventsCount(); - - if ( _gcellRoutingSets[i]->getGCells().size() > biggestRSsize ) - biggestRSsize = _gcellRoutingSets[i]->getGCells().size(); - } - cmess1 << Dots::asSizet(" - Processeds Events Total",RoutingEvent::getProcesseds()) << endl; cmess1 << Dots::asSizet(" - Unique Events Total" ,(RoutingEvent::getProcesseds() - RoutingEvent::getCloneds())) << endl; - cmess1 << Dots::asSizet(" - Biggest Events Chunk" ,biggestEventsCount) << endl; - cmess1 << Dots::asSizet(" - Biggest Routing Set" ,biggestRSsize) << endl; + cmess1 << Dots::asSizet(" - # of GCells",_statistics.getGCellsCount()) << endl; addMeasure( getCell(), "Events" , RoutingEvent::getProcesseds(), 12 ); addMeasure( getCell(), "UEvents", RoutingEvent::getProcesseds()-RoutingEvent::getCloneds(), 12 ); + + Histogram densityHistogram ( 1.0, 0.1, 2 ); + + const Katabatic::GCellVector* gcells = getKiteEngine()->getGCellGrid()->getGCellVector(); + + getKiteEngine()->getGCellGrid()->setDensityMode ( Katabatic::GCellGrid::AverageHVDensity ); + for ( size_t igcell=0 ; igcell<(*gcells).size() ; ++igcell ) { + densityHistogram.addSample ( (*gcells)[igcell]->getDensity(), 0 ); + } + + getKiteEngine()->getGCellGrid()->setDensityMode ( Katabatic::GCellGrid::MaxDensity ); + for ( size_t igcell=0 ; igcell<(*gcells).size() ; ++igcell ) { + densityHistogram.addSample ( (*gcells)[igcell]->getDensity(), 1 ); + } + + densityHistogram.normalize ( (*gcells).size(), 0 ); + densityHistogram.normalize ( (*gcells).size(), 1 ); + densityHistogram.toGnuplot ( getString(getCell()->getName()) ); } @@ -556,7 +620,7 @@ namespace Kite { { ostringstream os; - os << "<" << _getTypeName() << _gridBox << ">"; + os << "<" << _getTypeName() << ">"; return ( os.str() ); } @@ -565,7 +629,7 @@ namespace Kite { { Record* record = new Record ( _getString() ); - record->add ( getSlot ( "_gridBox" , _gridBox ) ); + record->add ( getSlot ( "_gcells", _gcells ) ); return ( record ); } diff --git a/kite/src/PreProcess.cpp b/kite/src/PreProcess.cpp index a8ab8d40..12d6bc33 100644 --- a/kite/src/PreProcess.cpp +++ b/kite/src/PreProcess.cpp @@ -33,11 +33,11 @@ #include "hurricane/Name.h" #include "hurricane/RoutingPad.h" #include "katabatic/AutoContact.h" -#include "kite/GCell.h" #include "kite/DataNegociate.h" #include "kite/TrackElement.h" #include "kite/Track.h" #include "kite/RoutingPlane.h" +#include "kite/NegociateWindow.h" #include "kite/Session.h" #include "kite/KiteEngine.h" @@ -52,10 +52,10 @@ namespace { using namespace Kite; - void getPerpandiculars ( TrackElement* segment - , AutoContact* from - , unsigned int direction - , vector& perpandiculars + void getPerpandiculars ( TrackElement* segment + , Katabatic::AutoContact* from + , unsigned int direction + , vector& perpandiculars ) { //AutoContact* to = segment->base()->getAutoSource(); @@ -94,7 +94,7 @@ namespace { if ( parallel->isFixed () ) continue; if ( parallel->getDirection() != direction ) continue; - AutoContact* contact = parallel->base()->getAutoSource(); + Katabatic::AutoContact* contact = parallel->base()->getAutoSource(); if ( contact->base()->getAnchor() != rp ) contact = NULL; if ( contact == NULL ) contact = parallel->base()->getAutoTarget(); @@ -112,14 +112,14 @@ namespace { ltrace(200) << "Propagate caging: " << segment << endl; - Track* track = segment->getTrack(); - unsigned int direction = Session::getRoutingGauge()->getLayerDirection(segment->getLayer()); - AutoContact* source = segment->base()->getAutoSource(); - RoutingPad* rp = NULL; - Interval uside = source->getGCell()->getUSide(direction); - DbU::Unit minConstraint = DbU::Min; - DbU::Unit maxConstraint = DbU::Max; - vector perpandiculars; + Track* track = segment->getTrack(); + unsigned int direction = Session::getRoutingGauge()->getLayerDirection(segment->getLayer()); + Katabatic::AutoContact* source = segment->base()->getAutoSource(); + RoutingPad* rp = NULL; + Interval uside = source->getGCell()->getUSide(direction); + DbU::Unit minConstraint = DbU::Min; + DbU::Unit maxConstraint = DbU::Max; + vector perpandiculars; if ( not track ) { cerr << Bug("%s is not inserted in a ",getString(segment).c_str()) << endl; @@ -222,25 +222,26 @@ namespace { if ( segment->getLayer() != metal2 ) continue; if ( segment->getLength() >= DbU::lambda(5.0) ) continue; - AutoContact* support = segment->base()->getAutoSource(); - RoutingPad* rp = dynamic_cast(support->getAnchor()); - GCell* gcell = Session::lookup ( support->getGCell() ); + Katabatic::AutoContact* support = segment->base()->getAutoSource(); + RoutingPad* rp = dynamic_cast(support->getAnchor()); - AutoContact* source = AutoContact::fromRp ( gcell->base() - , rp - , metal3 - , rp->getSourcePosition() - , DbU::lambda(1.0), DbU::lambda(1.0) - , true - ); + Katabatic::AutoContact* source + = Katabatic::AutoContact::fromRp ( support->getGCell() + , rp + , metal3 + , rp->getSourcePosition() + , DbU::lambda(1.0), DbU::lambda(1.0) + , true + ); - AutoContact* target = AutoContact::fromRp ( gcell->base() - , rp - , metal3 - , rp->getSourcePosition() - , DbU::lambda(1.0), DbU::lambda(1.0) - , true - ); + Katabatic::AutoContact* target = + Katabatic::AutoContact::fromRp ( support->getGCell() + , rp + , metal3 + , rp->getSourcePosition() + , DbU::lambda(1.0), DbU::lambda(1.0) + , true + ); AutoSegment* segment = AutoSegment::create ( source , target @@ -250,7 +251,7 @@ namespace { , false ); segment->setFixed ( true ); - GCell::addTrackSegment ( gcell, segment, true ); + Session::getNegociateWindow()->addTrackSegment ( segment, true ); #if DISABLED // Force slackening. diff --git a/kite/src/RoutingEvent.cpp b/kite/src/RoutingEvent.cpp index 3b697d12..f75ca06a 100644 --- a/kite/src/RoutingEvent.cpp +++ b/kite/src/RoutingEvent.cpp @@ -26,20 +26,16 @@ #include #include #include - #include "hurricane/Bug.h" #include "hurricane/DebugSession.h" #include "hurricane/Breakpoint.h" #include "hurricane/Net.h" #include "hurricane/Layer.h" - #include "katabatic/AutoContact.h" - #include "kite/DataNegociate.h" #include "kite/TrackElement.h" #include "kite/Track.h" #include "kite/Tracks.h" -#include "kite/GCell.h" #include "kite/RoutingPlane.h" #include "kite/RoutingEvent.h" #include "kite/RoutingEventHistory.h" @@ -223,15 +219,18 @@ namespace { class Cs1Candidate { public: - inline Cs1Candidate ( Track* track=NULL ); - inline Track* getTrack () const; - inline size_t getBegin () const; - inline size_t getEnd () const; - inline size_t getLength () const; - inline Interval getConflict ( size_t ); - inline void setBegin ( size_t ); - inline void setEnd ( size_t ); - inline void addConflict ( const Interval& ); + inline Cs1Candidate ( Track* track=NULL ); + inline Track* getTrack () const; + inline size_t getBegin () const; + inline size_t getEnd () const; + inline size_t getLength () const; + inline Interval getConflict ( size_t ); + inline DbU::Unit getBreakPos () const; + inline DbU::Unit getConflictLength () const; + inline void setBegin ( size_t ); + inline void setEnd ( size_t ); + inline void addConflict ( const Interval& ); + void consolidate (); public: friend inline bool operator< ( const Cs1Candidate&, const Cs1Candidate& ); private: @@ -239,23 +238,33 @@ namespace { size_t _begin; size_t _end; vector _conflicts; + DbU::Unit _breakPos; + DbU::Unit _conflictLength; }; inline Cs1Candidate::Cs1Candidate ( Track* track ) - : _track (track) - , _begin (0) - , _end (0) - , _conflicts() + : _track (track) + , _begin (0) + , _end (0) + , _conflicts () + , _breakPos (0) + , _conflictLength(0) { } - inline Track* Cs1Candidate::getTrack () const { return _track; } - inline size_t Cs1Candidate::getBegin () const { return _begin; } - inline size_t Cs1Candidate::getEnd () const { return _end; } - inline size_t Cs1Candidate::getLength () const { return _conflicts.size(); } - inline void Cs1Candidate::setBegin ( size_t i ) { _begin=i; } - inline void Cs1Candidate::setEnd ( size_t i ) { _end=i; } - inline void Cs1Candidate::addConflict ( const Interval& conflict ) { _conflicts.push_back(conflict); } + inline Track* Cs1Candidate::getTrack () const { return _track; } + inline size_t Cs1Candidate::getBegin () const { return _begin; } + inline size_t Cs1Candidate::getEnd () const { return _end; } + inline size_t Cs1Candidate::getLength () const { return _conflicts.size(); } + inline DbU::Unit Cs1Candidate::getBreakPos () const { return _breakPos; } + inline void Cs1Candidate::setBegin ( size_t i ) { _begin=i; } + inline void Cs1Candidate::setEnd ( size_t i ) { _end=i; } + + inline void Cs1Candidate::addConflict ( const Interval& conflict ) + { + _conflicts.push_back(conflict); + _conflictLength += conflict.getSize(); + } inline Interval Cs1Candidate::getConflict ( size_t i ) { @@ -264,7 +273,30 @@ namespace { } inline bool operator< ( const Cs1Candidate& lhs, const Cs1Candidate& rhs ) - { return lhs._conflicts.size() < rhs._conflicts.size(); } + { + DbU::Unit delta = lhs._conflicts.size() - rhs._conflicts.size(); + if ( delta < 0 ) return true; + if ( delta > 0 ) return false; + + return lhs._conflictLength < rhs._conflictLength; + } +//{ return lhs._conflictLength < rhs._conflictLength; } + + void Cs1Candidate::consolidate () + { + if ( _conflicts.size() > 0 ) { + DbU::Unit halfConflict = 0; + size_t i = 0; + for ( ; i<_conflicts.size() ; ++i ) { + halfConflict += _conflicts.size(); + if ( halfConflict > _conflictLength/2 ) + break; + } + + // Ugly: hard-coded pitch. + _breakPos = _conflicts[i].getVMin() - DbU::lambda(5.0); + } + } // ------------------------------------------------------------------- @@ -758,27 +790,12 @@ namespace { data->setRipupCount ( Session::getKiteEngine()->getRipupLimit(_segment) ); } - if ( data->getGCellOrder() == Session::getOrder() ) { - // Current order, default behavior: ripup. - if ( _segment->getTrack() ) - Session::addRemoveEvent ( _segment ); - } else if ( data->getGCellOrder() < Session::getOrder() ) { - // Order is lower: no longer able to displace it. - return false; - } else { - // Order is greater, do not route now. Ripup if needed. - if ( _segment->getTrack() ) - Session::addRemoveEvent ( _segment ); - return true; - } + if ( _segment->getTrack() ) Session::addRemoveEvent ( _segment ); RoutingEvent* event = data->getRoutingEvent(); if ( event == NULL ) { - if ( data->getGCellOrder() == Session::getOrder() ) { - cerr << Bug("Missing Event on %p:%s" - ,_segment->base()->base(),getString(_segment).c_str()) << endl; - } - ltrace(200) << "Not in current GCellRoutingSet, cancelled." << endl; + cerr << Bug("Missing Event on %p:%s" + ,_segment->base()->base(),getString(_segment).c_str()) << endl; return true; } @@ -890,10 +907,11 @@ namespace { , PerpandicularsFirst = 0x08 , ToMoveUp = 0x10 , AllowLocalMoveUp = 0x20 - , NoDoglegReuse = 0x40 + , AllowTerminalMoveUp = 0x40 + , NoDoglegReuse = 0x80 }; enum { LeftAxisHint=1, RightAxisHint=2 }; - enum { NoRingLimit=0x1, HasNextRipup=0x2 }; + enum { HasNextRipup=0x2 }; public: Manipulator ( TrackElement*, State& ); ~Manipulator (); @@ -964,10 +982,6 @@ namespace { return; } -#if defined(CHECK_DETERMINISM) - cerr << "Order: " << _data->getGCellOrder() << " - " << _data->getCost() << endl; -#endif - _data->update (); _event->invalidate ( true ); // Optimizable. _event->revalidate ( true ); @@ -1018,28 +1032,6 @@ namespace { } ltraceout(148); - if ( _data->isBorder() and (_costs.size() == 1) and _costs[0].isInfinite() ) { - Interval span; - if ( _data->isLeftBorder() ) { - span = Interval ( segment->getCanonicalInterval().getVMin() - , segment->getCanonicalInterval().getVMin()+DbU::lambda(5.0) ); - } else { - span = Interval ( segment->getCanonicalInterval().getVMax()-DbU::lambda(5.0) - , segment->getCanonicalInterval().getVMax() ); - } - - Track* track = _costs[0].getTrack(); - _costs[0] = track->getOverlapCost ( span, segment->getNet() ); - _costs[0].setAxisWeight ( _event->getAxisWeight(track->getAxis()) ); - _costs[0].incDeltaPerpand ( _data->getCost().getWiringDelta(track->getAxis()) ); - - if ( segment->isGlobal() and (_costs[0].getDataState() == DataNegociate::MaximumSlack) ) - _costs[0].setInfinite (); - - _costs[0].consolidate (); - ltrace(200) << "Replace: " << _costs[0] << endl; - } - if ( _costs.empty() ) { Track* nearest = plane->getTrackByPosition(_constraint.getCenter()); @@ -1175,7 +1167,7 @@ namespace { else breakPoint = Point ( segment->getAxis(), (sourceDogLeg)?minConflict:maxConflict ); - GCell* dogLegGCell = Session::getGCellUnder ( breakPoint.getX(), breakPoint.getY() ); + Katabatic::GCell* dogLegGCell = Session::getGCellUnder ( breakPoint.getX(), breakPoint.getY() ); if ( dogLegGCell ) { if ( segment->canDogLegAt(dogLegGCell) ) { if ( segment->makeDogLeg(dogLegGCell) ) @@ -1191,7 +1183,7 @@ namespace { else breakPoint = Point ( segment->getAxis(), (targetDogLeg)?maxConflict:minConflict ); - GCell* dogLegGCell = Session::getGCellUnder ( breakPoint.getX(), breakPoint.getY() ); + Katabatic::GCell* dogLegGCell = Session::getGCellUnder ( breakPoint.getX(), breakPoint.getY() ); if ( dogLegGCell ) { if ( segment->canDogLegAt(dogLegGCell) ) { if ( segment->makeDogLeg(dogLegGCell) ) @@ -1227,14 +1219,9 @@ namespace { ltrace(200) << "State::conflictSolve1()" << endl; ltracein(200); - //bool success = false; Interval constraints; vector candidates; TrackElement* segment = _event->getSegment(); - //bool canMoveUp = (segment->isLocal()) ? segment->canPivotUp(0.5) : segment->canMoveUp(1.0); - //unsigned int relaxFlags = Manipulator::NoDoglegReuse - // | ((_data and (_data->getStateCount() < 2)) ? Manipulator::AllowExpand - // : Manipulator::NoExpand); segment->base()->getConstraints ( constraints ); Interval overlap = segment->getCanonicalInterval(); @@ -1272,10 +1259,8 @@ namespace { vector doglegGCells; segment->getGCells ( gcells ); - //unsigned int depth = Session::getRoutingGauge()->getLayerDepth(segment->getLayer()); - Interval uside; - - size_t idogleg = 0; + Interval uside; + size_t idogleg = 0; for ( size_t igcell=0 ; igcellgetUSide(segment->getDirection(),true); ltrace(200) << "| " << gcells[igcell] << " uside: " << uside << endl; @@ -1373,10 +1358,19 @@ namespace { candidates.back().addConflict ( otherOverlap ); ltrace(200) << " | Other overlap: " << otherOverlap << endl; } + + candidates.back().consolidate(); } sort ( candidates.begin(), candidates.end() ); + // if ( not candidates.empty() ) { + // ltrace(200) << "Trying l:" << candidates[0].getLength() + // << " " << candidates[0].getTrack() << endl; + + // success = Manipulator(segment,*this).makeDogLeg ( candidates[0].getBreakPos() ); + // } + for ( size_t icandidate=0 ; icandidategetSegment(candidates[icandidate].getBegin()); - if ( other->isGlobal() - and (other->getDataNegociate()->getGCellOrder() == Session::getOrder()) - and other->canMoveUp(1.0) ) { + // if ( other->isGlobal() and other->canMoveUp(1.0) ) { + // ltrace(200) << "conflictSolve1() - One conflict, other move up [" + // << candidates[icandidate].getBegin() << "]" << endl; + // if ( (success = other->moveUp()) ) break; + // } + if ( other->isGlobal() ) { ltrace(200) << "conflictSolve1() - One conflict, other move up [" << candidates[icandidate].getBegin() << "]" << endl; - if ( (success = other->moveUp()) ) break; + if ( (success = Manipulator(other,*this).moveUp()) ) break; } ltrace(200) << "conflictSolve1() - One conflict, relaxing self" << endl; @@ -1595,43 +1592,7 @@ namespace { if ( (not segment) or (not data) ) { ltraceout(200); DebugSession::close(); return false; } if ( segment == _event->getSegment() ) _event->resetInsertState(); - if ( not (data->isBorder() or data->isRing()) ) { - data->resetRipupCount (); - } else { - if ( not Manipulator(segment,*this).canRipup(Manipulator::NoRingLimit) ) { - cerr << "[UNSOLVED] " << segment << " slacken topology not allowed for border/ring." << endl; - ltraceout(200); - DebugSession::close (); - return false; - } - } - - // Ring cases. - if ( data->isBorder() ) { - ltrace(200) << "Segment is Ripup only (border), bypass to Unimplemented." << endl; - if ( not Manipulator(segment,*this).canRipup (Manipulator::NoRingLimit) ) { - ltrace(200) << "Cannot ripup, bypass to Unimplemented." << endl; - data->setState ( DataNegociate::Unimplemented ); - } else { - ltrace(200) << "Refusing to slacken border segment." << endl; - ltraceout(200); - DebugSession::close (); - return false; - } - } - - if ( data->isRing() ) { - ltrace(200) << "Segment is Ripup only (ring), back-propagate to perpandiculars." << endl; - // Do not change the state. - //data->setState ( DataNegociate::Unimplemented ); - success = Manipulator(segment,*this).ripupPerpandiculars(Manipulator::ToRipupLimit - |Manipulator::PerpandicularsFirst - |Manipulator::ToMoveUp); - repush = false; - if ( not success ) { - data->setState ( DataNegociate::Unimplemented ); - } - } + data->resetRipupCount (); // Normal cases. if ( not blocked and not success ) { @@ -1753,7 +1714,8 @@ namespace { success = Manipulator(segment,*this).pivotUp(); if ( not success ) { cerr << "BLOCKAGE MOVE UP " << segment << endl; - success = Manipulator(segment,*this).moveUp(Manipulator::AllowLocalMoveUp); + success = Manipulator(segment,*this).moveUp + (Manipulator::AllowLocalMoveUp|Manipulator::AllowTerminalMoveUp); } if ( not success ) { cerr << "[ERROR] Tighly constrained segment overlapping a blockage." << endl; @@ -1792,28 +1754,30 @@ namespace { case DataNegociate::Slacken: ltrace(200) << "Global, State: Slacken." << endl; if ( (success = Manipulator(segment,*this).slacken()) ) { - nextState = DataNegociate::ConflictSolve1; + nextState = DataNegociate::MoveUp; break; } + case DataNegociate::MoveUp: + ltrace(200) << "Global, State: MoveUp." << endl; + if ( (success = Manipulator(segment,*this).moveUp()) ) { + break; + } + nextState = DataNegociate::ConflictSolve1; + break; case DataNegociate::ConflictSolve1: case DataNegociate::ConflictSolve2: ltrace(200) << "Global, State: ConflictSolve1 or ConflictSolve2." << endl; if ( not (flags & NoRecursive) ) { if ( (success = conflictSolve1 ()) ) { - nextState = DataNegociate::ConflictSolve1; - if ( data->getStateCount() > 3 ) + if ( segment->canMoveUp(0.0) ) nextState = DataNegociate::MoveUp; + else { + if ( data->getStateCount() > 3 ) + nextState = DataNegociate::MaximumSlack; + } break; } } - case DataNegociate::MoveUp: - ltrace(200) << "Global, State: MoveUp." << endl; - if ( (success = Manipulator(segment,*this).moveUp()) ) { - nextState = DataNegociate::ConflictSolve1; - break; - } - nextState = DataNegociate::MaximumSlack; - break; case DataNegociate::MaximumSlack: case DataNegociate::Unimplemented: ltrace(200) << "Global, State: MaximumSlack or Unimplemented." << endl; @@ -1828,13 +1792,15 @@ namespace { } } - if ( not (flags&NoTransition) ) data->setState ( nextState ); + if ( not (flags&NoTransition) ) { + ltrace(200) << "Incrementing state (before): " << nextState << " count:" << data->getStateCount() << endl; + data->setState ( nextState ); + ltrace(200) << "Incrementing state (after): " << nextState << " count:" << data->getStateCount() << endl; + } if ( success ) { if ( repush ) { - if ( not (data->isRing() or data->isBorder()) ) - actionFlags |= SegmentAction::ResetRipup; - + actionFlags |= SegmentAction::ResetRipup; addAction ( segment, actionFlags ); } } else { @@ -1891,14 +1857,8 @@ namespace { unsigned int limit = Session::getKiteEngine()->getRipupLimit(_segment); unsigned int count = _data->getRipupCount() + ((flags & HasNextRipup) ? 1 : 0); - if ( not ( flags & NoRingLimit ) - and (_data->isRing() or _data->isBorder()) - and not (count < limit) ) - return false; - return (count < limit); } - return false; } @@ -1938,20 +1898,12 @@ namespace { bool Manipulator::ripup ( Interval overlap , unsigned int type, DbU::Unit axisHint, unsigned int toState ) { ltrace(200) << "Manipulator::ripup(Interval) " << overlap << endl; - ltrace(200) << "TrackElement:" << _data->getGCellOrder() - << " < Session:" << Session::getOrder() << endl; if ( not canRipup() ) return false; if ( _segment->isFixed() ) return false; if ( _data == NULL ) return true; - if ( _segment->getTrack() ) { - if ( _data->getGCellOrder() < Session::getOrder() ) { - return relax(overlap); - } - } - _S.addAction ( _segment, type, axisHint, toState ); return true; } @@ -2000,20 +1952,18 @@ namespace { // Try to ripup the perpandicular itself. DataNegociate* data2 = perpandiculars[i]->getDataNegociate(); - if ( data2->getGCellOrder() == Session::getOrder() ) { - ltrace(200) << "| " << perpandiculars[i] << endl; + ltrace(200) << "| " << perpandiculars[i] << endl; - if ( (flags & Manipulator::ToMoveUp) - and (data2->getState() < DataNegociate::MoveUp) ) - data2->setState ( DataNegociate::MoveUp ); + if ( (flags & Manipulator::ToMoveUp) and (data2->getState() < DataNegociate::MoveUp) ) + data2->setState ( DataNegociate::MoveUp ); - if ( Manipulator(perpandiculars[i],_S).ripup(_event->getSegment()->getAxis() - ,perpandicularActionFlags) ) - if ( dislodgeCaged ) { - // Ugly: hard-coded uses of pitch. - _event->setAxisHint ( _event->getSegment()->getAxis() + DbU::lambda(5.0) ); - } - continue; + if ( Manipulator(perpandiculars[i],_S).ripup(_event->getSegment()->getAxis() + ,perpandicularActionFlags) ) { + if ( dislodgeCaged ) { + // Ugly: hard-coded uses of pitch. + _event->setAxisHint ( _event->getSegment()->getAxis() + DbU::lambda(5.0) ); + } + continue; } // Cannot ripup the perpandicular, try to ripup it's neigbors. @@ -2028,21 +1978,13 @@ namespace { Interval otherCanonical ( other->getCanonicalInterval() ); if ( not otherCanonical.intersect(constraints) ) continue; - if ( other->getDataNegociate() - and (other->getDataNegociate()->getGCellOrder() < Session::getOrder()) ) { - if ( otherCanonical.getVMin() < constraints.getVMin() ) - constraints.shrinkVMin ( otherCanonical.getVMax() ); - else - constraints.shrinkVMax ( otherCanonical.getVMin() ); - continue; - } // Try to ripup conflicting neighbor. if ( Manipulator(other,_S).canRipup() ) { ltrace(200) << " | Ripup: " << begin << " " << other << endl; _S.addAction ( other, SegmentAction::OtherRipup ); } else { - ltrace(200) << "Aborted ripup of perpandiculars, blocked by border/ring." << endl; + ltrace(200) << "Aborted ripup of perpandiculars, fixed or blocked." << endl; return false; } } @@ -2087,7 +2029,6 @@ namespace { if ( _segment->isFixed() ) return false; if ( not interval.intersect(_segment->getCanonicalInterval()) ) return false; if ( not _data ) return false; - //if ( _data->isBorder() or _data->isRing() ) return false; if ( _segment->isTerminal() and (_segment->getLayer() == Session::getRoutingGauge()->getRoutingLayer(1)) ) { @@ -2095,314 +2036,275 @@ namespace { if ( interval.contains(_segment->base()->getAutoTarget()->getX()) ) return false; } - bool success = true; - unsigned int currentOrder = Session::getOrder (); - ltracein(200); - ltrace(200) << "Current o:" << currentOrder << " vs. Segment o:" << _data->getGCellOrder() << endl; + bool success = true; - //bool expand = (_data->getGCellOrder() < currentOrder); bool expand = _segment->isGlobal() and (flags&AllowExpand); ltrace(200) << "Expand:" << expand << endl; - // Temp: <= replace < equal order can be relaxeds. - if ( _data->getGCellOrder() <= currentOrder ) { - vector gcells; - _segment->getGCells ( gcells ); - if ( gcells.size() < 2 ) { - cerr << Bug("relax() Cannot break %p:%s,\n" - " only in %s (current order %d)." - ,_segment->base()->base() - ,getString(_segment).c_str() - ,getString(gcells[0]).c_str() - ,currentOrder - ) << endl; + Katabatic::GCellVector gcells; + _segment->getGCells ( gcells ); + + if ( gcells.size() < 2 ) { + cerr << Bug("relax() Cannot break %p:%s,\n only in %s." + ,_segment->base()->base() + ,getString(_segment).c_str() + ,getString(gcells[0]).c_str() + ) << endl; + ltraceout(200); + return false; + } + + unsigned int depth = Session::getRoutingGauge()->getLayerDepth(_segment->getLayer()); + Interval uside; + size_t dogLegCount = 0; + size_t iminconflict = gcells.size(); + size_t imaxconflict = gcells.size(); + size_t igcell; + + // Look for closest enclosing min & max GCells indexes. + for ( igcell=0 ; igcellgetUSide(_segment->getDirection()/*,true*/); + ltrace(200) << "| " << gcells[igcell] << " uside: " << uside << endl; + + if ( uside.contains(interval.getVMin()) ) { + iminconflict = igcell; + ltrace(200) << "> Min conflict: " << iminconflict << endl; + } + if ( uside.contains(interval.getVMax()) ) { + imaxconflict = igcell; + ltrace(200) << "> Max conflict: " << imaxconflict << endl; + } + } + + // Expand min & max to enclose GCells of greatest or equal order + // (i.e. less saturateds) + bool minExpanded = false; + bool maxExpanded = false; + if ( expand ) { + if ( iminconflict < gcells.size() ) { + size_t imindensity = 0; + + for ( size_t iexpand=1 ; iexpand < iminconflict ; iexpand++ ) { + if ( not _segment->canDogLegAt(gcells[iexpand],true) ) continue; + + ltrace(200) << "Density " << Session::getRoutingGauge()->getRoutingLayer(depth)->getName() + << " " << gcells[iexpand]->getDensity(depth) << endl; + + if ( gcells[imindensity]->getDensity(depth) > gcells[iexpand]->getDensity(depth) ) + imindensity = iexpand; + } + + if ( iminconflict != imindensity ) minExpanded = true; + iminconflict = (imindensity>0) ? imindensity : gcells.size(); + } + + if ( imaxconflict < gcells.size() ) { + size_t imindensity = imaxconflict; + for ( size_t iexpand=imaxconflict+1; iexpand < gcells.size() ; iexpand++ ) { + if ( not _segment->canDogLegAt(gcells[iexpand],true) ) continue; + + ltrace(200) << "Density " << Session::getRoutingGauge()->getRoutingLayer(depth)->getName() + << " " << gcells[iexpand]->getDensity(depth) << endl; + + if ( gcells[imindensity]->getDensity(depth) > gcells[iexpand]->getDensity(depth) ) + imindensity = iexpand; + } + + if ( imindensity != imaxconflict ) maxExpanded = true; + imaxconflict = (imindensity < gcells.size()) ? imindensity : gcells.size(); + } + } + ltrace(200) << "minExpanded:" << minExpanded << " (" << iminconflict + << ") maxExpanded:" << maxExpanded << " (" << imaxconflict << ")" << endl; + + // Check for full enclosure. + if ( ( (iminconflict == gcells.size()) and (imaxconflict == gcells.size() ) ) + or ( (iminconflict == 0) and (imaxconflict == gcells.size()-1) )) { + cinfo << "[INFO] Manipulator::relax(): Segment fully enclosed in interval." << endl; + ltraceout(200); + return false; + } + + // Suppress min/max if it's the first/last. + if ( (iminconflict < gcells.size()) and (imaxconflict == gcells.size()-1) ) imaxconflict = gcells.size(); + if ( (imaxconflict < gcells.size()) and (iminconflict == 0) ) iminconflict = gcells.size(); + + // Compute number of doglegs and nature of the *first* dogleg. + // (first can be min or max, second can only be max) + bool firstDogLegIsMin = false; + if ( iminconflict < gcells.size() ) { dogLegCount++; firstDogLegIsMin = true; } + if ( imaxconflict < gcells.size() ) dogLegCount++; + + switch ( dogLegCount ) { + case 2: + // Compact only if the double dogleg is at beginning or end. + if ( iminconflict == imaxconflict ) { + if ( iminconflict == 0 ) { + // First dogleg is max. + dogLegCount--; + } else if ( iminconflict == gcells.size()-1 ) { + dogLegCount--; + firstDogLegIsMin = true; + } + } + break; + case 1: break; + case 0: + cerr << Bug("Manipulator::relax() Can't find a GCell suitable for making dogleg." + ,getString(interval).c_str()) << endl; + ltraceout(200); + return false; + } + + ltrace(200) << "| Has to do " << dogLegCount << " doglegs." << endl; + + // Check of "min is less than one track close the edge" (while not expanded). + // AND we are on the first GCell AND there's one dogleg only. + if ( not minExpanded and (iminconflict == 0) and (imaxconflict == gcells.size()) ) { + ltrace(200) << "Cannot break in first GCell only." << endl; + ltraceout(200); + return false; + } + + // Check of "min is less than one track close the edge" (while not expanded). + if ( /*not minExpanded and*/ (iminconflict > 0) and (iminconflict < gcells.size()) ) { + uside = gcells[iminconflict-1]->getUSide(_segment->getDirection()/*,true*/); + ltrace(200) << "GCell Edge Comparison (min): " << uside + << " vs. " << DbU::getValueString(interval.getVMin()) << endl; + // Ugly: One lambda shrink. + if ( interval.getVMin()-DbU::lambda(1.0) <= uside.getVMax() ) { + ltrace(200) << "Using previous GCell." << endl; + iminconflict--; + } + } + + // Check if there is only one dogleg AND it's the last one. + if ( not maxExpanded and (iminconflict == gcells.size()) and (imaxconflict == gcells.size()-1) ) { + ltrace(200) << "Cannot break in last GCell only." << endl; + ltraceout(200); + return false; + } + + // Check of "max is less than one track close the edge" (while not expanded). + if ( /*not maxExpanded and*/ (imaxconflict < gcells.size()-1) ) { + uside = gcells[imaxconflict+1]->getUSide(_segment->getDirection()/*,true*/); + ltrace(200) << "GCell Edge Comparison (max): " << uside + << " vs. " << DbU::getValueString(interval.getVMax()) << endl; + // Ugly: Direct uses of routing pitch. + if ( interval.getVMax()+DbU::lambda(5.0) >= uside.getVMin() ) { + ltrace(200) << "Using next GCell." << endl; + imaxconflict++; + } + } + + size_t ifirstDogleg = gcells.size(); + size_t isecondDogleg = gcells.size(); + if ( not firstDogLegIsMin ) { + ifirstDogleg = imaxconflict; + } else { + ifirstDogleg = iminconflict; + isecondDogleg = imaxconflict; + } + + // Making first dogleg. + ltrace(200) << "Making FIRST dogleg at " << ifirstDogleg << endl; + TrackElement* segment1 = NULL; + TrackElement* segment2 = NULL; + Track* track = _segment->getTrack(); + Katabatic::GCell* dogLegGCell = gcells[ifirstDogleg]; + TrackElement* dogleg = NULL; + DbU::Unit doglegAxis; + bool doglegReuse1 = false; + bool doglegReuse2 = false; + + // Try to reuse existing dogleg if broken at either end. + if ( ifirstDogleg == 0 ) dogleg = _segment->getSourceDogLeg(); + if ( ifirstDogleg == gcells.size()-1 ) dogleg = _segment->getTargetDogLeg(); + if ( dogleg ) { + ltrace(200) << "Reusing dogleg." << endl; + doglegReuse1 = true; + segment1 = _segment; + } else { + // Try to create a new dogleg. + if ( not _segment->canDogLegAt(dogLegGCell) ) { + ltrace(200) << "Cannot create FIRST dogleg." << endl; ltraceout(200); return false; } + dogleg = _segment->makeDogLeg ( dogLegGCell ); + segment1 = Session::lookup ( Session::getDogLegs()[2] ); + } - unsigned int depth = Session::getRoutingGauge()->getLayerDepth(_segment->getLayer()); - Interval uside; - size_t dogLegCount = 0; - size_t iminconflict = gcells.size(); - size_t imaxconflict = gcells.size(); - size_t igcell; - - // Look for closest enclosing min & max GCells indexes. - for ( igcell=0 ; igcellgetUSide(_segment->getDirection(),true); - ltrace(200) << "| " << gcells[igcell] << " uside: " << uside << endl; - - if ( uside.contains(interval.getVMin()) ) { - iminconflict = igcell; - ltrace(200) << "> Min conflict: " << iminconflict << endl; - } - if ( uside.contains(interval.getVMax()) ) { - imaxconflict = igcell; - ltrace(200) << "> Max conflict: " << imaxconflict << endl; - } - } - - // Expand min & max to enclose GCells of greatest or equal order - // (i.e. less saturateds) - bool minExpanded = false; - bool maxExpanded = false; - if ( expand ) { - size_t iexpand = iminconflict; - if ( iminconflict < gcells.size() ) { - for ( igcell=iminconflict ; true ; igcell-- ) { - if ( gcells[igcell]->getOrder() >= currentOrder ) iexpand = igcell; - else break; - - if ( igcell == 0 ) break; - } - - if ( iexpand > 0 ) { - size_t imindepth = iexpand; - for ( ; iexpand < iminconflict ; iexpand++ ) { - if ( not _segment->canDogLegAt(gcells[iexpand],true) ) continue; - - ltrace(200) << "Density " << Session::getRoutingGauge()->getRoutingLayer(depth)->getName() - << " " << gcells[iexpand]->getDensity(depth) << endl; - - if ( gcells[imindepth]->getDensity(depth) > gcells[iexpand]->getDensity(depth) ) - imindepth = iexpand; - } - iexpand = imindepth; - } - if ( iminconflict != iexpand ) minExpanded = true; - iminconflict = (iexpand>0) ? iexpand : gcells.size(); - } - - iexpand = imaxconflict; - for ( igcell=imaxconflict ; igcell < gcells.size() ; igcell++ ) { - if ( gcells[igcell]->getOrder() >= currentOrder ) iexpand = igcell; - else break; - } - if ( iexpand < gcells.size()-1 ) { - size_t imindepth = iexpand; - for ( ; iexpand > imaxconflict ; iexpand-- ) { - if ( not _segment->canDogLegAt(gcells[iexpand],true) ) continue; - - ltrace(200) << "Density " << Session::getRoutingGauge()->getRoutingLayer(depth)->getName() - << " " << gcells[iexpand]->getDensity(depth) << endl; - - if ( gcells[imindepth]->getDensity(depth) > gcells[iexpand]->getDensity(depth) ) - imindepth = iexpand; - } - iexpand = imindepth; - } - if ( imaxconflict != iexpand ) maxExpanded = true; - imaxconflict = (iexpand < gcells.size()) ? iexpand : gcells.size(); - } - ltrace(200) << "minExpanded:" << minExpanded << " (" << iminconflict - << ") maxExpanded:" << maxExpanded << " (" << imaxconflict << ")" << endl; - - // Check for full enclosure. - if ( ( (iminconflict == gcells.size()) and (imaxconflict == gcells.size() ) ) - or ( (iminconflict == 0) and (imaxconflict == gcells.size()-1) )) { - cinfo << "[INFO] Manipulator::relax(): Segment fully enclosed in interval." << endl; - ltraceout(200); - return false; - } - - // Check order validity under the relaxed interval. - // Should be implicitely satisfied. - - // Suppress min/max if it's the first/last. - if ( (iminconflict < gcells.size()) and (imaxconflict == gcells.size()-1) ) imaxconflict = gcells.size(); - if ( (imaxconflict < gcells.size()) and (iminconflict == 0) ) iminconflict = gcells.size(); - - // Compute number of doglegs and nature of the *first* dogleg. - // (first can be min or max, second can only be max) - bool firstDogLegIsMin = false; - if ( iminconflict < gcells.size() ) { dogLegCount++; firstDogLegIsMin = true; } - if ( imaxconflict < gcells.size() ) dogLegCount++; - - switch ( dogLegCount ) { - case 2: - // Compact only if the double dogleg is at beginning or end. - if ( iminconflict == imaxconflict ) { - if ( iminconflict == 0 ) { - // First dogleg is max. - dogLegCount--; - } else if ( iminconflict == gcells.size()-1 ) { - dogLegCount--; - firstDogLegIsMin = true; - } - } - break; - case 1: break; - case 0: - cerr << Bug("Manipulator::relax() Can't find a GCell suitable for making dogleg.\n" - " Cannot move either left or right of %s. Current order %d." - ,getString(interval).c_str() - ,currentOrder - ) << endl; - ltraceout(200); - return false; - } - - ltrace(200) << "| Has to do " << dogLegCount << " doglegs." << endl; - - // Check for conflict occuring outside the current RoutingSet. - // Ugly: 2 track pitch. -#ifdef DISABLE_NARROW_DOGLEG - if ( (iminconflict != gcells.size()) - and ( (gcells[iminconflict]->getOrder() > currentOrder) - or (_data->getGCellOrder() < currentOrder) ) ) { - uside = gcells[iminconflict]->getUSide(_segment->getDirection(),true); - if ( interval.getVMin() - uside.getVMin() < DbU::lambda(10.0) ) { - ltrace(200) << "Min conflict dogleg space is too narrow (<2 tracks)." << endl; - ltraceout(200); - return false; - } else { - ltrace(200) << "Min conflict has sufficent slack min:" - << DbU::getValueString(interval.getVMin()) << " uside:" - << DbU::getValueString(uside.getVMin()) - << endl; - } - } -#endif - -#ifdef DISABLE_NARROW_DOGLEG - if ( (imaxconflict != gcells.size()) - and ( (gcells[imaxconflict]->getOrder() > currentOrder) - or (_data->getGCellOrder() < currentOrder) ) ) { - uside = gcells[imaxconflict]->getUSide(_segment->getDirection(),true); - if ( uside.getVMax() - interval.getVMax() < DbU::lambda(10.0) ) { - ltrace(200) << "Max conflict dogleg space is too narrow (<2 tracks)." << endl; - ltraceout(200); - return false; - } else { - ltrace(200) << "Max conflict has sufficent slack max:" - << DbU::getValueString(interval.getVMax()) << " uside:" - << DbU::getValueString(uside.getVMax()) - << endl; - } - } -#endif - - // Check of "min is less than one track close the edge" (while not expanded). - // AND we are on the first GCell AND there's one dogleg only. - if ( not minExpanded and (iminconflict == 0) and (imaxconflict == gcells.size()) ) { - ltrace(200) << "Cannot break in first GCell only." << endl; - ltraceout(200); - return false; - } - - // Check of "min is less than one track close the edge" (while not expanded). - if ( /*not minExpanded and*/ (iminconflict > 0) and (iminconflict < gcells.size()) ) { - uside = gcells[iminconflict-1]->getUSide(_segment->getDirection(),true); - ltrace(200) << "GCell Edge Comparison (min): " << uside - << " vs. " << DbU::getValueString(interval.getVMin()) << endl; - // Ugly: One lambda shrink. - if ( interval.getVMin()-DbU::lambda(1.0) <= uside.getVMax() ) { - if ( gcells[iminconflict-1]->getOrder() >= currentOrder ) { - ltrace(200) << "Using previous GCell." << endl; - iminconflict--; - } else { - ltrace(200) << "Cannot break in previous GCell." << endl; - ltraceout(200); - return false; - } - } - } - - // Check if there is only one dogleg AND it's the last one. - if ( not maxExpanded and (iminconflict == gcells.size()) and (imaxconflict == gcells.size()-1) ) { - ltrace(200) << "Cannot break in last GCell only." << endl; - ltraceout(200); - return false; - } - - // Check of "max is less than one track close the edge" (while not expanded). - // AND we are on the last GCell AND there's one dogleg only. - // if ( not maxExpanded and (iminconflict == gcells.size()) and (imaxconflict == gcells.size()-1) ) { - // uside = gcells[imaxconflict]->getUSide(_segment->getDirection(),true); - // ltrace(200) << "GCell Edge Comparison (max): " << uside - // << " vs. " << DbU::getValueString(interval.getVMax()) << endl; - // // Ugly: Direct uses of routing pitch. - // if ( interval.getVMax()+DbU::lambda(10.0) >= uside.getVMax() ) { - // ltrace(200) << "Cannot break in last GCell only, less than 2 pitches." << endl; - // ltraceout(200); - // return false; - // } - // } - - // Check of "max is less than one track close the edge" (while not expanded). - if ( /*not maxExpanded and*/ (imaxconflict < gcells.size()-1) ) { - uside = gcells[imaxconflict+1]->getUSide(_segment->getDirection(),true); - ltrace(200) << "GCell Edge Comparison (max): " << uside - << " vs. " << DbU::getValueString(interval.getVMax()) << endl; - // Ugly: Direct uses of routing pitch. - if ( interval.getVMax()+DbU::lambda(5.0) >= uside.getVMin() ) { - if ( gcells[imaxconflict+1]->getOrder() >= currentOrder ) { - ltrace(200) << "Using next GCell." << endl; - imaxconflict++; - } else { - ltrace(200) << "Cannot break in next GCell." << endl; - ltraceout(200); - return false; - } - } - } - - size_t ifirstDogleg = gcells.size(); - size_t isecondDogleg = gcells.size(); - if ( not firstDogLegIsMin ) { - ifirstDogleg = imaxconflict; + if ( firstDogLegIsMin ) { + if ( minExpanded ) { + //doglegAxis = dogLegGCell->getUSide(_segment->getDirection(),false).getVMax() - DbU::lambda(1.0); + doglegAxis = dogLegGCell->getUSide(_segment->getDirection()/*,false*/).getCenter(); } else { - ifirstDogleg = iminconflict; - isecondDogleg = imaxconflict; + // Ugly: hardcoded pitch. + doglegAxis = interval.getVMin() - DbU::lambda(5.0); + } + } else { + if ( maxExpanded ) { + doglegAxis = dogLegGCell->getUSide(_segment->getDirection()/*,false*/).getVMin(); + } else { + // Ugly: hardcoded pitch (5.0 - 1.0). + doglegAxis = interval.getVMax() + DbU::lambda(4.0); + } + } + if ( doglegReuse1 ) _S.addAction ( dogleg, SegmentAction::OtherRipup ); + else dogleg->setAxis ( doglegAxis ); + + // If event is present, the dogleg is in the current RoutingSet. + RoutingEvent* event = dogleg->getDataNegociate()->getRoutingEvent(); + if ( event ) { + ltrace(200) << "Set Axis Hint: @" << DbU::getValueString(doglegAxis) << " " << dogleg << endl; + event->setAxisHint ( doglegAxis ); + } else { + ltrace(200) << "Dogleg has no RoutingEvent yet." << endl; + } + + // if ( (dogLegCount == 2) and not _segment->getTrack() ) { + // Session::addInsertEvent ( _segment, track ); + // } + + // Making second dogleg. + if ( dogLegCount > 1 ) { + ltrace(200) << "Making SECOND dogleg at " << isecondDogleg + << " on " << segment1 << endl; + + dogleg = NULL; + dogLegGCell = gcells[isecondDogleg]; + + if ( ifirstDogleg == isecondDogleg ) { + ltrace(200) << "Double break in same GCell." << endl; + segment1->setSourceDogLeg(false); } - // Making first dogleg. - ltrace(200) << "Making FIRST dogleg at " << ifirstDogleg << endl; - TrackElement* segment1 = NULL; - TrackElement* segment2 = NULL; - Track* track = _segment->getTrack(); - GCell* dogLegGCell = gcells[ifirstDogleg]; - TrackElement* dogleg = NULL; - DbU::Unit doglegAxis; - bool doglegReuse1 = false; - bool doglegReuse2 = false; - - // Try to reuse existing dogleg if broken at either end. - if ( ifirstDogleg == 0 ) dogleg = _segment->getSourceDogLeg(); - if ( ifirstDogleg == gcells.size()-1 ) dogleg = _segment->getTargetDogLeg(); + if ( isecondDogleg == gcells.size()-1 ) dogleg = segment1->getTargetDogLeg(); if ( dogleg ) { ltrace(200) << "Reusing dogleg." << endl; - doglegReuse1 = true; - segment1 = _segment; + doglegReuse2 = true; + segment2 = segment1; } else { // Try to create a new dogleg. - if ( not _segment->canDogLegAt(dogLegGCell) ) { - ltrace(200) << "Cannot create FIRST dogleg." << endl; + if ( not segment1->canDogLegAt(dogLegGCell) ) { + ltrace(200) << "Cannot create SECOND dogleg." << endl; ltraceout(200); return false; } - dogleg = _segment->makeDogLeg ( dogLegGCell ); - segment1 = Session::lookup ( Session::getDogLegs()[2] ); + dogleg = segment1->makeDogLeg ( dogLegGCell ); + segment2 = Session::lookup ( Session::getDogLegs()[2] ); } - - if ( firstDogLegIsMin ) { - if ( minExpanded ) { - //doglegAxis = dogLegGCell->getUSide(_segment->getDirection(),false).getVMax() - DbU::lambda(1.0); - doglegAxis = dogLegGCell->getUSide(_segment->getDirection(),false).getCenter(); - } else { - // Ugly: hardcoded pitch. - doglegAxis = interval.getVMin() - DbU::lambda(5.0); - } + + if ( maxExpanded ) { + //doglegAxis = dogLegGCell->getUSide(segment1->getDirection(),false).getVMin(); + doglegAxis = dogLegGCell->getUSide(segment1->getDirection()/*,false*/).getCenter(); } else { - if ( maxExpanded ) { - doglegAxis = dogLegGCell->getUSide(_segment->getDirection(),false).getVMin(); - } else { - // Ugly: hardcoded pitch (5.0 - 1.0). - doglegAxis = interval.getVMax() + DbU::lambda(4.0); - } + // Ugly: hardcoded pitch. + doglegAxis = interval.getVMax() + DbU::lambda(5.0); } - if ( doglegReuse1 ) _S.addAction ( dogleg, SegmentAction::OtherRipup ); + if ( doglegReuse2 ) _S.addAction ( dogleg, SegmentAction::OtherRipup ); else dogleg->setAxis ( doglegAxis ); // If event is present, the dogleg is in the current RoutingSet. @@ -2414,96 +2316,32 @@ namespace { ltrace(200) << "Dogleg has no RoutingEvent yet." << endl; } - if ( (dogLegCount == 2) - and not _segment->getTrack() - and (_segment->getGCell()->getOrder() < Session::getOrder()) ) { - Session::addInsertEvent ( _segment, track ); - } - - // Making second dogleg. - if ( dogLegCount > 1 ) { - ltrace(200) << "Making SECOND dogleg at " << isecondDogleg - << " on " << segment1 << endl; - - dogleg = NULL; - dogLegGCell = gcells[isecondDogleg]; - - if ( ifirstDogleg == isecondDogleg ) { - ltrace(200) << "Double break in same GCell." << endl; - segment1->setSourceDogLeg(false); - } - - if ( isecondDogleg == gcells.size()-1 ) dogleg = segment1->getTargetDogLeg(); - if ( dogleg ) { - ltrace(200) << "Reusing dogleg." << endl; - doglegReuse2 = true; - segment2 = segment1; - } else { - // Try to create a new dogleg. - if ( not segment1->canDogLegAt(dogLegGCell) ) { - ltrace(200) << "Cannot create SECOND dogleg." << endl; - ltraceout(200); - return false; - } - dogleg = segment1->makeDogLeg ( dogLegGCell ); - segment2 = Session::lookup ( Session::getDogLegs()[2] ); - } - - if ( maxExpanded ) { - //doglegAxis = dogLegGCell->getUSide(segment1->getDirection(),false).getVMin(); - doglegAxis = dogLegGCell->getUSide(segment1->getDirection(),false).getCenter(); - } else { - // Ugly: hardcoded pitch. - doglegAxis = interval.getVMax() + DbU::lambda(5.0); - } - if ( doglegReuse2 ) _S.addAction ( dogleg, SegmentAction::OtherRipup ); - else dogleg->setAxis ( doglegAxis ); - - // If event is present, the dogleg is in the current RoutingSet. - RoutingEvent* event = dogleg->getDataNegociate()->getRoutingEvent(); - if ( event ) { - ltrace(200) << "Set Axis Hint: @" << DbU::getValueString(doglegAxis) << " " << dogleg << endl; - event->setAxisHint ( doglegAxis ); - } else { - ltrace(200) << "Dogleg has no RoutingEvent yet." << endl; - } - - const vector& doglegs = Session::getDogLegs(); - for ( size_t i=0 ; igetGCell()->getOrder() < Session::getOrder() ) and not segment->getTrack() ) { - Session::addInsertEvent ( segment, track ); - } + const vector& doglegs = Session::getDogLegs(); + for ( size_t i=0 ; igetTrack() and track ) { + Session::addInsertEvent ( segment, track ); } } + } - switch ( dogLegCount ) { - case 1: - if ( not doglegReuse1 ) { - if ( firstDogLegIsMin ) - _segment->getDataNegociate()->setState ( DataNegociate::RipupPerpandiculars, true ); - else - segment1->getDataNegociate()->setState ( DataNegociate::RipupPerpandiculars, true ); - } - if ( (flags & NoDoglegReuse) and (doglegReuse1 or doglegReuse2 ) ) - success = false; - break; - case 2: - if ( not doglegReuse1 ) + switch ( dogLegCount ) { + case 1: + if ( not doglegReuse1 ) { + if ( firstDogLegIsMin ) _segment->getDataNegociate()->setState ( DataNegociate::RipupPerpandiculars, true ); - if ( not doglegReuse2 ) - segment2->getDataNegociate()->setState ( DataNegociate::RipupPerpandiculars, true ); - break; - } - - } else if ( _data->getGCellOrder() > currentOrder ) { - cerr << Bug("relax() Routing order problem for %s." - ,getString(_segment).c_str()) << endl; - success = false; - } else { - // The TrackElement has an order equal to the Session, it's in the - // RoutingSet. - if ( not Manipulator(_segment,_S).makeDogLeg(interval) ) success = false; + else + segment1->getDataNegociate()->setState ( DataNegociate::RipupPerpandiculars, true ); + } + if ( (flags & NoDoglegReuse) and (doglegReuse1 or doglegReuse2 ) ) + success = false; + break; + case 2: + if ( not doglegReuse1 ) + _segment->getDataNegociate()->setState ( DataNegociate::RipupPerpandiculars, true ); + if ( not doglegReuse2 ) + segment2->getDataNegociate()->setState ( DataNegociate::RipupPerpandiculars, true ); + break; } ltraceout(200); @@ -2551,116 +2389,111 @@ namespace { continue; } - if ( data2->getGCellOrder() < Session::getOrder() ) { - // Interval relax. - success = Manipulator(segment2,_S).relax ( toFree ); - } else { - if ( data2->getState() == DataNegociate::MaximumSlack ) { - ltrace(200) << "At " << DataNegociate::getStateString(data2) - << " for " << segment2 << endl; - success = false; + if ( data2->getState() == DataNegociate::MaximumSlack ) { + ltrace(200) << "At " << DataNegociate::getStateString(data2) + << " for " << segment2 << endl; + success = false; + continue; + } + + bool shrinkLeft = false; + bool shrinkRight = false; + + if ( data2->getCost().getRightMinExtend() < toFree.getVMin() ) { + ltrace(200) << "- Shrink right edge (push left) " << segment2 << endl; + shrinkRight = true; + TrackElement* rightNeighbor2 = track->getSegment(i+1); + if ( rightNeighbor2 && (rightNeighbor2->getNet() == segment2->getNet()) ) { + Interval interval1 = segment2->getCanonicalInterval(); + Interval interval2 = rightNeighbor2->getCanonicalInterval(); + + if ( interval1.intersect(interval2) && (interval2.getVMax() > interval1.getVMax()) ) + shrinkLeft = true; + } + } + + if ( data2->getCost().getLeftMinExtend() > toFree.getVMax() ) { + ltrace(200) << "- Shrink left edge (push right) " << segment2 << endl; + shrinkLeft = true; + if ( i > 0 ) { + TrackElement* leftNeighbor2 = track->getSegment(i-1); + if ( leftNeighbor2 && (leftNeighbor2->getNet() == segment2->getNet()) ) { + Interval interval1 = segment2->getCanonicalInterval(); + Interval interval2 = leftNeighbor2->getCanonicalInterval(); + + if ( interval1.intersect(interval2) && (interval2.getVMin() < interval1.getVMin()) ) + shrinkRight = true; + } + } + } + + if ( not (shrinkLeft xor shrinkRight) ) { + ltrace(200) << "- Hard overlap/enclosure/shrink " << segment2 << endl; + if ( not (success = Manipulator(segment2,_S).ripup(toFree,SegmentAction::OtherRipup)) ) + continue; + } + + canonicals.clear (); + forEach ( TrackElement*, isegment3 + , segment2->getCollapsedPerpandiculars().getSubSet(TrackElements_UniqCanonical(canonicals)) ) { + DataNegociate* data3 = isegment3->getDataNegociate(); + if ( not data3 ) continue; + + RoutingEvent* event3 = data3->getRoutingEvent(); + if ( not event3 ) continue; + + if ( not toFree.intersect(event3->getConstraints()) ) { + ltrace(200) << " . " << *isegment3 << endl; continue; } - bool shrinkLeft = false; - bool shrinkRight = false; + ltrace(200) << " | " << *isegment3 << endl; - if ( data2->getCost().getRightMinExtend() < toFree.getVMin() ) { - ltrace(200) << "- Shrink right edge (push left) " << segment2 << endl; - shrinkRight = true; - TrackElement* rightNeighbor2 = track->getSegment(i+1); - if ( rightNeighbor2 && (rightNeighbor2->getNet() == segment2->getNet()) ) { - Interval interval1 = segment2->getCanonicalInterval(); - Interval interval2 = rightNeighbor2->getCanonicalInterval(); - - if ( interval1.intersect(interval2) && (interval2.getVMax() > interval1.getVMax()) ) - shrinkLeft = true; - } - } - - if ( data2->getCost().getLeftMinExtend() > toFree.getVMax() ) { - ltrace(200) << "- Shrink left edge (push right) " << segment2 << endl; - shrinkLeft = true; - if ( i > 0 ) { - TrackElement* leftNeighbor2 = track->getSegment(i-1); - if ( leftNeighbor2 && (leftNeighbor2->getNet() == segment2->getNet()) ) { - Interval interval1 = segment2->getCanonicalInterval(); - Interval interval2 = leftNeighbor2->getCanonicalInterval(); - - if ( interval1.intersect(interval2) && (interval2.getVMin() < interval1.getVMin()) ) - shrinkRight = true; - } - } - } - - if ( not (shrinkLeft xor shrinkRight) ) { - ltrace(200) << "- Hard overlap/enclosure/shrink " << segment2 << endl; - if ( not (success = Manipulator(segment2,_S).ripup(toFree,SegmentAction::OtherRipup)) ) - continue; - } - - canonicals.clear (); - forEach ( TrackElement*, isegment3 - , segment2->getCollapsedPerpandiculars().getSubSet(TrackElements_UniqCanonical(canonicals)) ) { - DataNegociate* data3 = isegment3->getDataNegociate(); - if ( not data3 ) continue; - - RoutingEvent* event3 = data3->getRoutingEvent(); - if ( not event3 ) continue; - - if ( not toFree.intersect(event3->getConstraints()) ) { - ltrace(200) << " . " << *isegment3 << endl; - continue; - } - - ltrace(200) << " | " << *isegment3 << endl; - - if ( shrinkRight xor shrinkLeft ) { - if ( shrinkRight ) { - if ( not (success=Manipulator(*isegment3,_S).ripup ( track->getAxis() - , SegmentAction::OtherPushAside - | SegmentAction::AxisHint - , toFree.getVMin() - DbU::lambda(1.0) - )) ) - break; - - if ( event3->getTracksFree() == 1 ) { - ltrace(200) << "Potential left intrication with other perpandicular." << endl; - if ( isegment3->getAxis() == segment2->getTargetU() - Session::getExtensionCap() ) { - leftIntrication = true; - leftAxisHint = isegment3->getAxis(); - } - } - } - if ( shrinkLeft ) { - if ( not (success=Manipulator(*isegment3,_S).ripup ( track->getAxis() - , SegmentAction::OtherPushAside - | SegmentAction::AxisHint - , toFree.getVMax() + DbU::lambda(1.0) - )) ) - break; - if ( event3->getTracksFree() == 1 ) { - ltrace(200) << "Potential right intrication with other perpandicular." << endl; - if ( isegment3->getAxis() == segment2->getSourceU() + Session::getExtensionCap() ) { - rightIntrication = true; - rightAxisHint = isegment3->getAxis(); - } - } - } - } else { - // DbU::Unit axisHint - // = (event3->getAxisHint() - toFree.getVMin() < toFree.getVMax() - event3->getAxisHint()) - // ? (toFree.getVMin() - DbU::lambda(1.0)) : (toFree.getVMax() + DbU::lambda(1.0)); + if ( shrinkRight xor shrinkLeft ) { + if ( shrinkRight ) { if ( not (success=Manipulator(*isegment3,_S).ripup ( track->getAxis() - , SegmentAction::OtherRipup - | SegmentAction::EventLevel3 - //| SegmentAction::AxisHint, axisHint + , SegmentAction::OtherPushAside + | SegmentAction::AxisHint + , toFree.getVMin() - DbU::lambda(1.0) )) ) break; + + if ( event3->getTracksFree() == 1 ) { + ltrace(200) << "Potential left intrication with other perpandicular." << endl; + if ( isegment3->getAxis() == segment2->getTargetU() - Session::getExtensionCap() ) { + leftIntrication = true; + leftAxisHint = isegment3->getAxis(); + } + } } + if ( shrinkLeft ) { + if ( not (success=Manipulator(*isegment3,_S).ripup ( track->getAxis() + , SegmentAction::OtherPushAside + | SegmentAction::AxisHint + , toFree.getVMax() + DbU::lambda(1.0) + )) ) + break; + if ( event3->getTracksFree() == 1 ) { + ltrace(200) << "Potential right intrication with other perpandicular." << endl; + if ( isegment3->getAxis() == segment2->getSourceU() + Session::getExtensionCap() ) { + rightIntrication = true; + rightAxisHint = isegment3->getAxis(); + } + } + } + } else { + // DbU::Unit axisHint + // = (event3->getAxisHint() - toFree.getVMin() < toFree.getVMax() - event3->getAxisHint()) + // ? (toFree.getVMin() - DbU::lambda(1.0)) : (toFree.getVMax() + DbU::lambda(1.0)); + if ( not (success=Manipulator(*isegment3,_S).ripup ( track->getAxis() + , SegmentAction::OtherRipup + | SegmentAction::EventLevel3 + //| SegmentAction::AxisHint, axisHint + )) ) + break; } - if ( not success ) break; } + if ( not success ) break; } if ( success ) { @@ -2714,26 +2547,21 @@ namespace { continue; } - if ( data2->getGCellOrder() < Session::getOrder() ) { - // Interval relax. - success = Manipulator(segment2,_S).relax ( toFree ); - } else { - ltrace(200) << "- Forced ripup " << segment2 << endl; - if ( not (success=Manipulator(segment2,_S).ripup(toFree,SegmentAction::OtherRipup)) ) - continue; + ltrace(200) << "- Forced ripup " << segment2 << endl; + if ( not (success=Manipulator(segment2,_S).ripup(toFree,SegmentAction::OtherRipup)) ) + continue; - canonicals.clear (); - forEach ( TrackElement*, isegment3 - , segment2->getCollapsedPerpandiculars().getSubSet(TrackElements_UniqCanonical(canonicals)) ) { - DataNegociate* data3 = isegment3->getDataNegociate(); - if ( !data3 ) continue; + canonicals.clear (); + forEach ( TrackElement*, isegment3 + , segment2->getCollapsedPerpandiculars().getSubSet(TrackElements_UniqCanonical(canonicals)) ) { + DataNegociate* data3 = isegment3->getDataNegociate(); + if ( !data3 ) continue; - RoutingEvent* event3 = data3->getRoutingEvent(); - if ( !event3 ) continue; + RoutingEvent* event3 = data3->getRoutingEvent(); + if ( !event3 ) continue; - if ( Manipulator(*isegment3,_S).canRipup() ) - _S.addAction ( *isegment3, SegmentAction::OtherRipup ); - } + if ( Manipulator(*isegment3,_S).canRipup() ) + _S.addAction ( *isegment3, SegmentAction::OtherRipup ); } } @@ -2790,8 +2618,7 @@ namespace { _segment->getPerpandicularsBound ( perpandiculars ); for ( iperpand = perpandiculars.begin() ; iperpand != perpandiculars.end() ; iperpand++ ) { DataNegociate* data2 = (*iperpand)->getDataNegociate(); - if ( data2 && (data2->getGCellOrder() >= Session::getOrder()) ) { - + if ( data2 ) { ltrace(200) << "| perpandicular bound:" << *iperpand << endl; success = Manipulator(*iperpand,_S).ripup ( track->getAxis(), SegmentAction::SelfRipupAndAxisHint ); if ( success ) { @@ -2898,8 +2725,7 @@ namespace { if ( not _segment->isLocal() ) return false; Net* net = _segment->getNet(); - Interval uside = _segment->getGCell()->getUSide - ( Constant::perpandicular(_segment->getDirection()), false ); + Interval uside = _segment->base()->getAutoSource()->getGCell()->getUSide ( Constant::perpandicular(_segment->getDirection())/*, false*/ ); RoutingPlane* plane = Session::getKiteEngine()->getRoutingPlaneByLayer(_segment->getLayer()); ltracein(200); @@ -2917,7 +2743,6 @@ namespace { DataNegociate* otherData = other->getDataNegociate(); if ( not otherData ) continue; - if ( otherData->getGCellOrder() < Session::getOrder() ) continue; DbU::Unit shiftedAxisHint; RoutingEvent* otherEvent = otherData->getRoutingEvent(); @@ -2949,6 +2774,7 @@ namespace { ltrace(200) << "Manipulator::pivotUp() " << _segment << endl; if ( _segment->isFixed () ) return false; + if ( _segment->isStrap () ) return false; if ( not _segment->canMoveUp(0.5) ) return false; _segment->moveUp (); @@ -2961,12 +2787,17 @@ namespace { ltrace(200) << "Manipulator::moveUp() " << _segment << endl; unsigned int kflags = Katabatic::AutoSegment::Propagate; - kflags |= (flags & AllowLocalMoveUp) ? Katabatic::AutoSegment::AllowLocal : 0; + kflags |= (flags & AllowLocalMoveUp ) ? Katabatic::AutoSegment::AllowLocal : 0; + kflags |= (flags & AllowTerminalMoveUp) ? Katabatic::AutoSegment::AllowTerminal : 0; if ( _segment->isFixed () ) return false; if ( not (flags & AllowLocalMoveUp) ) { - if ( _segment->isLocal() and not _segment->canPivotUp(0.5) ) return false; - if ( not _segment->canMoveUp(1.0,kflags) ) return false; + if ( _segment->isLocal() ) { + if ( not _segment->canPivotUp(0.5) ) return false; + } else { + if ( _segment->getLength() < DbU::lambda(/*100.0*/50.0) ) return false; + if ( not _segment->canMoveUp(1.0,kflags) ) return false; + } } else if ( not _segment->canMoveUp(1.0,kflags) ) return false; @@ -2985,18 +2816,14 @@ namespace { itrack->getOverlapBounds ( overlap, begin, end ); for ( ; (begin < end) ; begin++ ) { other = itrack->getSegment(begin); - if ( other->isGlobal() ) continue; - if ( other->getDataNegociate() - and (other->getDataNegociate()->getGCellOrder() != Session::getOrder()) ) continue; ltrace(200) << " | Ripup for repack: " << begin << " " << other << endl; _S.addAction ( other, SegmentAction::OtherRipup ); } } #endif - _segment->moveUp ( kflags ); - return true; + return _segment->moveUp ( kflags ); } @@ -3056,10 +2883,10 @@ namespace { ltrace(200) << "Manipulator::makeDogLeg(Interval) - Push dogleg to the " << ((pushLeft)?"left":"right") << endl; if ( isTerminal ) { - AutoContact* contact = (pushLeft) ? _segment->base()->getAutoSource() - : _segment->base()->getAutoTarget(); - DbU::Unit axisHint = (_segment->isHorizontal()) ? contact->getX() : contact->getY(); - RoutingEvent* event = dogleg->getDataNegociate()->getRoutingEvent(); + Katabatic::AutoContact* contact = (pushLeft) ? _segment->base()->getAutoSource() + : _segment->base()->getAutoTarget(); + DbU::Unit axisHint = (_segment->isHorizontal()) ? contact->getX() : contact->getY(); + RoutingEvent* event = dogleg->getDataNegociate()->getRoutingEvent(); if ( event ) { event->setAxisHint ( axisHint ); event->setForcedToHint ( true ); @@ -3080,12 +2907,12 @@ namespace { if ( _segment->isFixed() ) return false; - vector gcells; + Katabatic::GCellVector gcells; _segment->getGCells ( gcells ); size_t igcell = 0; for ( ; igcellgetUSide(_segment->getDirection(),true).contains(position) ) + if ( gcells[igcell]->getUSide(_segment->getDirection()/*,true*/).contains(position) ) break; } if ( igcell == gcells.size() ) return false; @@ -3135,10 +2962,6 @@ namespace { if ( !data2 ) continue; ltrace(200) << " | " << perpandiculars[i] << endl; - if ( data2->getGCellOrder() < Session::getOrder() ) { - ltrace(200) << "Reject: bad order." << endl; - continue; - } RoutingEvent* event2 = data2->getRoutingEvent(); if ( !event2 ) continue; @@ -3241,7 +3064,6 @@ namespace { if ( !data2 ) continue; ltrace(200) << " | " << perpandiculars[i] << endl; - if ( data2->getGCellOrder() < Session::getOrder() ) continue; RoutingEvent* event2 = data2->getRoutingEvent(); if ( !event2 ) continue; @@ -3259,11 +3081,11 @@ namespace { { ltrace(200) << "Manipulator::relax() " << _segment << endl; - if ( /* _segment->base()->isGlobal() - ||*/ _segment->isFixed() - || ( _segment->getDogLegLevel() > 0 ) - || ( _segment->getLength() < DbU::lambda(10.0) ) - || !_segment->canDogLegAt(_segment->getGCell()) ) + if ( /* _segment->base()->isGlobal() + ||*/ _segment->isFixed() + || ( _segment->getDogLegLevel() > 0 ) + || ( _segment->getLength() < DbU::lambda(10.0) ) + || not _segment->canDogLegAt(_segment->base()->getAutoSource()->getGCell()) ) return false; TrackElement* perpandicular @@ -3297,7 +3119,7 @@ namespace { DataNegociate* data = perpandicular->getDataNegociate(); if ( perpandicular->isFixed() ) continue; - if ( not data or (data->getGCellOrder() != Session::getOrder()) ) continue; + if ( not data ) continue; if ( not perpandicular->getTrack() ) continue; if ( not Manipulator(perpandicular,_S).canRipup() or (data->getState() >= DataNegociate::MaximumSlack) ) continue; @@ -3885,13 +3707,11 @@ namespace Kite { } if ( _perpandiculars[i]->getTrack() ) { - Interval trackFree = _perpandiculars[i]->getFreeInterval( false ); + Interval trackFree = _perpandiculars[i]->getFreeInterval(); ltrace(200) << "| From " << _perpandiculars[i] << endl; ltrace(200) << "| Track Perpandicular Free: " << trackFree << endl; _perpandicular.intersection ( trackFree ); - if ( dataPerpandicular->getGCellOrder() < Session::getOrder() ) - _constraints.intersection ( trackFree ); } else { ltrace(200) << "| Not in any track " << _perpandiculars[i] << endl; } diff --git a/kite/src/RoutingEventQueue.cpp b/kite/src/RoutingEventQueue.cpp index 0edbd2e9..bf9a6535 100644 --- a/kite/src/RoutingEventQueue.cpp +++ b/kite/src/RoutingEventQueue.cpp @@ -72,19 +72,17 @@ namespace Kite { void RoutingEventQueue::load ( const vector& segments ) { for ( size_t i=0 ; igetDataNegociate()->getGCellOrder() >= Session::getOrder() ) { - if ( segments[i]->getDataNegociate()->getRoutingEvent() ) { - cinfo << "[INFO] Already have a RoutingEvent - " << segments[i] << endl; - continue; - } - if ( segments[i]->getTrack() ) { - cinfo << "[INFO] Already in Track - " << segments[i] << endl; - continue; - } - RoutingEvent* event = RoutingEvent::create(segments[i]); - event->updateKey (); - _events.insert ( event ); + if ( segments[i]->getDataNegociate()->getRoutingEvent() ) { + cinfo << "[INFO] Already have a RoutingEvent - " << segments[i] << endl; + continue; } + if ( segments[i]->getTrack() ) { + cinfo << "[INFO] Already in Track - " << segments[i] << endl; + continue; + } + RoutingEvent* event = RoutingEvent::create(segments[i]); + event->updateKey (); + _events.insert ( event ); } } diff --git a/kite/src/Session.cpp b/kite/src/Session.cpp index 62bb264f..17e320d3 100644 --- a/kite/src/Session.cpp +++ b/kite/src/Session.cpp @@ -25,10 +25,10 @@ #include "hurricane/Bug.h" #include "hurricane/Error.h" +#include "katabatic/GCellGrid.h" #include "kite/Session.h" #include "kite/Track.h" #include "kite/TrackElement.h" -#include "kite/GCellGrid.h" #include "kite/KiteEngine.h" @@ -65,7 +65,6 @@ namespace Kite { Session::Session ( KiteEngine* kite ) : Katabatic::Session(kite) - , _order (0) , _insertEvents() , _removeEvents() , _sortEvents () @@ -137,7 +136,7 @@ namespace Kite { { return Session::get("lookup(AutoSegment*)")->_getKiteEngine()->_lookup ( segment ); } - GCell* Session::lookup ( Katabatic::GCell* gcell ) + Katabatic::GCell* Session::lookup ( Katabatic::GCell* gcell ) { return Session::get("lookup(Katabatic::GCell*)")->_getKiteEngine()->getGCellGrid()->getGCell(gcell->getIndex()); } @@ -161,18 +160,10 @@ namespace Kite { { return _getKiteEngine()->getRipupCost(); }; - GCell* Session::_getGCellUnder ( DbU::Unit x, DbU::Unit y ) + Katabatic::GCell* Session::_getGCellUnder ( DbU::Unit x, DbU::Unit y ) { return _getKiteEngine()->getGCellGrid()->getGCell(Point(x,y)); }; - unsigned int Session::_getOrder () const - { return _order; } - - - void Session::_setOrder ( unsigned int order ) - { _order = order; } - - size_t Session::_revalidate () { set packTracks; @@ -266,7 +257,7 @@ namespace Kite { if ( not faileds.empty() ) { set::iterator ifailed = faileds.begin(); - vector gcells; + Katabatic::GCellVector gcells; for ( ; ifailed != faileds.end() ; ++ifailed ) { (*ifailed)->getGCells ( gcells ); (*ifailed)->makeDogLeg ( gcells[0] ); @@ -307,7 +298,8 @@ namespace Kite { cerr << "Order: Insert in @" << DbU::getValueString(track->getAxis()) << " " << segment << endl; #endif - ltrace(200) << "addInsertEvent() " << segment << endl; + ltrace(200) << "addInsertEvent() " << segment + << "\n @" << track << endl; if ( segment->getTrack() != NULL ) { cerr << Bug("Session::addInsertEvent(): Segment already in Track." diff --git a/kite/src/Track.cpp b/kite/src/Track.cpp index 5ead30cc..2a040b1e 100644 --- a/kite/src/Track.cpp +++ b/kite/src/Track.cpp @@ -168,14 +168,10 @@ namespace Kite { } - TrackElement* Track::getNext ( size_t& index, Net* net, bool useOrder ) const + TrackElement* Track::getNext ( size_t& index, Net* net ) const { for ( index++ ; index < _segments.size() ; index++ ) { if ( _segments[index]->getNet() == net ) continue; - if ( useOrder - and _segments[index]->getDataNegociate() - and (_segments[index]->getDataNegociate()->getGCellOrder() >= Session::getOrder()) ) - continue; return _segments[index]; } index = NPOS; @@ -184,7 +180,7 @@ namespace Kite { } - TrackElement* Track::getPrevious ( size_t& index, Net* net, bool useOrder ) const + TrackElement* Track::getPrevious ( size_t& index, Net* net ) const { for ( index-- ; index != NPOS ; index-- ) { if ( inltrace(148) ) { @@ -192,10 +188,6 @@ namespace Kite { cerr << _segments[index] << endl; } if ( _segments[index]->getNet() == net ) continue; - if ( useOrder - and _segments[index]->getDataNegociate() - and (_segments[index]->getDataNegociate()->getGCellOrder() >= Session::getOrder()) ) - continue; return _segments[index]; } index = NPOS; @@ -433,23 +425,23 @@ namespace Kite { } - Interval Track::expandFreeInterval ( size_t& begin, size_t& end, unsigned int state, Net* net, bool useOrder ) const + Interval Track::expandFreeInterval ( size_t& begin, size_t& end, unsigned int state, Net* net ) const { DbU::Unit minFree = _min; if ( !(state & MinTrackMin) ) { if ( _segments[begin]->getNet() == net ) - getPrevious ( begin, net, useOrder ); + getPrevious ( begin, net ); if ( begin != NPOS ) { size_t usedEnd; - minFree = expandUsedInterval ( begin, usedEnd, useOrder ).getVMax(); + minFree = expandUsedInterval ( begin, usedEnd ).getVMax(); } } if ( !(state & MaxTrackMax) ) { if ( _segments[end]->getNet() == net ) { - getNext ( end, net, useOrder ); + getNext ( end, net ); if ( end == NPOS ) { end = _segments.size() - 1; @@ -613,7 +605,7 @@ namespace Kite { } - Interval Track::expandUsedInterval ( size_t& begin, size_t& end, bool useOrder ) const + Interval Track::expandUsedInterval ( size_t& begin, size_t& end ) const { if ( begin == NPOS ) return Interval(); @@ -627,10 +619,6 @@ namespace Kite { size_t i = seed; while ( --i != NPOS ) { if ( _segments[i]->getNet() != owner ) break; - if ( useOrder - and _segments[i]->getDataNegociate() - and (_segments[i]->getDataNegociate()->getGCellOrder() >= Session::getOrder()) ) - continue; _segments[i]->getCanonical ( expandInterval ); if ( expandInterval.getVMax() >= ownerInterval.getVMin() ) { @@ -642,10 +630,6 @@ namespace Kite { end = i = seed; while ( ++i < _segments.size() ) { if ( _segments[i]->getNet() != owner ) break; - if ( useOrder - and _segments[i]->getDataNegociate() - and (_segments[i]->getDataNegociate()->getGCellOrder() >= Session::getOrder()) ) - continue; _segments[i]->getCanonical ( expandInterval ); if ( expandInterval.getVMin() > ownerInterval.getVMax() ) break; diff --git a/kite/src/TrackBlockage.cpp b/kite/src/TrackBlockage.cpp deleted file mode 100644 index 1e7ef1dc..00000000 --- a/kite/src/TrackBlockage.cpp +++ /dev/null @@ -1,269 +0,0 @@ - -// -*- C++ -*- -// -// This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved -// -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | -// | C O R I O L I S | -// | K i t e - D e t a i l e d R o u t e r | -// | | -// | Author : Jean-Paul CHAPUT | -// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | -// | =============================================================== | -// | C++ Module : "./TrackBlockage.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x - - - - -#include - -#include "hurricane/Bug.h" -#include "hurricane/Warning.h" -#include "hurricane/Net.h" -#include "hurricane/Name.h" -#include "hurricane/RegularLayer.h" -#include "hurricane/Technology.h" -#include "hurricane/DataBase.h" -#include "hurricane/Horizontal.h" -#include "hurricane/Vertical.h" -#include "katabatic/AutoContact.h" -#include "crlcore/RoutingGauge.h" -#include "kite/GCell.h" -#include "kite/DataNegociate.h" -#include "kite/TrackBlockage.h" -#include "kite/TrackCost.h" -#include "kite/Track.h" -#include "kite/Session.h" -#include "kite/RoutingEvent.h" -#include "kite/NegociateWindow.h" -#include "kite/GCellGrid.h" -#include "kite/KiteEngine.h" - - -namespace Kite { - - - using namespace std; - using Hurricane::inltrace; - using Hurricane::ltracein; - using Hurricane::ltraceout; - using Hurricane::tab; - using Hurricane::ForEachIterator; - using Hurricane::Bug; - using Hurricane::Error; - using Hurricane::Net; - using Hurricane::Name; - using Hurricane::RegularLayer; - using Hurricane::Technology; - using Hurricane::DataBase; - using Hurricane::Horizontal; - using Hurricane::Vertical; - - -// ------------------------------------------------------------------- -// Class : "TrackBlockage". - - - TrackBlockage::TrackBlockage ( Track* track, Box& boundingBox ) - : TrackElement (NULL) - , _segment (NULL) - { - if ( track ) { - Technology* technology = DataBase::getDB()->getTechnology(); - unsigned int depth = track->getDepth(); - const Layer* layer1 = track->getLayer()->getBlockageLayer(); - RegularLayer* layer2 = dynamic_cast(technology->getLayer(layer1->getMask())); - ltrace(190) << "Blockage layer: " << layer2 << endl; - if ( layer2 ) { - DbU::Unit extention = layer2->getExtentionCap(); - if ( track->getDirection() == Constant::Horizontal ) { - Interval uside = track->getKiteEngine()->getGCellGrid()->getUSide ( Constant::Horizontal ); - - _sourceU = max ( boundingBox.getXMin()+extention, uside.getVMin()); - _targetU = min ( boundingBox.getXMax()-extention, uside.getVMax()); - - _segment = Horizontal::create ( Session::getBlockageNet() - , layer2 - , track->getAxis() - , layer2->getMinimalSize() - , _sourceU - , _targetU - ); - - GCell* gcell = track->getKiteEngine()->getGCellGrid()->getGCell ( Point(_sourceU,track->getAxis()) ); - GCell* end = track->getKiteEngine()->getGCellGrid()->getGCell ( Point(_targetU,track->getAxis()) ); - GCell* right = NULL; - Interval guside = gcell->getUSide ( Constant::Horizontal, true ); - Interval segside ( boundingBox.getXMin(), boundingBox.getXMax() ); - - ltrace(190) << "Depth: " << depth << " " << track->getLayer() << endl; - ltrace(190) << "Begin: " << gcell << endl; - ltrace(190) << "End: " << end << endl; - - if ( gcell ) { - while ( gcell and (gcell != end) ) { - right = gcell->getRight(); - if ( right == NULL ) break; - - guside = gcell->getUSide ( Constant::Horizontal, true ); - Interval usedLength = guside.getIntersection ( segside ); - - gcell->addBlockage ( depth, (float)usedLength.getSize()/(float)guside.getSize() ); - gcell = right; - } - if ( end ) { - guside = gcell->getUSide ( Constant::Horizontal, true ); - Interval usedLength = guside.getIntersection ( segside ); - - end->addBlockage ( depth, (float)usedLength.getSize()/(float)guside.getSize() ); - } - } - } else { - Interval uside = track->getKiteEngine()->getGCellGrid()->getUSide ( Constant::Vertical ); - - _sourceU = max ( boundingBox.getYMin()+extention, uside.getVMin()); - _targetU = min ( boundingBox.getYMax()-extention, uside.getVMax()); - - _segment = Vertical::create ( Session::getBlockageNet() - , layer2 - , track->getAxis() - , layer2->getMinimalSize() - , _sourceU - , _targetU - ); - - GCell* gcell = track->getKiteEngine()->getGCellGrid()->getGCell ( Point(track->getAxis(),_sourceU) ); - GCell* end = track->getKiteEngine()->getGCellGrid()->getGCell ( Point(track->getAxis(),_targetU) ); - GCell* up = NULL; - Interval guside = gcell->getUSide ( Constant::Vertical, true ); - Interval segside ( boundingBox.getYMin(), boundingBox.getYMax() ); - - ltrace(190) << "Depth: " << depth << " " << track->getLayer() << endl; - ltrace(190) << "Begin: " << gcell << endl; - ltrace(190) << "End: " << end << endl; - - if ( gcell ) { - while ( gcell and (gcell != end) ) { - up = gcell->getUp(); - if ( up == NULL ) break; - - guside = gcell->getUSide ( Constant::Vertical, true ); - Interval usedLength = guside.getIntersection ( segside ); - - gcell->addBlockage ( depth, (float)usedLength.getSize()/(float)guside.getSize() ); - gcell = up; - } - if ( end ) { - guside = gcell->getUSide ( Constant::Vertical, true ); - Interval usedLength = guside.getIntersection ( segside ); - - end->addBlockage ( depth, (float)usedLength.getSize()/(float)guside.getSize() ); - } - } - } - } - } - } - - - void TrackBlockage::_postCreate () - { TrackElement::_postCreate (); } - - - TrackBlockage::~TrackBlockage () - { } - - - void TrackBlockage::_preDestroy () - { - ltrace(90) << "TrackBlockage::_preDestroy() - " << (void*)this << endl; - TrackElement::_preDestroy (); - } - - - TrackElement* TrackBlockage::create ( Track* track, Box& boundingBox ) - { - TrackBlockage* trackBlockage = NULL; - if ( track ) { - trackBlockage = new TrackBlockage ( track, boundingBox ); - trackBlockage->_postCreate (); - Session::addInsertEvent ( trackBlockage, track ); - - ltrace(190) << "Adding: " << boundingBox << " on " << track << endl; - - ltrace(200) << "TrackBlockage::create(): " << trackBlockage << endl; - } - return trackBlockage; - } - - - AutoSegment* TrackBlockage::base () const { return NULL; } - bool TrackBlockage::isFixed () const { return true; } - bool TrackBlockage::isBlockage () const { return true; } - DbU::Unit TrackBlockage::getAxis () const { return getTrack()->getAxis(); } - bool TrackBlockage::isHorizontal () const { return getTrack()->isHorizontal(); } - bool TrackBlockage::isVertical () const { return getTrack()->isVertical(); } - unsigned int TrackBlockage::getDirection () const { return getTrack()->getDirection(); } - Net* TrackBlockage::getNet () const { return _segment->getNet(); } - const Layer* TrackBlockage::getLayer () const { return _segment->getLayer(); } - Interval TrackBlockage::getFreeInterval ( bool useOrder ) const { return Interval(); } - - - unsigned long TrackBlockage::getId () const - { - cerr << Error("::getId() called on %s.",_getString().c_str()) << endl; - return 0; - } - - - TrackElement* TrackBlockage::getNext () const - { - size_t dummy = _index; - return _track->getNext ( dummy, getNet() ); - } - - - TrackElement* TrackBlockage::getPrevious () const - { - size_t dummy = _index; - return _track->getPrevious ( dummy, getNet() ); - } - - - string TrackBlockage::_getTypeName () const - { return "TrackBlockage"; } - - - string TrackBlockage::_getString () const - { - string s1 = _segment->_getString(); - string s2 = " [" + DbU::getValueString(_sourceU) - + ":" + DbU::getValueString(_targetU) + "]" - + " " + DbU::getValueString(_targetU-_sourceU) - + " [" + ((_track) ? getString(_index) : "npos") + "]"; - s1.insert ( s1.size()-1, s2 ); - - return s1; - } - - - Record* TrackBlockage::_getRecord () const - { - Record* record = TrackElement::_getRecord (); - record->add ( getSlot ( "_segment", _segment ) ); - - return record; - } - - -} // End of Kite namespace. diff --git a/kite/src/TrackElement.cpp b/kite/src/TrackElement.cpp index a12195b2..cd0d404b 100644 --- a/kite/src/TrackElement.cpp +++ b/kite/src/TrackElement.cpp @@ -33,8 +33,8 @@ #include "hurricane/Net.h" #include "hurricane/Name.h" #include "katabatic/AutoContact.h" +#include "katabatic/GCell.h" #include "crlcore/RoutingGauge.h" -#include "kite/GCell.h" #include "kite/DataNegociate.h" #include "kite/TrackElement.h" #include "kite/TrackCost.h" @@ -74,6 +74,7 @@ namespace Kite { using Hurricane::Bug; using Hurricane::Net; using Hurricane::Name; + using Katabatic::GCell; // ------------------------------------------------------------------- @@ -156,7 +157,6 @@ namespace Kite { bool TrackElement::canGoOutsideGCell () const { return false; } bool TrackElement::canRipple () const { return false; } unsigned long TrackElement::getId () const { return 0; } - GCell* TrackElement::getGCell () const { return NULL; } unsigned long TrackElement::getArea () const { return 0; } unsigned int TrackElement::getDogLegLevel () const { return 0; } unsigned int TrackElement::getDogLegOrder () const { return 0; } @@ -180,18 +180,16 @@ namespace Kite { bool TrackElement::canMoveUp ( float, unsigned int ) const { return false; }; bool TrackElement::canDogLeg () { return false; }; bool TrackElement::canDogLeg ( Interval ) { return false; }; - bool TrackElement::canDogLegAt ( GCell*, bool allowReuse ) { return false; }; + bool TrackElement::canDogLegAt ( Katabatic::GCell*, bool allowReuse ) { return false; }; TrackElement* TrackElement::getSourceDogLeg () { return NULL; } TrackElement* TrackElement::getTargetDogLeg () { return NULL; } void TrackElement::dataInvalidate () { } void TrackElement::eventInvalidate () { } - void TrackElement::setGCell ( GCell* ) { } void TrackElement::setArea () { } void TrackElement::setRouted ( bool ) { } void TrackElement::setTrack ( Track* track ) { _track = track; } void TrackElement::setDogLegLevel ( unsigned int ) { } void TrackElement::setDogLegOrder ( unsigned int ) { } - void TrackElement::updateGCellsStiffness ( unsigned int ) { } void TrackElement::swapTrack ( TrackElement* ) { } void TrackElement::reschedule ( unsigned int ) { } void TrackElement::detach () { } @@ -202,8 +200,8 @@ namespace Kite { bool TrackElement::moveAside ( bool onLeft ) { return false; } TrackElement* TrackElement::makeDogLeg () { return NULL; } TrackElement* TrackElement::makeDogLeg ( Interval, bool& leftDogleg ) { return NULL; } - TrackElement* TrackElement::makeDogLeg ( GCell* ) { return NULL; } - TrackElement* TrackElement::_postDogLeg ( GCell* ) { return NULL; } + TrackElement* TrackElement::makeDogLeg ( Katabatic::GCell* ) { return NULL; } + TrackElement* TrackElement::_postDogLeg ( Katabatic::GCell* ) { return NULL; } void TrackElement::_postModify () { } void TrackElement::desalignate () { } bool TrackElement::_check () const { return true; } @@ -248,13 +246,13 @@ namespace Kite { } - Interval TrackElement::getFreeInterval ( bool useOrder ) const + Interval TrackElement::getFreeInterval () const { if ( !_track ) return Interval(false); size_t begin = _index; size_t end = _index; - return _track->expandFreeInterval ( begin, end, Track::Inside, getNet(), useOrder ); + return _track->expandFreeInterval ( begin, end, Track::Inside, getNet() ); } diff --git a/kite/src/TrackElements.cpp b/kite/src/TrackElements.cpp index 7cbfa36f..297f8f30 100644 --- a/kite/src/TrackElements.cpp +++ b/kite/src/TrackElements.cpp @@ -58,7 +58,7 @@ namespace Kite { if ( _locator.isValid() ) { _element = Session::lookup ( _locator.getElement()->getCanonical(bounds)->base() ); if ( !_element ) { - cerr << Bug("Canonical segment whithout TrackElement.") << endl; + cerr << Bug("Canonical segment without TrackElement.") << endl; progress (); } } diff --git a/kite/src/TrackFixedSegment.cpp b/kite/src/TrackFixedSegment.cpp index 1a45b9dc..c5943d41 100644 --- a/kite/src/TrackFixedSegment.cpp +++ b/kite/src/TrackFixedSegment.cpp @@ -38,7 +38,6 @@ #include "hurricane/Vertical.h" #include "katabatic/AutoContact.h" #include "crlcore/RoutingGauge.h" -#include "kite/GCell.h" #include "kite/DataNegociate.h" #include "kite/TrackFixedSegment.h" #include "kite/TrackCost.h" @@ -98,25 +97,25 @@ namespace Kite { _sourceU = max ( boundingBox.getXMin(), uside.getVMin()); _targetU = min ( boundingBox.getXMax(), uside.getVMax()); - GCell* gcell = track->getKiteEngine()->getGCellGrid()->getGCell ( Point(_sourceU,track->getAxis()) ); - GCell* end = track->getKiteEngine()->getGCellGrid()->getGCell ( Point(_targetU,track->getAxis()) ); - GCell* right = NULL; - Interval guside = gcell->getUSide ( Constant::Horizontal, true ); - Interval segside ( boundingBox.getXMin(), boundingBox.getXMax() ); + Katabatic::GCell* gcell = track->getKiteEngine()->getGCellGrid()->getGCell ( Point(_sourceU,track->getAxis()) ); + Katabatic::GCell* end = track->getKiteEngine()->getGCellGrid()->getGCell ( Point(_targetU,track->getAxis()) ); + Katabatic::GCell* right = NULL; + Interval guside = gcell->getUSide ( Constant::Horizontal /*, true*/ ); + Interval segside ( boundingBox.getXMin(), boundingBox.getXMax() ); if ( gcell ) { while ( gcell and (gcell != end) ) { right = gcell->getRight(); if ( right == NULL ) break; - guside = gcell->getUSide ( Constant::Horizontal, true ); + guside = gcell->getUSide ( Constant::Horizontal /*, true*/ ); Interval usedLength = guside.getIntersection ( segside ); gcell->addBlockage ( depth, (float)usedLength.getSize()/(float)guside.getSize() ); gcell = right; } if ( end ) { - guside = gcell->getUSide ( Constant::Horizontal, true ); + guside = gcell->getUSide ( Constant::Horizontal /*, true*/ ); Interval usedLength = guside.getIntersection ( segside ); end->addBlockage ( depth, (float)usedLength.getSize()/(float)guside.getSize() ); @@ -129,24 +128,24 @@ namespace Kite { _sourceU = max ( boundingBox.getYMin(), uside.getVMin()); _targetU = min ( boundingBox.getYMax(), uside.getVMax()); - GCell* gcell = track->getKiteEngine()->getGCellGrid()->getGCell ( Point(track->getAxis(),_sourceU) ); - GCell* end = track->getKiteEngine()->getGCellGrid()->getGCell ( Point(track->getAxis(),_targetU) ); - GCell* up = NULL; - Interval guside = gcell->getUSide ( Constant::Vertical, true ); - Interval segside ( boundingBox.getYMin(), boundingBox.getYMax() ); + Katabatic::GCell* gcell = track->getKiteEngine()->getGCellGrid()->getGCell ( Point(track->getAxis(),_sourceU) ); + Katabatic::GCell* end = track->getKiteEngine()->getGCellGrid()->getGCell ( Point(track->getAxis(),_targetU) ); + Katabatic::GCell* up = NULL; + Interval guside = gcell->getUSide ( Constant::Vertical /*, true*/ ); + Interval segside ( boundingBox.getYMin(), boundingBox.getYMax() ); if ( gcell ) { while ( gcell and (gcell != end) ) { up = gcell->getUp(); if ( up == NULL ) break; - guside = gcell->getUSide ( Constant::Vertical, true ); + guside = gcell->getUSide ( Constant::Vertical /*, true*/ ); Interval usedLength = guside.getIntersection ( segside ); gcell->addBlockage ( depth, (float)usedLength.getSize()/(float)guside.getSize() ); gcell = up; } if ( end ) { - guside = gcell->getUSide ( Constant::Vertical, true ); + guside = gcell->getUSide ( Constant::Vertical /*, true*/ ); Interval usedLength = guside.getIntersection ( segside ); end->addBlockage ( depth, (float)usedLength.getSize()/(float)guside.getSize() ); diff --git a/kite/src/TrackSegment.cpp b/kite/src/TrackSegment.cpp index 43e8cd2d..154b0a6f 100644 --- a/kite/src/TrackSegment.cpp +++ b/kite/src/TrackSegment.cpp @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved // // =================================================================== // @@ -34,8 +34,8 @@ #include "hurricane/Name.h" #include "hurricane/RoutingPad.h" #include "katabatic/AutoContact.h" +#include "katabatic/GCell.h" #include "crlcore/RoutingGauge.h" -#include "kite/GCell.h" #include "kite/DataNegociate.h" #include "kite/TrackSegment.h" #include "kite/TrackCost.h" @@ -69,7 +69,6 @@ namespace Kite { TrackSegment::TrackSegment ( AutoSegment* segment, Track* track ) : TrackElement (track) , _base (segment) - , _gcell (NULL) , _created (true) , _lock (true) , _revalidated (false) @@ -80,7 +79,6 @@ namespace Kite { , _area (0) , _data (NULL) , _dogLegLevel (0) - , _dogLegOrder (0) { if (segment) { _data = new DataNegociate ( this ); @@ -95,20 +93,11 @@ namespace Kite { { TrackElement::_postCreate (); Session::link ( this ); - - vector gcells; - getGCells ( gcells ); - -#if ENABLE_STIFFNESS - updateGCellsStiffness ( TrackElement::AddToGCells ); -#endif } TrackSegment::~TrackSegment () - { - if ( _data ) delete _data; - } + { if ( _data ) delete _data; } void TrackSegment::_preDestroy () @@ -128,7 +117,7 @@ namespace Kite { created = false; TrackElement* trackElement = Session::lookup ( segment->base() ); - if ( !trackElement ) { + if ( not trackElement ) { TrackSegment* trackSegment = new TrackSegment ( segment, track ); trackSegment->_postCreate (); created = true; @@ -163,11 +152,9 @@ namespace Kite { bool TrackSegment::canGoOutsideGCell () const { return _base->canGoOutsideGCell(); } bool TrackSegment::canRipple () const { return _canRipple; } unsigned long TrackSegment::getId () const { return _base->getId(); } - GCell* TrackSegment::getGCell () const { return _gcell; } DbU::Unit TrackSegment::getAxis () const { return _base->getAxis(); } unsigned long TrackSegment::getArea () const { return _area; } unsigned int TrackSegment::getDogLegLevel () const { return _dogLegLevel; } - unsigned int TrackSegment::getDogLegOrder () const { return _dogLegOrder; } Interval TrackSegment::getSourceConstraints () const { return _base->getSourceConstraints(); } Interval TrackSegment::getTargetConstraints () const { return _base->getTargetConstraints(); } DataNegociate* TrackSegment::getDataNegociate () const { return _data; } @@ -220,7 +207,6 @@ namespace Kite { TrackElement* TrackSegment::getNext () const { size_t dummy = _index; - return _track->getNext ( dummy, getNet() ); } @@ -228,40 +214,39 @@ namespace Kite { TrackElement* TrackSegment::getPrevious () const { size_t dummy = _index; - return _track->getPrevious ( dummy, getNet() ); } - Interval TrackSegment::getFreeInterval ( bool useOrder ) const + Interval TrackSegment::getFreeInterval () const { - if ( !_track ) return Interval(false); + if ( not _track ) return Interval(false); size_t begin = _index; size_t end = _index; - return _track->expandFreeInterval ( begin, end, Track::Inside, getNet(), useOrder ); + return _track->expandFreeInterval ( begin, end, Track::Inside, getNet() ); } - size_t TrackSegment::getGCells ( vector& gcells ) const + size_t TrackSegment::getGCells ( vector& gcells ) const { - vector().swap ( gcells ); + vector().swap ( gcells ); - GCell* sourceGCell = Session::lookup(base()->getAutoSource()->getGCell()); - GCell* targetGCell = Session::lookup(base()->getAutoTarget()->getGCell()); + Katabatic::GCell* sourceGCell = base()->getAutoSource()->getGCell(); + Katabatic::GCell* targetGCell = base()->getAutoTarget()->getGCell(); ltrace(148) << "getGCells(): sourceGCell: " << sourceGCell << endl; ltrace(148) << "getGCells(): targetGCell: " << targetGCell << endl; forEach ( AutoSegment*, isegment, base()->getCollapseds() ) { - GCell* gcell = Session::lookup(isegment->getAutoSource()->getGCell()); + Katabatic::GCell* gcell = isegment->getAutoSource()->getGCell(); if ( gcell->getIndex() < sourceGCell->getIndex() ) { sourceGCell = gcell; ltrace(148) << "getGCells(): new sourceGCell: " << sourceGCell << endl; } - gcell = Session::lookup(isegment->getAutoTarget()->getGCell()); + gcell = isegment->getAutoTarget()->getGCell(); if ( gcell->getIndex() > targetGCell->getIndex() ) { targetGCell = gcell; ltrace(148) << "getGCells(): new targetGCell: " << targetGCell << endl; @@ -295,14 +280,6 @@ namespace Kite { } - void TrackSegment::setGCell ( GCell* gcell ) - { - _gcell = gcell; - if (_data and not (_data->isBorder() or _data->isRing())) - _data->setGCellOrder( (_gcell) ? _gcell->getOrder() : (unsigned int)-1 ); - } - - size_t TrackSegment::getPerpandicularsBound ( set& bounds ) { bounds.clear (); @@ -321,13 +298,6 @@ namespace Kite { } - unsigned int TrackSegment::getOrder () const - { - if ( _data == NULL ) return numeric_limits::max(); - return _data->getGCellOrder (); - } - - void TrackSegment::setDogLegLevel ( unsigned int level ) { if ( level > 15 ) { @@ -340,20 +310,6 @@ namespace Kite { } - void TrackSegment::setDogLegOrder ( unsigned int order ) - { - ltrace(200) << "setDogLegOrder(): " << order << " " << this << endl; - - if ( order > 32768 ) { - cerr << Bug("%s has reached maximum dog leg order (32768)." - ,_getString().c_str()) << endl; - order = 32768; - } - - _dogLegOrder = order; - } - - void TrackSegment::dataInvalidate () { if (_data) _data->invalidate(); } @@ -381,12 +337,7 @@ namespace Kite { void TrackSegment::setTrack ( Track* track ) - { - TrackElement::setTrack ( track ); -#if ENABLE_STIFFNESS - updateGCellsStiffness ( ((track != NULL) ? TrackElement::Routed : TrackElement::UnRouted ) ); -#endif - } + { TrackElement::setTrack ( track ); } void TrackSegment::detach () @@ -396,7 +347,6 @@ namespace Kite { setTrack ( NULL ); setIndex ( (size_t)-1 ); setLock ( true ); - //updateGCellsStiffness ( TrackElement::UnRouted ); } @@ -411,7 +361,6 @@ namespace Kite { _data->invalidate ( true, true ); if ( _track ) Session::addSortEvent ( _track ); - _revalidated = true; } @@ -423,48 +372,9 @@ namespace Kite { } - void TrackSegment::updateGCellsStiffness ( unsigned int flags ) - { - if ( Session::getKiteEngine()->getState() > Katabatic::StateDriving ) return; - - vector gcells; - getGCells ( gcells ); - - int count = 0; - if ( flags & TrackElement::AddToGCells ) { - if ( getTrack() ) { flags |= TrackSegment::Routed; _routed = false; } - //cerr << "INC:"; - count = +1; - } - if ( flags & TrackElement::RemoveFromGCells ) { - if ( getTrack() ) { flags |= TrackSegment::UnRouted; _routed = true; } - //cerr << "DEC:"; - count = -1; - } - if ( count ) { - //cerr << count << " SegmentCount() for " << this << endl; - for ( size_t i=0 ; iincSegmentCount ( count ); - //cerr << "| " << gcells[i] << endl; - } - } - - count = 0; - if ( not _routed and (flags & TrackElement::Routed ) ) { count = +1; _routed = true; } - if ( _routed and (flags & TrackElement::UnRouted) ) { count = -1; _routed = false; } - - if ( count ) { - for ( size_t i=0 ; iincRoutedCount ( count ); - //cerr << "Update (" << count << ") " << gcells[i] << " for: " << this << endl; - } - } - } - - void TrackSegment::swapTrack ( TrackElement* other ) { - if ( !other ) return; + if ( not other ) return; ltrace(200) << "TrackSegment::swapTrack()" << endl; @@ -484,8 +394,6 @@ namespace Kite { setTrack ( NULL ); other->setTrack ( NULL ); - // if ( _track ) updateGCellsStiffness ( TrackElement::UnRouted ); - // if ( otherTrack ) other->updateGCellsStiffness ( TrackElement::UnRouted ); //other->setRouted ( thisRouted ); other->setTrack ( thisTrack ); @@ -519,28 +427,15 @@ namespace Kite { { ltrace(200) << "TrackSegment::reschedule() - " << this << endl; ltracein(200); - ltrace(200) << "GCell: " << _gcell << endl; - ltrace(200) << "GCell::order:" << _gcell->getOrder() - << " Data::order:" << getOrder() - << " Session::order:" << Session::getOrder() << endl; - if ( getOrder() == Session::getOrder() ) { - if ( not _data or not _data->hasRoutingEvent() ) - Session::getNegociateWindow()->addInsertEvent ( this, level ); - else { - if ( _track != NULL ) - Session::addRemoveEvent ( this ); - Session::getNegociateWindow()->rescheduleEvent ( _data->getRoutingEvent(), level ); - } - } else { - if ( _data and _data->hasRoutingEvent() ) - _data->getRoutingEvent()->setDisabled(); - - if ( getOrder() > Session::getOrder() ) { - if ( _track != NULL ) - Session::addRemoveEvent ( this ); - } + if ( not _data or not _data->hasRoutingEvent() ) + Session::getNegociateWindow()->addInsertEvent ( this, level ); + else { + if ( _track != NULL ) + Session::addRemoveEvent ( this ); + Session::getNegociateWindow()->rescheduleEvent ( _data->getRoutingEvent(), level ); } + ltraceout(200); } @@ -551,58 +446,8 @@ namespace Kite { ltrace(200) << "TrackSegment::slacken()" << endl; ltracein(200); - // set collapseds; - - // collapseds.insert ( _base ); - // forEach ( AutoSegment*, isegment, _base->getCollapseds() ) { - // collapseds.insert ( *isegment ); - // } - - //unsigned int direction = Constant::perpandicular ( getDirection() ); - //unsigned int doglegLevel = getDogLegLevel() + 1; - - //setSlackened ( true ); -#if ENABLE_STIFFNESS - updateGCellsStiffness ( TrackElement::RemoveFromGCells ); -#endif base()->slacken ( true ); -#if ENABLE_STIFFNESS - updateGCellsStiffness ( TrackElement::AddToGCells ); -#endif - _postModify (); - - // const vector& invalidateds = Session::getInvalidateds(); - // if ( not invalidateds.empty() ) { - // vector segments; - // for ( size_t i=0 ; ibase()->isTerminal() or (collapseds.find(segment->base()) != collapseds.end()) ) - // // segment->setSlackened ( true ); - - // if ( segment->isCreated() ) { - // //segment->setSlackened ( true ); - // if ( segment->getDirection() == direction ) { - // ltrace(200) << "Increasing dogleg level to: " << doglegLevel << endl; - // segment->setDogLegLevel ( doglegLevel ); - - // if ( segment->getOrder() > Session::getOrder() ) { - // ltrace(200) << "Adding to ring: " << segment << endl; - // Session::getNegociateWindow()->addToRing ( segment ); - // } - // } - // } - - // segment->reschedule ( 0 ); - // } - - // for ( size_t i=0 ; icanPivotUp(reserve); - } + { return _base->canPivotUp(reserve); } bool TrackSegment::canMoveUp ( float reserve, unsigned int flags ) const - { - // if ( isLocal() /*and (hasSourceDogLeg() or hasTargetDogLeg())*/ ) { - // return _base->canPivotUp(); - // } - - return _base->canMoveUp ( reserve, flags ); - } + { return _base->canMoveUp ( reserve, flags ); } bool TrackSegment::moveUp ( unsigned int flags ) @@ -633,19 +470,13 @@ namespace Kite { ltrace(200) << "TrackSegment::moveUp() " << flags << endl; ltracein(200); -#if ENABLE_STIFFNESS - updateGCellsStiffness ( TrackElement::RemoveFromGCells ); -#endif success = base()->moveUp ( flags ); -#if ENABLE_STIFFNESS - updateGCellsStiffness ( TrackElement::AddToGCells ); -#endif const vector& invalidateds = Session::getInvalidateds(); if ( not invalidateds.empty() ) { vector segments; for ( size_t i=0 ; iaddTrackSegment(invalidateds[i],false); if ( segment != NULL ) { ltrace(200) << "moved: " << invalidateds[i] << endl; segments.push_back ( segment ); @@ -654,16 +485,15 @@ namespace Kite { segment->reschedule ( 0 ); } } - for ( size_t i=0 ; isetState ( DataNegociate::ConflictSolve1, true ); - _data->resetRipupCount (); - } + // if ( _data and success ) { + // _data->setState ( DataNegociate::ConflictSolve1, true ); + // _data->resetRipupCount (); + // } ltraceout(200); @@ -678,32 +508,18 @@ namespace Kite { ltrace(200) << "TrackSegment::moveAside() - " << (onLeft?"left":"right") << endl; ltracein(200); - unsigned int order = _data->getGCellOrder(); - -#if ENABLE_STIFFNESS - updateGCellsStiffness ( TrackElement::RemoveFromGCells ); -#endif if ( onLeft ) base()->moveULeft (); else base()->moveURight (); -#if ENABLE_STIFFNESS - updateGCellsStiffness ( TrackElement::AddToGCells ); -#endif const vector& invalidateds = Session::getInvalidateds(); if ( not invalidateds.empty() ) { vector segments; for ( size_t i=0 ; iaddTrackSegment(invalidateds[i],false) ); segments.back()->reschedule ( 0 ); } - if ( _data->getGCellOrder() < order ) { - cinfo << "[INFO] Putting TrackSegment of order " << order - << " into GCell " << getGCell() << endl; - _data->setGCellOrder ( order ); - } - for ( size_t i=0 ; igetLayerDepth(getLayer()) < 2); - GCell* originalGCell = getGCell (); - -#if ENABLE_STIFFNESS - updateGCellsStiffness ( TrackElement::RemoveFromGCells ); -#endif base()->makeDogLeg ( interval, upLayer, leftDogleg ); -#if ENABLE_STIFFNESS - updateGCellsStiffness ( TrackElement::AddToGCells ); -#endif - return _postDogLeg ( originalGCell ); + return _postDogLeg (); } @@ -818,13 +619,6 @@ namespace Kite { return false; } - if ( getDogLegOrder() < Session::getOrder() ) { - ltrace(200) << "No dogleg in current order " << Session::getOrder() - << " yet, allowing (previous:" << _dogLegOrder << ")" << endl; - setDogLegOrder ( Session::getOrder() ); - setSourceDogLeg ( false ); - setTargetDogLeg ( false ); - } if ( hasSourceDogLeg() || hasTargetDogLeg() ) return false; return true; @@ -833,17 +627,11 @@ namespace Kite { TrackElement* TrackSegment::makeDogLeg () { - AutoContact* source = _base->getAutoSource(); - AutoContact* target = _base->getAutoTarget(); - GCell* gcell = Session::lookup ( _base->getAutoSource()->getGCell() ); + Katabatic::AutoContact* source = _base->getAutoSource(); + Katabatic::AutoContact* target = _base->getAutoTarget(); + Katabatic::GCell* gcell = _base->getAutoSource()->getGCell(); -#if ENABLE_STIFFNESS - updateGCellsStiffness ( TrackElement::RemoveFromGCells ); -#endif TrackElement* dogleg = makeDogLeg ( gcell ); -#if ENABLE_STIFFNESS - updateGCellsStiffness ( TrackElement::AddToGCells ); -#endif if ( dogleg ) { if ( source->isTerminal() xor target->isTerminal() ) { @@ -855,25 +643,17 @@ namespace Kite { ltrace(200) << "Setting dogleg axis @" << DbU::getValueString(axis) << endl; dogleg->setAxis ( axis ); } - return _postDogLeg(gcell); + return _postDogLeg(); } return NULL; } - bool TrackSegment::canDogLegAt ( GCell* dogLegGCell, bool allowReuse ) + bool TrackSegment::canDogLegAt ( Katabatic::GCell* dogLegGCell, bool allowReuse ) { ltrace(200) << "TrackSegment::canDogLegAt(GCell*) " << dogLegGCell << endl; - if ( getDogLegOrder() < Session::getOrder() ) { - ltrace(200) << "No dogleg in current order " << Session::getOrder() - << " yet, allowing (previous:" << _dogLegOrder << ")" << endl; - setDogLegOrder ( Session::getOrder() ); - setSourceDogLeg ( false ); - setTargetDogLeg ( false ); - } - if ( isFixed() ) { ltrace(200) << "Cannot dogleg a fixed segment." << endl; return false; @@ -889,12 +669,8 @@ namespace Kite { return false; } } -// if ( Session::getRoutingGauge()->getLayerDepth(getLayer()) > 3 ) { -// ltrace(200) << "Cannot dogleg on the last top layer." << endl; -// return false; -// } - vector gcells; + vector gcells; getGCells ( gcells ); ltrace(190) << "Source: " << *gcells.begin () << endl; @@ -921,11 +697,6 @@ namespace Kite { return false; } - //if ( dogLegGCell->getUSide(getDirection(),false).intersect(getCanonicalInterval()) ) { - // ltrace(200) << "Segment is almost outside the breaking GCell." << endl; - // return false; - //} - break; } @@ -938,28 +709,20 @@ namespace Kite { } - TrackElement* TrackSegment::makeDogLeg ( GCell* dogLegGCell ) + TrackElement* TrackSegment::makeDogLeg ( Katabatic::GCell* dogLegGCell ) { ltrace(200) << "TrackSegment::makeDogLeg(GCell*)" << endl; ltrace(200) << "Break in: " << dogLegGCell << endl; bool upLayer = (Session::getRoutingGauge()->getLayerDepth(getLayer()) < 2); - GCell* originalGCell = getGCell (); + base()->makeDogLeg ( dogLegGCell, upLayer ); -#if ENABLE_STIFFNESS - updateGCellsStiffness ( TrackElement::RemoveFromGCells ); -#endif - base()->makeDogLeg ( dogLegGCell->base(), upLayer ); -#if ENABLE_STIFFNESS - updateGCellsStiffness ( TrackElement::AddToGCells ); -#endif - - return _postDogLeg ( originalGCell ); + return _postDogLeg (); } - TrackElement* TrackSegment::_postDogLeg ( GCell* originalGCell ) + TrackElement* TrackSegment::_postDogLeg () { ltracein(200); @@ -971,12 +734,7 @@ namespace Kite { for ( size_t i=0 ; ibase() == dogLegs[i])*/ ) - // segments[i]->setSlackened (true); - - segments[i]->setDogLegOrder ( Session::getOrder() ); + segments.push_back ( Session::getNegociateWindow()->addTrackSegment(dogLegs[i],false) ); switch ( i ) { case 0: @@ -1001,37 +759,13 @@ namespace Kite { } } - ltrace(200) << "Before break: " << originalGCell << endl; - ltrace(200) << "After break: " << getGCell() << endl; - if ( getGCell() != originalGCell ) swapTrack ( segments[2] ); + // TO CHECK + // If the original TrackElement was inserted in a Track, must check + // if the new bit takes it's place or not. + //if ( getGCell() != originalGCell ) swapTrack ( segments[2] ); for ( size_t i=0 ; ireschedule ( ((i==1) ? 0 : 1) ); - if ( i == 1 ) { - ltrace(200) << "Set canDogleg: dogleg:" << segments[1]->getDataNegociate()->getGCellOrder() - << " vs. session:" << Session::getOrder() << endl; - - if ( segments[1]->getOrder() > Session::getOrder()) { - segments[i]->setCanRipple ( true ); - ltrace(200) << "Adding to ring: " << segments[i] << endl; - Session::getNegociateWindow()->addToRing ( segments[i] ); - } - } else { - if ( segments[i]->getOrder() > Session::getOrder()) { - AutoContact* source = segments[i]->base()->getAutoSource(); - AutoContact* target = segments[i]->base()->getAutoTarget(); - if ( (source and dynamic_cast(source->getAnchor())) - or (target and dynamic_cast(target->getAnchor()))) { - ltrace(200) << "Adding to ring: " << segments[i] << endl; - Session::getNegociateWindow()->addToRing ( segments[i] ); - } - } - } - //if ( i == 1 ) { - // RoutingEvent* event = segments[i]->getDataNegociate()->getRoutingEvent(); - // if ( event ) - // event->setCanGoOutsideGCell ( true ); - //} } ltrace(200) << "original: " << segments[0] << endl; @@ -1050,12 +784,6 @@ namespace Kite { ltrace(200) << "TrackSegment::canDesalignate()" << endl; return _base->canDesalignate(); - -// Interval baseSpan = _base->getSpanU (); -// if ( baseSpan.getVMin() - Session::getExtensionCap() > _sourceCanonical ) return _base->canDesalignate(); -// if ( baseSpan.getVMax() + Session::getExtensionCap() < _targetCanonical ) return _base->canDesalignate(); - -// return false; } @@ -1064,37 +792,9 @@ namespace Kite { ltrace(200) << "TrackSegment::desalignate()" << endl; ltracein(200); -#if ENABLE_STIFFNESS - updateGCellsStiffness ( TrackElement::RemoveFromGCells ); -#endif - _base->desalignate (); - -#if ENABLE_STIFFNESS - updateGCellsStiffness ( TrackElement::AddToGCells ); -#endif - _postModify (); - // const vector& invalidateds = Session::getInvalidateds(); - // if ( not invalidateds.empty() ) { - // vector segments; - // for ( size_t i=0 ; ireschedule ( 0 ); - - // if ( segments[i]->getDataNegociate()->getGCellOrder() > Session::getOrder() ) { - // ltrace(200) << "Adding to ring: " << segments[i] << endl; - // Session::getNegociateWindow()->addToRing ( segments[i] ); - // } - // } - - // for ( size_t i=0 ; iaddTrackSegment(invalidateds[i],false); if ( segment != NULL ) segments.push_back ( segment ); } @@ -1129,30 +829,12 @@ namespace Kite { segment->setDogLegLevel ( doglegLevel ); } - if ( segment->getDataNegociate()->getGCellOrder() == Session::getOrder() ) { - if ( segment->getDirection() == parallelDir ) { - forEach ( TrackElement*, iperpandicular, segment->getCollapsedPerpandiculars() ) { - ltrace(200) << "| pp: " << *iperpandicular << endl; - - if ( iperpandicular->getDataNegociate()->getGCellOrder() == Session::getOrder() ) { - iperpandicular->reschedule ( 0 ); - } else if ( iperpandicular->getDataNegociate()->getGCellOrder() > Session::getOrder() ) { - ltrace(200) << "Adding to ring: " << *iperpandicular << endl; - Session::getNegociateWindow()->addToRing ( *iperpandicular ); - } - } - segment->reschedule ( 0 ); - } - } else if ( segment->getDataNegociate()->getGCellOrder() > Session::getOrder()) { - if ( segment->getDirection() == parallelDir ) { - AutoContact* source = segment->base()->getAutoSource(); - AutoContact* target = segment->base()->getAutoTarget(); - if ( (source and dynamic_cast(source->getAnchor())) - or (target and dynamic_cast(target->getAnchor()))) { - ltrace(200) << "Adding to ring: " << segment << endl; - Session::getNegociateWindow()->addToRing ( segment ); - } + if ( segment->getDirection() == parallelDir ) { + forEach ( TrackElement*, iperpandicular, segment->getCollapsedPerpandiculars() ) { + ltrace(200) << "| pp: " << *iperpandicular << endl; + iperpandicular->reschedule ( 0 ); } + segment->reschedule ( 0 ); } } @@ -1162,7 +844,7 @@ namespace Kite { bool TrackSegment::_check () const { - if ( !base() ) return true; + if ( not base() ) return true; bool coherency = true; @@ -1182,11 +864,6 @@ namespace Kite { cerr << "[CHECK] " << this << " has bad target position " << DbU::getValueString(max) << "." << endl; coherency = false; } -#if ENABLE_STIFFNESS - if ( _routed xor (_track != NULL) ) { - cerr << "[CHECK] " << this << " incoherency between routed/track flags." << endl; - } -#endif return coherency; } @@ -1203,13 +880,10 @@ namespace Kite { + ":" + DbU::getValueString(_targetU) + "]" + " " + DbU::getValueString(_targetU-_sourceU) + " " + getString(_dogLegLevel) - + " o:" + getString(_data->getGCellOrder()) + " [" + ((_track) ? getString(_index) : "npos") + "] " + ((isSlackened() ) ? "S" : "-") + ((_track ) ? "T" : "-") + ((_canRipple ) ? "r" : "-") - + ((_data->isBorder()) ? "B" : "-") - + ((_data->isRing ()) ? "R" : "-") + ((_sourceDogLeg ) ? "s" : "-") + ((_targetDogLeg ) ? "t" : "-"); diff --git a/kite/src/kite/DataNegociate.h b/kite/src/kite/DataNegociate.h index a0e6dd63..6b353539 100644 --- a/kite/src/kite/DataNegociate.h +++ b/kite/src/kite/DataNegociate.h @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved // // =================================================================== // @@ -45,7 +45,6 @@ namespace Katabatic { namespace Kite { - using std::string; using std::cerr; using std::endl; @@ -64,43 +63,33 @@ namespace Kite { class DataNegociate { public: - enum SlackState { RipupPerpandiculars=1 - , Minimize - , DogLeg - , Desalignate - , Slacken - , ConflictSolve1 - , ConflictSolve2 - , LocalVsGlobal - , MoveUp - , MaximumSlack - , Unimplemented + enum SlackState { RipupPerpandiculars= 1 + , Minimize = 2 + , DogLeg = 3 + , Desalignate = 4 + , Slacken = 5 + , ConflictSolve1 = 6 + , ConflictSolve2 = 7 + , LocalVsGlobal = 8 + , MoveUp = 9 + , MaximumSlack =10 + , Unimplemented =11 }; public: DataNegociate ( TrackElement* ); ~DataNegociate (); - inline bool isRing () const; - inline bool isBorder () const; - inline bool isLeftBorder () const; - inline bool isRightBorder () const; inline bool hasRoutingEvent () const; inline RoutingEvent* getRoutingEvent () const; inline TrackElement* getTrackSegment () const; inline Track* getTrack () const; inline TrackSegmentCost& getCost (); - inline unsigned int getGCellOrder () const; //inline unsigned int getZ () const; inline unsigned int getState () const; inline unsigned int getStateCount () const; inline unsigned int getRipupCount () const; inline unsigned int getStateAndRipupCount () const; - inline void setGCellOrder ( unsigned int ); inline void setState ( unsigned int, bool reset=false ); - inline void setRing ( bool ); - inline void setLeftBorder ( bool ); - inline void setRightBorder ( bool ); - inline void resetBorder (); inline void setRoutingEvent ( RoutingEvent* ); inline void setRipupCount ( unsigned int ); inline void incRipupCount (); @@ -119,12 +108,8 @@ namespace Kite { RoutingEvent* _routingEvent; TrackElement* _trackSegment; TrackSegmentCost _cost; - unsigned int _gcellOrder; unsigned int _state :5; unsigned int _stateCount:5; - bool _leftBorder; - bool _rightBorder; - bool _ring; //unsigned int _z : 5; private: @@ -134,25 +119,15 @@ namespace Kite { // Inline Functions. - inline bool DataNegociate::isRing () const { return _ring; } - inline bool DataNegociate::isBorder () const { return _leftBorder or _rightBorder; } - inline bool DataNegociate::isLeftBorder () const { return _leftBorder; } - inline bool DataNegociate::isRightBorder () const { return _rightBorder; } inline bool DataNegociate::hasRoutingEvent () const { return _routingEvent != NULL; } inline RoutingEvent* DataNegociate::getRoutingEvent () const { return _routingEvent; } inline TrackElement* DataNegociate::getTrackSegment () const { return _trackSegment; } inline Track* DataNegociate::getTrack () const { return _trackSegment->getTrack(); } inline TrackSegmentCost& DataNegociate::getCost () { return _cost; } - inline unsigned int DataNegociate::getGCellOrder () const { return _gcellOrder; } inline unsigned int DataNegociate::getState () const { return _state; } inline unsigned int DataNegociate::getStateCount () const { return _stateCount; } //inline unsigned int DataNegociate::getZ () const { return _z; } inline unsigned int DataNegociate::getRipupCount () const { return _cost.getRipupCount(); } - inline void DataNegociate::setGCellOrder ( unsigned int order ) { _gcellOrder = order; } - inline void DataNegociate::setRing ( bool state ) { _ring = state; } - inline void DataNegociate::setLeftBorder ( bool state ) { _leftBorder=state; } - inline void DataNegociate::setRightBorder ( bool state ) { _rightBorder=state; } - inline void DataNegociate::resetBorder () { _leftBorder=_rightBorder=false; } inline void DataNegociate::setRoutingEvent ( RoutingEvent* event ) { _routingEvent = event; } inline void DataNegociate::setRipupCount ( unsigned int count ) { _cost.setRipupCount(count); } inline void DataNegociate::incRipupCount () { _cost.incRipupCount(); } @@ -167,6 +142,7 @@ namespace Kite { inline void DataNegociate::setState ( unsigned int state, bool reset ) { if ( (_state != state) or reset ) { + //std::cerr << "Changing state to:" << state << std::endl; _state = state; _stateCount = 1; } else diff --git a/kite/src/kite/GCell.h b/kite/src/kite/GCell.h deleted file mode 100644 index ff078af5..00000000 --- a/kite/src/kite/GCell.h +++ /dev/null @@ -1,220 +0,0 @@ - -// -*- C++ -*- -// -// This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved -// -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | -// | C O R I O L I S | -// | K i t e - D e t a i l e d R o u t e r | -// | | -// | Author : Jean-Paul CHAPUT | -// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | -// | =============================================================== | -// | C++ Header : "./GCell.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x - - -#ifndef __KITE_GCELL__ -#define __KITE_GCELL__ - -#include -#include -#include -#include - -#include "hurricane/Collection.h" -namespace Hurricane { - class Name; -} - -#include "katabatic/GCell.h" - - -namespace Kite { - - - using std::vector; - using std::string; - using Hurricane::_TName; - using Hurricane::Record; - using Hurricane::Name; - using Hurricane::DbU; - using Hurricane::Point; - using Hurricane::Box; - using Hurricane::Interval; - using Hurricane::ExtensionGo; - using Hurricane::GenericCollection; - using Hurricane::GenericLocator; - using Hurricane::GenericFilter; - using Katabatic::AutoSegment; - using Katabatic::AutoContact; - - class TrackElement; - class GCellGrid; - - -// ------------------------------------------------------------------- -// Class : "GCell". - - - class GCell { - - public: - // Sub-Class: "CompareByDensity()". - class CompareByDensity { - public: - bool operator() ( GCell* lhs, GCell* rhs ); - }; - // Sub-Class: "CompareByStiffness()". - class CompareByStiffness { - public: - bool operator() ( GCell* lhs, GCell* rhs ); - }; - friend class Compare; - - public: - static bool areDensityConnex ( GCell* a, GCell* b ); - static GCell* getLowestOrder ( TrackElement* ); - static TrackElement* addTrackSegment ( GCell*, AutoSegment*, bool loading=false ); - static GCell* create ( GCellGrid*, Katabatic::GCell* ); - public: - void destroy (); - inline Katabatic::GCell* base (); - inline bool isInRoutingSet () const; - inline unsigned int getOrder () const; - inline const vector& getOwnedSegments () const; - inline void setInRoutingSet ( bool state ); - inline void setRouted ( bool state ); - inline TrackElement* getLeftRp ( size_t ) const; - inline TrackElement* getRightRp ( size_t ) const; - void addTrackSegment ( TrackElement* ); - void removeTrackSegment ( TrackElement* ); - void loadRouting ( unsigned int order ); - void computeBorder (); - double getOwnedWireLength () const; - public: - inline bool isAboveDensity ( float threshold ) const; - inline bool isRouted () const; - inline unsigned int getDepth () const; - inline unsigned int getIndex () const; - inline unsigned int getColumn () const; - inline unsigned int getRow () const; - inline Box getBoundingBox () const; - inline DbU::Unit getX () const; - inline DbU::Unit getY () const; - inline DbU::Unit getXMax () const; - inline DbU::Unit getYMax () const; - inline Interval getUSide ( unsigned int, bool noShrink ) const; - inline float getDensity ( size_t depth ) const; - inline float getCDensity () const; - inline float getDensity () const; - inline float getStiffness () const; - GCell* getLeft () const; - GCell* getRight () const; - GCell* getUp () const; - GCell* getDown () const; - inline vector* getVSegments (); - inline vector* getHSegments (); - inline vector* getContacts (); - inline unsigned int getSegmentCount () const; - inline unsigned int getRoutedCount () const; - inline void incSegmentCount ( int count ); - inline void incRoutedCount ( int count ); - inline float getBlockage ( unsigned int depth ) const; - inline void addBlockage ( unsigned int depth, float ); - void anticipateRouting ( unsigned int ); - inline size_t checkDensity () const; - inline size_t updateDensity (); - virtual Record* _getRecord () const; - virtual string _getString () const; - virtual string _getTypeName () const; - - protected: - // Attributes. - GCellGrid* _gcellGrid; - Katabatic::GCell* _base; - vector _segments; - unsigned int _order; - bool _isInRoutingSet; - bool _isRouted; - TrackElement* _leftSegments [2]; - TrackElement* _rightSegments[2]; - - protected: - // Constructors & Destructors. - GCell ( GCellGrid*, Katabatic::GCell* ); - virtual ~GCell (); - private: - GCell ( const GCell& ); - GCell& operator= ( const GCell& ); - }; - - -// GCell Inline Functions. - inline Katabatic::GCell* GCell::base () { return _base; } - inline bool GCell::isInRoutingSet () const { return _isInRoutingSet; } - inline bool GCell::isRouted () const { return _isRouted; } - inline bool GCell::isAboveDensity ( float threshold ) const { return _base->isAboveDensity(threshold); } - inline unsigned int GCell::getColumn () const { return _base->getColumn(); } - inline unsigned int GCell::getRow () const { return _base->getRow(); } - inline unsigned int GCell::getDepth () const { return _base->getDepth(); } - inline unsigned int GCell::getOrder () const { return _order; } - inline const vector& GCell::getOwnedSegments () const { return _segments; } - inline TrackElement* GCell::getLeftRp ( size_t i ) const { return _leftSegments[i]; } - inline TrackElement* GCell::getRightRp ( size_t i ) const { return _rightSegments[i]; } - inline void GCell::setInRoutingSet ( bool state ) { _isInRoutingSet = state; } - inline void GCell::setRouted ( bool state ) { _isRouted = state; } - inline unsigned int GCell::getIndex () const { return _base->getIndex(); } - inline Box GCell::getBoundingBox () const { return _base->getBoundingBox(); } - inline DbU::Unit GCell::getX () const { return _base->getX(); } - inline DbU::Unit GCell::getY () const { return _base->getY(); } - inline DbU::Unit GCell::getXMax () const { return _base->getXMax(); } - inline DbU::Unit GCell::getYMax () const { return _base->getYMax(); } - inline float GCell::getDensity ( size_t depth ) const { return _base->getDensity(depth); } - inline float GCell::getCDensity () const { return _base->getCDensity(); } - inline float GCell::getDensity () const { return _base->getDensity(); } - inline float GCell::getStiffness () const { return _base->getStiffness(); } - inline vector* GCell::getVSegments () { return _base->getVSegments(); } - inline vector* GCell::getHSegments () { return _base->getHSegments(); } - inline vector* GCell::getContacts () { return _base->getContacts(); } - inline unsigned int GCell::getSegmentCount () const { return _base->getSegmentCount(); } - inline unsigned int GCell::getRoutedCount () const { return _base->getRoutedCount(); } - inline void GCell::incSegmentCount ( int count ) { _base->incSegmentCount(count); } - inline void GCell::incRoutedCount ( int count ) { _base->incRoutedCount(count); } - inline float GCell::getBlockage ( unsigned int depth ) const { return _base->getBlockage(depth); } - inline void GCell::addBlockage ( unsigned int depth, float length ) { _base->addBlockage(depth,length); } - inline size_t GCell::checkDensity () const { return _base->checkDensity(); } - inline size_t GCell::updateDensity () { return _base->updateDensity(); } - - inline Interval GCell::getUSide ( unsigned int dir, bool noShrink ) const - { return _base->getUSide(dir).inflate((noShrink)?Katabatic::GCell::getTopRightShrink():0,0); } - - inline bool operator< ( const GCell& lhs, const GCell& rhs ) { return lhs.getIndex() < rhs.getIndex(); } - inline bool operator> ( const GCell& lhs, const GCell& rhs ) { return lhs.getIndex() > rhs.getIndex(); } - - -// ------------------------------------------------------------------- -// Collections. - - - typedef GenericCollection GCells; - typedef GenericLocator GCellLocator; - typedef GenericFilter GCellFilter; - - -} // End of Kite namespace. - - -INSPECTOR_P_SUPPORT(Kite::GCell); - - -#endif // __KITE_GCELL__ diff --git a/kite/src/kite/GCellGrid.h b/kite/src/kite/GCellGrid.h deleted file mode 100644 index 621a4791..00000000 --- a/kite/src/kite/GCellGrid.h +++ /dev/null @@ -1,96 +0,0 @@ - -// -*- C++ -*- -// -// This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved -// -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | -// | C O R I O L I S | -// | K i t e - D e t a i l e d R o u t e r | -// | | -// | Author : Jean-Paul CHAPUT | -// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | -// | =============================================================== | -// | C++ Header : "./GCellGrid.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x - - -#ifndef __KITE_GCELL_GRID__ -#define __KITE_GCELL_GRID__ - -namespace Hurricane { - class Cell; -} - -#include "katabatic/GCellGrid.h" -#include "kite/GCell.h" -#include "kite/KiteEngine.h" - - -namespace Kite { - - - using Hurricane::Cell; - class KiteEngine; - - -// ------------------------------------------------------------------- -// Class : "GCellGrid". - - - class GCellGrid : public Katabatic::Grid { - - public: - static GCellGrid* create ( KiteEngine* ); - public: - inline Katabatic::GCellGrid* base (); - inline KiteEngine* getKite (); - Cell* getCell () const; - inline Interval getUSide ( unsigned int ) const; - inline bool checkEdgeSaturation ( float threshold ) const; - void updateContacts ( bool openSession=true ); - void updateDensity (); - double getTotalWireLength () const; - void _check () const; - virtual Record* _getRecord () const; - virtual string _getString () const; - virtual string _getTypeName () const; - - protected: - KiteEngine* _kite; - - protected: - // Constructors & Destructors. - GCellGrid ( KiteEngine* ); - virtual ~GCellGrid (); - virtual void _postCreate (); - virtual void _preDestroy (); - private: - GCellGrid ( const GCellGrid& ); - GCellGrid& operator= ( const GCellGrid& ); - }; - - -// Inline Functions. - inline Katabatic::GCellGrid* GCellGrid::base () { return _kite->base()->getGCellGrid(); } - inline KiteEngine* GCellGrid::getKite () { return _kite; }; - - inline Interval GCellGrid::getUSide ( unsigned int dir ) const - { return const_cast(this)->base()->getUSide(dir); } - - inline bool GCellGrid::checkEdgeSaturation ( float threshold ) const - { return const_cast(this)->base()->checkEdgeSaturation(threshold); } - - -} // End of Kite namespace. - - -#endif // __KITE_GCELL_GRID__ diff --git a/kite/src/kite/GCellRoutingSet.h b/kite/src/kite/GCellRoutingSet.h deleted file mode 100644 index 87f51225..00000000 --- a/kite/src/kite/GCellRoutingSet.h +++ /dev/null @@ -1,158 +0,0 @@ - -// -*- C++ -*- -// -// This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved -// -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | -// | C O R I O L I S | -// | K i t e - D e t a i l e d R o u t e r | -// | | -// | Author : Jean-Paul CHAPUT | -// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | -// | =============================================================== | -// | C++ Header : "./GCellRoutingSet.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x - - -#ifndef __KITE_GCELL_ROUTING_SET__ -#define __KITE_GCELL_ROUTING_SET__ - -#include - - -namespace Kite { - - using std::vector; - class TrackElement; - class GCell; - class GCellGrid; - - -// ------------------------------------------------------------------- -// Class : "Statistics". - - - class Statistics { - public: - inline Statistics (); - inline size_t getGCellsCount () const; - inline size_t getSegmentsCount () const; - inline size_t getEventsCount () const; - inline void setGCellsCount ( size_t ); - inline void setSegmentsCount ( size_t ); - inline void setEventsCount ( size_t ); - inline void incGCellCount ( size_t ); - inline void incSegmentsCount ( size_t ); - inline void incEventsCount ( size_t ); - inline Statistics& operator+= ( const Statistics& ); - private: - size_t _gcellsCount; - size_t _segmentsCount; - size_t _eventsCount; - - }; - - -// ------------------------------------------------------------------- -// Class : "GCellRoutingSet". - - - class GCellRoutingSet { - - public: - static GCellRoutingSet* create ( GCell*, float densityExpandRatio ); - virtual void destroy (); - inline unsigned int getOrder () const; - inline const vector& getGCells () const; - vector& getOwnedSegments ( vector& ) const; - unsigned int& loadRouting ( unsigned int& order ); - void loadBorder ( GCellGrid* ); - void freeBorder (); - void expand ( GCellGrid* ); - void setRouted ( bool ); - inline Statistics& getStatistics (); - virtual Record* _getRecord () const; - virtual string _getString () const; - virtual string _getTypeName () const; - - private: - class BorderSegment { - public: - inline BorderSegment ( TrackElement*, unsigned int ); - public: - TrackElement* _segment; - unsigned int _order; - }; - - private: - // Attributes. - unsigned int _order; - float _minDensity; - float* _minDensities; - vector _gcells; - vector _borderSegments; - Statistics _statistics; - - protected: - // Constructors & Destructors. - GCellRoutingSet ( GCell*, float expandRatio, float minDensity ); - virtual ~GCellRoutingSet (); - virtual void _postCreate (); - virtual void _preDestroy (); - private: - GCellRoutingSet ( const GCellRoutingSet& ); - GCellRoutingSet& operator= ( const GCellRoutingSet& ); - }; - - -// Inline Functions. - inline unsigned int GCellRoutingSet::getOrder () const { return _order; } - inline const vector& GCellRoutingSet::getGCells () const { return _gcells; } - inline Statistics& GCellRoutingSet::getStatistics () { return _statistics; } - - inline GCellRoutingSet::BorderSegment::BorderSegment ( TrackElement* segment, unsigned int order ) - : _segment(segment) - , _order (order) - { } - - inline Statistics::Statistics () - : _gcellsCount (0) - , _segmentsCount (0) - , _eventsCount (0) - { } - - inline size_t Statistics::getGCellsCount () const { return _gcellsCount; } - inline size_t Statistics::getSegmentsCount () const { return _segmentsCount; } - inline size_t Statistics::getEventsCount () const { return _eventsCount; } - inline void Statistics::setGCellsCount ( size_t count ) { _gcellsCount = count; } - inline void Statistics::setSegmentsCount ( size_t count ) { _segmentsCount = count; } - inline void Statistics::setEventsCount ( size_t count ) { _eventsCount = count; } - inline void Statistics::incGCellCount ( size_t count ) { _gcellsCount += count; } - inline void Statistics::incSegmentsCount ( size_t count ) { _segmentsCount += count; } - inline void Statistics::incEventsCount ( size_t count ) { _eventsCount += count; } - - inline Statistics& Statistics::operator+= ( const Statistics& other ) - { - _gcellsCount += other._gcellsCount; - _segmentsCount += other._segmentsCount; - _eventsCount += other._eventsCount; - return *this; - } - - -} // End of Kite namespace. - - -INSPECTOR_P_SUPPORT(Kite::GCellRoutingSet); - - -#endif // __KITE_GCELL_ROUTING_SET__ diff --git a/kite/src/kite/KiteEngine.h b/kite/src/kite/KiteEngine.h index 63a40493..7a633ebc 100644 --- a/kite/src/kite/KiteEngine.h +++ b/kite/src/kite/KiteEngine.h @@ -56,7 +56,6 @@ namespace Kite { using CRL::RoutingGauge; using Katabatic::KatabaticEngine; - class GCellGrid; class Track; class RoutingPlane; class NegociateWindow; @@ -93,7 +92,6 @@ namespace Kite { inline float getExpandStep () const; inline float getEdgeCapacityPercent () const; inline DbU::Unit getGlobalMinBreak ( unsigned int depth ) const; - inline GCellGrid* getGCellGrid () const; virtual const Name& getName () const; inline Configuration::PostEventCb_t& getPostEventCb (); @@ -149,7 +147,6 @@ namespace Kite { Net* _blockageNet; Configuration* _configuration; vector _routingPlanes; - GCellGrid* _kiteGrid; NegociateWindow* _negociateWindow; TrackElementLut _trackSegmentLut; double _minimumWL; @@ -179,7 +176,6 @@ namespace Kite { inline float KiteEngine::getEdgeCapacityPercent () const { return _configuration->getEdgeCapacityPercent(); } inline DbU::Unit KiteEngine::getGlobalMinBreak ( unsigned int depth ) const { return _configuration->getGlobalMinBreak(depth); } inline unsigned int KiteEngine::getRipupLimit ( unsigned int type ) const { return _configuration->getRipupLimit(type); } - inline GCellGrid* KiteEngine::getGCellGrid () const { return _kiteGrid; } inline NegociateWindow* KiteEngine::getNegociateWindow () { return _negociateWindow; } inline size_t KiteEngine::getRoutingPlanesSize () const { return _routingPlanes.size(); } inline void KiteEngine::setEventLimit ( unsigned long limit ) { _configuration->setEventsLimit(limit); } diff --git a/kite/src/kite/NegociateWindow.h b/kite/src/kite/NegociateWindow.h index f36633c6..7da3b6a8 100644 --- a/kite/src/kite/NegociateWindow.h +++ b/kite/src/kite/NegociateWindow.h @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved // // =================================================================== // @@ -26,6 +26,7 @@ #ifndef __KITE_NEGOCIATE_WINDOW__ #define __KITE_NEGOCIATE_WINDOW__ +#include #include #include @@ -40,18 +41,60 @@ namespace Hurricane { namespace Kite { - - using std::vector; - using std::queue; - using Hurricane::Cell; - using Katabatic::GridBox; - - class GCell; - class GCellRoutingSet; class TrackElement; class KiteEngine; +// ------------------------------------------------------------------- +// Class : "Statistics". + + + class Statistics { + public: + inline Statistics (); + inline size_t getGCellsCount () const; + inline size_t getSegmentsCount () const; + inline size_t getEventsCount () const; + inline void setGCellsCount ( size_t ); + inline void setSegmentsCount ( size_t ); + inline void setEventsCount ( size_t ); + inline void incGCellCount ( size_t ); + inline void incSegmentsCount ( size_t ); + inline void incEventsCount ( size_t ); + inline Statistics& operator+= ( const Statistics& ); + private: + size_t _gcellsCount; + size_t _segmentsCount; + size_t _eventsCount; + + }; + + + inline Statistics::Statistics () + : _gcellsCount (0) + , _segmentsCount (0) + , _eventsCount (0) + { } + + inline size_t Statistics::getGCellsCount () const { return _gcellsCount; } + inline size_t Statistics::getSegmentsCount () const { return _segmentsCount; } + inline size_t Statistics::getEventsCount () const { return _eventsCount; } + inline void Statistics::setGCellsCount ( size_t count ) { _gcellsCount = count; } + inline void Statistics::setSegmentsCount ( size_t count ) { _segmentsCount = count; } + inline void Statistics::setEventsCount ( size_t count ) { _eventsCount = count; } + inline void Statistics::incGCellCount ( size_t count ) { _gcellsCount += count; } + inline void Statistics::incSegmentsCount ( size_t count ) { _segmentsCount += count; } + inline void Statistics::incEventsCount ( size_t count ) { _eventsCount += count; } + + inline Statistics& Statistics::operator+= ( const Statistics& other ) + { + _gcellsCount += other._gcellsCount; + _segmentsCount += other._segmentsCount; + _eventsCount += other._eventsCount; + return *this; + } + + // ------------------------------------------------------------------- // Class : "Kite::NegociateWindow". @@ -63,72 +106,44 @@ namespace Kite { , Packing }; public: - static NegociateWindow* create ( KiteEngine* kite - , unsigned int columnMin - , unsigned int rowMin - , unsigned int columnMax - , unsigned int rowMax - ); - void destroy (); - inline bool isInterrupted () const; - Cell* getCell () const; - inline GridBox* getGridBox () const; - inline KiteEngine* getKiteEngine () const; - inline RoutingEventQueue& getEventQueue (); - inline RoutingEventHistory& getEventHistory (); - inline const vector& - getGCellRoutingSets () const; - inline Stage getStage () const; - inline void setInterrupt ( bool ); - inline void setStage ( Stage ); - void loadRouting (); - void addInsertEvent ( TrackElement*, unsigned int level ); - inline void rescheduleEvent ( RoutingEvent*, unsigned int level ); - void run ( int slowMotion=0 ); - void addToRing ( TrackElement* ); - void printStatistics () const; - size_t _negociate ( const vector& ); - void _runOnGCellRoutingSet ( GCellRoutingSet* ); - void _loadRing (); - void _unloadRing (); - Record* _getRecord () const; - string _getString () const; - inline string _getTypeName () const; - - private: - class RingSegment { - public: - static bool orderReached ( const RingSegment& ); - public: - RingSegment ( TrackElement* segment=NULL ); - inline TrackElement* getSegment () const; - inline unsigned int getOrder () const; - private: - TrackElement* _segment; - unsigned int _order; - }; + static NegociateWindow* create ( KiteEngine* ); + void destroy (); + inline bool isInterrupted () const; + inline KiteEngine* getKiteEngine () const; + Hurricane::Cell* getCell () const; + inline const Katabatic::GCellVector& getGCells () const; + inline RoutingEventQueue& getEventQueue (); + inline RoutingEventHistory& getEventHistory (); + inline Stage getStage () const; + void setGCells ( const Katabatic::GCellVector& ); + inline void setInterrupt ( bool ); + inline void setStage ( Stage ); + double computeWirelength (); + TrackElement* addTrackSegment ( AutoSegment*, bool loading ); + void addInsertEvent ( TrackElement*, unsigned int level ); + inline void rescheduleEvent ( RoutingEvent*, unsigned int level ); + void run ( int slowMotion=0 ); + void printStatistics () const; + void _createRouting ( Katabatic::GCell* ); + size_t _negociate (); + Hurricane::Record* _getRecord () const; + std::string _getString () const; + inline std::string _getTypeName () const; private: // Attributes. - unsigned int _slowMotion; - bool _interrupt; - KiteEngine* _kite; - GridBox* _gridBox; - vector _criticalGCells; - unsigned int _gcellOrder; - vector _gcellRoutingSets; - RoutingEventQueue _eventQueue; - RoutingEventHistory _eventHistory; - vector _ring; + unsigned int _slowMotion; + bool _interrupt; + KiteEngine* _kite; + Katabatic::GCellVector _gcells; + std::vector _segments; + RoutingEventQueue _eventQueue; + RoutingEventHistory _eventHistory; + Statistics _statistics; // Constructors. protected: - NegociateWindow ( KiteEngine* kite - , unsigned int columnMin - , unsigned int rowMin - , unsigned int columnMax - , unsigned int rowMax - ); + NegociateWindow ( KiteEngine* ); ~NegociateWindow (); private: NegociateWindow ( const NegociateWindow& ); @@ -137,19 +152,14 @@ namespace Kite { // Inline Functions. - inline bool NegociateWindow::isInterrupted () const { return _interrupt; } - inline string NegociateWindow::_getTypeName () const { return "NegociateWindow"; } - inline GridBox* NegociateWindow::getGridBox () const { return _gridBox; } - inline KiteEngine* NegociateWindow::getKiteEngine () const { return _kite; } - inline RoutingEventQueue& NegociateWindow::getEventQueue () { return _eventQueue; } - inline RoutingEventHistory& NegociateWindow::getEventHistory () { return _eventHistory; } - inline void NegociateWindow::setInterrupt ( bool state ) { _interrupt = state; } - inline void NegociateWindow::rescheduleEvent ( RoutingEvent* event, unsigned int level ) { event->reschedule(_eventQueue,level); } - inline const vector& - NegociateWindow::getGCellRoutingSets () const { return _gcellRoutingSets; } - - inline TrackElement* NegociateWindow::RingSegment::getSegment () const { return _segment; } - inline unsigned int NegociateWindow::RingSegment::getOrder () const { return _order; } + inline bool NegociateWindow::isInterrupted () const { return _interrupt; } + inline KiteEngine* NegociateWindow::getKiteEngine () const { return _kite; } + inline const Katabatic::GCellVector& NegociateWindow::getGCells () const { return _gcells; } + inline RoutingEventQueue& NegociateWindow::getEventQueue () { return _eventQueue; } + inline RoutingEventHistory& NegociateWindow::getEventHistory () { return _eventHistory; } + inline void NegociateWindow::setInterrupt ( bool state ) { _interrupt = state; } + inline void NegociateWindow::rescheduleEvent ( RoutingEvent* event, unsigned int level ) { event->reschedule(_eventQueue,level); } + inline std::string NegociateWindow::_getTypeName () const { return "NegociateWindow"; } } // End of Kite namespace. diff --git a/kite/src/kite/RoutingEvent.h b/kite/src/kite/RoutingEvent.h index 7e68bc58..d5986e85 100644 --- a/kite/src/kite/RoutingEvent.h +++ b/kite/src/kite/RoutingEvent.h @@ -40,13 +40,10 @@ namespace Hurricane { namespace Kite { - using std::vector; - using Hurricane::DbU; using Hurricane::Interval; using Hurricane::Net; - class TrackElement; class Track; class RoutingEventHistory; @@ -122,7 +119,7 @@ namespace Kite { inline const Interval& getConstraints () const; inline const Interval& getOptimal () const; inline const Interval& getPerpandicular () const; - inline GCell* getShearGCell () const; + inline Katabatic::GCell* getShearGCell () const; inline float getPriority () const; inline unsigned int getTracksNb () const; inline unsigned int getTracksFree () const; @@ -176,7 +173,7 @@ namespace Kite { Interval _constraints; Interval _optimal; Interval _perpandicular; - GCell* _shearGCell; + Katabatic::GCell* _shearGCell; unsigned int _tracksNb : 6; unsigned int _tracksFree : 4; unsigned int _insertState : 6; @@ -212,7 +209,7 @@ namespace Kite { inline unsigned int RoutingEvent::getTracksNb () const { return _tracksNb; } inline unsigned int RoutingEvent::getTracksFree () const { return _tracksFree; } inline unsigned int RoutingEvent::getInsertState () const { return _insertState; } - inline GCell* RoutingEvent::getShearGCell () const { return _shearGCell; } + inline Katabatic::GCell* RoutingEvent::getShearGCell () const { return _shearGCell; } inline void RoutingEvent::setMode ( unsigned int mode ) { _mode = mode; } inline void RoutingEvent::setProcessed ( bool state ) { _processed = state; } inline void RoutingEvent::setDisabled ( bool state ) { _disabled = state; } diff --git a/kite/src/kite/Session.h b/kite/src/kite/Session.h index 9cd6f48a..0ba0d988 100644 --- a/kite/src/kite/Session.h +++ b/kite/src/kite/Session.h @@ -45,7 +45,6 @@ namespace Katabatic { namespace Kite { - using std::set; using std::vector; using std::string; @@ -58,7 +57,6 @@ namespace Kite { class Track; class TrackElement; class TrackMarker; - class GCell; class NegociateWindow; class Configuration; class KiteEngine; @@ -79,9 +77,7 @@ namespace Kite { inline static Net* getBlockageNet (); inline static NegociateWindow* getNegociateWindow (); inline static unsigned int getRipupCost (); - inline static GCell* getGCellUnder ( DbU::Unit, DbU::Unit ); - inline static unsigned int getOrder (); - inline static void setOrder ( unsigned int ); + inline static Katabatic::GCell* getGCellUnder ( DbU::Unit, DbU::Unit ); inline static void addInsertEvent ( TrackMarker* , Track* ); inline static void addInsertEvent ( TrackElement* , Track* ); inline static void addRemoveEvent ( TrackElement* ); @@ -94,16 +90,14 @@ namespace Kite { static void unlink ( TrackElement* ); static TrackElement* lookup ( Segment* ); static TrackElement* lookup ( AutoSegment* ); - static GCell* lookup ( Katabatic::GCell* ); + static Katabatic::GCell* lookup ( Katabatic::GCell* ); private: KiteEngine* _getKiteEngine (); Net* _getBlockageNet (); NegociateWindow* _getNegociateWindow (); unsigned int _getRipupCost (); - GCell* _getGCellUnder ( DbU::Unit, DbU::Unit ); - unsigned int _getOrder () const; - void _setOrder ( unsigned int ); - GCell* _lookup ( Katabatic::GCell* ); + Katabatic::GCell* _getGCellUnder ( DbU::Unit, DbU::Unit ); + Katabatic::GCell* _lookup ( Katabatic::GCell* ); void _addInsertEvent ( TrackMarker* , Track* ); void _addInsertEvent ( TrackElement* , Track* ); void _addRemoveEvent ( TrackElement* ); @@ -128,7 +122,6 @@ namespace Kite { protected: // Attributes. - unsigned int _order; vector _insertEvents; vector _removeEvents; set _sortEvents; @@ -175,15 +168,9 @@ namespace Kite { inline unsigned int Session::getRipupCost () { return get("getRipupCost()")->_getRipupCost(); } - inline GCell* Session::getGCellUnder ( DbU::Unit x, DbU::Unit y ) + inline Katabatic::GCell* Session::getGCellUnder ( DbU::Unit x, DbU::Unit y ) { return get("getGCellUnder()")->_getGCellUnder(x,y); } - inline unsigned int Session::getOrder () - { return get("getOrder()")->_getOrder(); } - - inline void Session::setOrder ( unsigned int order ) - { get("setOrder()")->_setOrder(order); } - inline void Session::addInsertEvent ( TrackMarker* marker, Track* track ) { get("addInsertEvent(TrackMarker*)")->_addInsertEvent(marker,track); } diff --git a/kite/src/kite/Track.h b/kite/src/kite/Track.h index 3f4680c8..43dc4574 100644 --- a/kite/src/kite/Track.h +++ b/kite/src/kite/Track.h @@ -97,8 +97,8 @@ namespace Kite { Track* getNext () const; Track* getPrevious () const; inline size_t getSize () const; - TrackElement* getNext ( size_t& index, Net*, bool useOrder=false ) const; - TrackElement* getPrevious ( size_t& index, Net*, bool useOrder=false ) const; + TrackElement* getNext ( size_t& index, Net* ) const; + TrackElement* getPrevious ( size_t& index, Net* ) const; TrackElement* getNextFixed ( size_t& index ) const; TrackElement* getSegment ( size_t index ) const; TrackElement* getSegment ( DbU::Unit position ) const; @@ -115,8 +115,8 @@ namespace Kite { virtual Point getPosition ( DbU::Unit coordinate ) const = 0; size_t find ( const TrackElement* ) const; Interval getFreeInterval ( DbU::Unit position, Net* net=NULL ) const; - Interval expandUsedInterval ( size_t& begin, size_t& end, bool useOrder=false ) const; - Interval expandFreeInterval ( size_t& begin, size_t& end, unsigned int state, Net*, bool useOrder=false ) const; + Interval expandUsedInterval ( size_t& begin, size_t& end ) const; + Interval expandFreeInterval ( size_t& begin, size_t& end, unsigned int state, Net* ) const; unsigned int checkOverlap ( unsigned int& overlaps ) const; void forceSort (); void insert ( TrackElement* ); diff --git a/kite/src/kite/TrackBlockage.h b/kite/src/kite/TrackBlockage.h deleted file mode 100644 index 97d3719e..00000000 --- a/kite/src/kite/TrackBlockage.h +++ /dev/null @@ -1,98 +0,0 @@ - - -// -*- C++ -*- -// -// This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved -// -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | -// | C O R I O L I S | -// | K i t e - D e t a i l e d R o u t e r | -// | | -// | Author : Jean-Paul CHAPUT | -// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | -// | =============================================================== | -// | C++ Header : "./TrackBlockage.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x - - - - -#ifndef __KITE_TRACK_OBSTACLE__ -#define __KITE_TRACK_OBSTACLE__ - - -#include "kite/TrackElement.h" - - -namespace Kite { - - - using std::string; - using std::map; - using Hurricane::Record; - using Hurricane::Interval; - using Hurricane::DbU; - using Hurricane::Net; - using Hurricane::Layer; - - class Track; - - -// ------------------------------------------------------------------- -// Class : "TrackBlockage". - - - class TrackBlockage : public TrackElement { - public: - static TrackElement* create ( Track*, Box& ); - public: - virtual AutoSegment* base () const; - virtual bool isFixed () const; - virtual bool isBlockage () const; - virtual bool isHorizontal () const; - virtual bool isVertical () const; - virtual unsigned long getId () const; - virtual unsigned int getDirection () const; - virtual Net* getNet () const; - virtual const Layer* getLayer () const; - virtual TrackElement* getNext () const; - virtual TrackElement* getPrevious () const; - virtual DbU::Unit getAxis () const; - virtual Interval getFreeInterval ( bool useOrder=false ) const; - virtual Record* _getRecord () const; - virtual string _getString () const; - virtual string _getTypeName () const; - - protected: - // Attributes. - Segment* _segment; - - protected: - // Constructors & Destructors. - TrackBlockage ( Track*, Box& ) ; - virtual ~TrackBlockage (); - virtual void _postCreate (); - virtual void _preDestroy (); - private: - TrackBlockage ( const TrackBlockage& ); - TrackBlockage& operator= ( const TrackBlockage& ); - - }; - - -} // End of Kite namespace. - - -INSPECTOR_P_SUPPORT(Kite::TrackBlockage); - - -# endif diff --git a/kite/src/kite/TrackElement.h b/kite/src/kite/TrackElement.h index f2adb519..fb344582 100644 --- a/kite/src/kite/TrackElement.h +++ b/kite/src/kite/TrackElement.h @@ -61,7 +61,6 @@ namespace Kite { class DataNegociate; class Track; class TrackCost; - class GCell; typedef map TrackElementLut; @@ -123,7 +122,7 @@ namespace Kite { virtual bool hasTargetDogLeg () const; virtual bool canDogLeg (); virtual bool canDogLeg ( Interval ); - virtual bool canDogLegAt ( GCell*, bool allowReuse=false ); + virtual bool canDogLegAt ( Katabatic::GCell*, bool allowReuse=false ); virtual unsigned long getId () const; virtual unsigned int getDirection () const = 0; virtual Net* getNet () const = 0; @@ -140,14 +139,13 @@ namespace Kite { inline DbU::Unit getSourceU () const; inline DbU::Unit getTargetU () const; inline DbU::Unit getLength () const; - virtual Interval getFreeInterval ( bool useOrder=false ) const; + virtual Interval getFreeInterval () const; inline Interval getCanonicalInterval () const; virtual Interval getSourceConstraints () const; virtual Interval getTargetConstraints () const; virtual DataNegociate* getDataNegociate () const; virtual TrackElement* getCanonical ( Interval& ); - virtual GCell* getGCell () const; - virtual size_t getGCells ( vector& ) const; + virtual size_t getGCells ( Katabatic::GCellVector& ) const; virtual TrackElement* getSourceDogLeg (); virtual TrackElement* getTargetDogLeg (); virtual TrackElements getCollapsedPerpandiculars (); @@ -166,11 +164,9 @@ namespace Kite { virtual void setRouted ( bool ); virtual void setTrack ( Track* ); inline void setIndex ( size_t ); - virtual void setGCell ( GCell* ); virtual void setArea (); virtual void setDogLegLevel ( unsigned int ); virtual void setDogLegOrder ( unsigned int ); - virtual void updateGCellsStiffness ( unsigned int ); virtual void swapTrack ( TrackElement* ); virtual void reschedule ( unsigned int level ); virtual void detach (); @@ -182,8 +178,8 @@ namespace Kite { virtual bool moveAside ( bool onLeft ); virtual TrackElement* makeDogLeg (); virtual TrackElement* makeDogLeg ( Interval, bool& leftDogleg ); - virtual TrackElement* makeDogLeg ( GCell* ); - virtual TrackElement* _postDogLeg ( GCell* ); + virtual TrackElement* makeDogLeg ( Katabatic::GCell* ); + virtual TrackElement* _postDogLeg ( Katabatic::GCell* ); virtual void _postModify (); virtual void desalignate (); virtual bool _check () const; diff --git a/kite/src/kite/TrackSegment.h b/kite/src/kite/TrackSegment.h index 9ba1d426..5a65b8e5 100644 --- a/kite/src/kite/TrackSegment.h +++ b/kite/src/kite/TrackSegment.h @@ -3,7 +3,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved // // =================================================================== // @@ -48,7 +48,6 @@ namespace Kite { class DataNegociate; class Track; class TrackCost; - class GCell; // ------------------------------------------------------------------- @@ -85,30 +84,26 @@ namespace Kite { virtual bool hasTargetDogLeg () const; virtual bool canDogLeg (); virtual bool canDogLeg ( Interval ); - virtual bool canDogLegAt ( GCell*, bool allowReuse=false ); + virtual bool canDogLegAt ( Katabatic::GCell*, bool allowReuse=false ); virtual unsigned long getId () const; virtual unsigned int getDirection () const; virtual Net* getNet () const; virtual const Layer* getLayer () const; virtual unsigned long getArea () const; virtual unsigned int getDogLegLevel () const; - virtual unsigned int getDogLegOrder () const; virtual TrackElement* getNext () const; virtual TrackElement* getPrevious () const; virtual DbU::Unit getAxis () const; - virtual Interval getFreeInterval ( bool useOrder=false ) const; + virtual Interval getFreeInterval () const; virtual Interval getSourceConstraints () const; virtual Interval getTargetConstraints () const; virtual DataNegociate* getDataNegociate () const; virtual TrackElement* getCanonical ( Interval& ); - virtual GCell* getGCell () const; - virtual size_t getGCells ( vector& ) const; + virtual size_t getGCells ( vector& ) const; virtual TrackElement* getSourceDogLeg (); virtual TrackElement* getTargetDogLeg (); virtual TrackElements getCollapsedPerpandiculars (); virtual size_t getPerpandicularsBound ( set& ); - virtual unsigned int getOrder () const; - virtual void updateGCellsStiffness ( unsigned int ); virtual void dataInvalidate (); virtual void eventInvalidate (); virtual void setAllowOutsideGCell ( bool ); @@ -119,10 +114,8 @@ namespace Kite { virtual void setLock ( bool ); virtual void setRouted ( bool ); virtual void setTrack ( Track* ); - virtual void setGCell ( GCell* ); virtual void setArea (); virtual void setDogLegLevel ( unsigned int ); - virtual void setDogLegOrder ( unsigned int ); virtual void swapTrack ( TrackElement* ); virtual void reschedule ( unsigned int level ); virtual void detach (); @@ -134,8 +127,8 @@ namespace Kite { virtual bool moveAside ( bool onLeft ); virtual TrackElement* makeDogLeg (); virtual TrackElement* makeDogLeg ( Interval, bool& leftDogleg ); - virtual TrackElement* makeDogLeg ( GCell* ); - virtual TrackElement* _postDogLeg ( GCell* ); + virtual TrackElement* makeDogLeg ( Katabatic::GCell* ); + virtual TrackElement* _postDogLeg (); virtual void _postModify (); virtual void desalignate (); virtual bool _check () const; @@ -146,7 +139,6 @@ namespace Kite { protected: // Attributes. AutoSegment* _base; - GCell* _gcell; bool _created; bool _lock; bool _revalidated; @@ -157,7 +149,6 @@ namespace Kite { unsigned long _area; DataNegociate* _data; unsigned int _dogLegLevel:4; - unsigned int _dogLegOrder:16; protected: // Constructors & Destructors.