diff --git a/anabatic/src/AutoSegment.cpp b/anabatic/src/AutoSegment.cpp index e3f1bade..d1829adc 100644 --- a/anabatic/src/AutoSegment.cpp +++ b/anabatic/src/AutoSegment.cpp @@ -1636,11 +1636,11 @@ namespace Anabatic { getGCells( gcells ); for ( size_t i=0 ; iflags() |= Flags::Invalidated; - cdebug_log(159,0) << "changeDepth() " << gcells[i] << this << " " << endl; + cdebug_log(149,0) << "changeDepth() " << gcells[i] << this << " " << endl; } if (not (flags & Flags::WithNeighbors)) { - cdebug_tabw(159,-1); + cdebug_tabw(149,-1); return; } diff --git a/anabatic/src/LayerAssign.cpp b/anabatic/src/LayerAssign.cpp index 1a2bd524..f9cd27ab 100644 --- a/anabatic/src/LayerAssign.cpp +++ b/anabatic/src/LayerAssign.cpp @@ -199,6 +199,119 @@ namespace Anabatic { } + void AnabaticEngine::_layerAssignNoGlobalM2V ( Net* net, set& globalNets, unsigned long& total, unsigned long& global ) + { + cdebug_log(149,0) << "Anabatic::_layerAssignNoGlobalM2V ( " << net << " )" << endl; + cdebug_tabw(145,1); + + bool isGlobalNet = false; + unsigned long netGlobal = 0; + unsigned long netTotal = 0; + set globalContacts; + + for ( Segment* baseSegment : net->getSegments() ) { + ++netTotal; + + AutoSegment* segment = Session::lookup( baseSegment ); + + if (not segment or segment->isLocal()) continue; + + isGlobalNet = true; + netTotal = 0; + globalNets.insert( net ); + break; + } + + if (isGlobalNet) { + vector horizontals; + + for ( Segment* baseSegment : net->getSegments() ) { + AutoSegment* segment = Session::lookup( baseSegment ); + if (not segment or not segment->isCanonical()) continue; + + if (segment->isHorizontal()) horizontals.push_back( segment ); + } + + for ( AutoSegment* horizontal : horizontals ) { + vector collapseds; + vector perpandiculars; + vector northBounds; + vector southBounds; + DbU::Unit leftBound; + DbU::Unit rightBound; + bool hasNorth = false; + bool hasSouth = false; + + AutoSegment::getTopologicalInfos( horizontal + , collapseds + , perpandiculars + , leftBound + , rightBound + ); + + for ( AutoSegment* perpandicular : perpandiculars ) { + if (Session::getLayerDepth(perpandicular->getLayer()) > 2) continue; + + bool hasGlobal = false; + for ( AutoSegment* aligned : perpandicular->getAligneds(Flags::NoCheckLayer|Flags::WithSelf) ) { + if (aligned->isGlobal()) { hasGlobal = true; break; } + } + if (not hasGlobal) continue; + + // if (perpandicular->getSourceY() == horizontal->getAxis()) { + // hasNorth = true; + // if (hasGlobal) northBounds.push_back( perpandicular ); + // } else { + // hasSouth = true; + // if (hasGlobal) southBounds.push_back( perpandicular ); + // } + + if ( perpandicular->getAutoSource()->getGCell()->getNorth() + != perpandicular->getAutoTarget()->getGCell()) { + perpandicular->changeDepth( 3, Flags::Propagate ); + ++netGlobal; + continue; + } + } + + // if (hasSouth and hasNorth) { + // if (not northBounds.empty()) { + // for ( AutoSegment* perpandicular : northBounds ) + // perpandicular->changeDepth( 3, Flags::Propagate ); + // } else { + // for ( AutoSegment* perpandicular : southBounds ) + // perpandicular->changeDepth( 3, Flags::Propagate ); + // } + // } + } + } + + total += netTotal; + global += netGlobal; + + cdebug_tabw(145,-1); + } + + + void AnabaticEngine::_layerAssignNoGlobalM2V ( unsigned long& total, unsigned long& global, set& globalNets ) + { + cmess1 << " o Assign Layer (no global vertical metal2)." << endl; + + for ( Net* net : getCell()->getNets() ) { + DebugSession::open( net, 145, 150 ); + + NetRoutingState* state = NetRoutingExtension::get( net ); + if (not state or state->isAutomaticGlobalRoute()) { + _layerAssignNoGlobalM2V( net, globalNets, total, global ); + } else { + cdebug_log(145,0) << net << " is not automatic routed, skipped." << endl; + } + + DebugSession::close(); + } + } + + #if THIS_IS_DISABLED void AnabaticEngine::moveULeft ( AutoSegment* seed, set& globalNets, GCell::Set& invalidateds ) { @@ -486,8 +599,9 @@ namespace Anabatic { if (Session::getAllowedDepth() >= 3) { switch ( method ) { - case EngineLayerAssignByLength: _layerAssignByLength( total, global, globalNets ); break; - case EngineLayerAssignByTrunk: _layerAssignByTrunk ( total, global, globalNets ); break; + case EngineLayerAssignByLength: _layerAssignByLength ( total, global, globalNets ); break; + case EngineLayerAssignByTrunk: _layerAssignByTrunk ( total, global, globalNets ); break; + case EngineLayerAssignNoGlobalM2V: _layerAssignNoGlobalM2V ( total, global, globalNets ); break; case EngineNoNetLayerAssign: break; default: stopMeasures(); diff --git a/anabatic/src/NetBuilderVH.cpp b/anabatic/src/NetBuilderVH.cpp index 67fc1628..9d895e5d 100644 --- a/anabatic/src/NetBuilderVH.cpp +++ b/anabatic/src/NetBuilderVH.cpp @@ -79,7 +79,6 @@ namespace Anabatic { Point sourcePosition; Point targetPosition; - Net* net = rp->getNet(); const Layer* rpLayer = rp->getLayer(); size_t rpDepth = Session::getLayerDepth( rp->getLayer() ); Flags direction = Session::getDirection ( rpDepth ); diff --git a/anabatic/src/PyAnabatic.cpp b/anabatic/src/PyAnabatic.cpp index a467519a..57614ac0 100644 --- a/anabatic/src/PyAnabatic.cpp +++ b/anabatic/src/PyAnabatic.cpp @@ -71,11 +71,12 @@ extern "C" { PyObject* dictionnary = PyModule_GetDict(module); PyObject* constant; - LoadObjectConstant( dictionnary,EngineLoadGrByNet ,"EngineLoadGrByNet" ); - LoadObjectConstant( dictionnary,EngineLoadGrByGCell ,"EngineLoadGrByGCell" ); - LoadObjectConstant( dictionnary,EngineLayerAssignByLength,"EngineLayerAssignByLength" ); - LoadObjectConstant( dictionnary,EngineLayerAssignByTrunk ,"EngineLayerAssignByTrunk" ); - LoadObjectConstant( dictionnary,EngineNoNetLayerAssign ,"EngineNoNetLayerAssign" ); + LoadObjectConstant( dictionnary,EngineLoadGrByNet ,"EngineLoadGrByNet" ); + LoadObjectConstant( dictionnary,EngineLoadGrByGCell ,"EngineLoadGrByGCell" ); + LoadObjectConstant( dictionnary,EngineLayerAssignByLength ,"EngineLayerAssignByLength" ); + LoadObjectConstant( dictionnary,EngineLayerAssignByTrunk ,"EngineLayerAssignByTrunk" ); + LoadObjectConstant( dictionnary,EngineLayerAssignNoGlobalM2V,"EngineLayerAssignNoGlobalM2V" ); + LoadObjectConstant( dictionnary,EngineNoNetLayerAssign ,"EngineNoNetLayerAssign" ); } diff --git a/anabatic/src/anabatic/AnabaticEngine.h b/anabatic/src/anabatic/AnabaticEngine.h index 9c1ec782..8868ab74 100644 --- a/anabatic/src/anabatic/AnabaticEngine.h +++ b/anabatic/src/anabatic/AnabaticEngine.h @@ -179,123 +179,125 @@ namespace Anabatic { public: typedef ToolEngine Super; public: - static AnabaticEngine* create ( Cell* ); - static AnabaticEngine* get ( const Cell* ); - static const Name& staticGetName (); - virtual const Name& getName () const; - virtual Configuration* getConfiguration (); - inline uint64_t getDensityMode () const; - inline CellViewer* getViewer () const; - inline void setViewer ( CellViewer* ); - inline EngineState getState () const; - inline const Matrix* getMatrix () const; - inline const vector& getGCells () const; - inline const vector& getOvEdges () const; - inline GCell* getSouthWestGCell () const; - inline GCell* getGCellUnder ( DbU::Unit x, DbU::Unit y ) const; - inline GCell* getGCellUnder ( Point ) const; - inline GCellsUnder getGCellsUnder ( Segment* ) const; - Interval getUSide ( Flags direction ) const; - int getCapacity ( Interval, Flags ) const; - size_t getNetsFromEdge ( const Edge*, NetSet& ); - virtual void openSession (); - inline void setState ( EngineState state ); - inline void setDensityMode ( uint64_t ); - inline void addOv ( Edge* ); - inline void removeOv ( Edge* ); - inline const NetDatas& getNetDatas () const; - NetData* getNetData ( Net*, Flags flags=Flags::NoFlags ); - void setupNetDatas (); - void updateMatrix (); - // Dijkstra related functions. - inline int getStamp () const; - inline int incStamp (); - Contact* breakAt ( Segment*, GCell* ); - void ripup ( Segment*, Flags ); - bool unify ( Contact* ); - // Global routing related functions. - void globalRoute (); - void cleanupGlobal (); - void relaxOverConstraineds (); - // Detailed routing related functions. - inline bool isInDemoMode () const; - inline bool isChip () const; - inline bool doWarnOnGCellOverload () const; - inline bool doDestroyBaseContact () const; - inline bool doDestroyBaseSegment () const; - inline bool doDestroyTool () const; - inline DbU::Unit getGlobalThreshold () const; - inline float getSaturateRatio () const; - inline size_t getSaturateRp () const; - inline DbU::Unit getExtensionCap () const; - inline Net* getBlockageNet () const; - inline const ChipTools& getChipTools () const; - inline const vector& getNetOrdering () const; - void invalidateRoutingPads (); - void updateDensity (); - size_t checkGCellDensities (); - inline void setGlobalThreshold ( DbU::Unit ); - inline void setSaturateRatio ( float ); - inline void setSaturateRp ( size_t ); - inline void setBlockageNet ( Net* ); - void chipPrep (); - void setupSpecialNets (); - size_t setupPreRouteds (); - void loadGlobalRouting ( uint32_t method ); - void computeNetConstraints ( Net* ); - void toOptimals ( Net* ); - void updateNetTopology ( Net* ); - bool moveUpNetTrunk ( AutoSegment*, set& globalNets, GCell::Set& invalidateds ); - void layerAssign ( uint32_t method ); - void finalizeLayout (); - inline const AutoContactLut& _getAutoContactLut () const; - inline const AutoSegmentLut& _getAutoSegmentLut () const; - void _link ( AutoContact* ); - void _link ( AutoSegment* ); - void _unlink ( AutoContact* ); - void _unlink ( AutoSegment* ); - AutoContact* _lookup ( Contact* ) const; - AutoSegment* _lookup ( Segment* ) const; - EdgeCapacity* _createCapacity ( Flags, Interval ); - size_t _unrefCapacity ( EdgeCapacity* ); - void _loadGrByNet (); - void _computeNetOptimals ( Net* ); - void _computeNetTerminals ( Net* ); - void _alignate ( Net* ); - void _desaturate ( unsigned int depth, set&, unsigned long& total, unsigned long& globals ); - void _layerAssignByLength ( unsigned long& total, unsigned long& global, set& ); - void _layerAssignByLength ( Net*, unsigned long& total, unsigned long& global, set& ); - void _layerAssignByTrunk ( unsigned long& total, unsigned long& global, set& ); - void _layerAssignByTrunk ( Net*, set&, unsigned long& total, unsigned long& global ); - void _saveNet ( Net* ); - void _destroyAutoContacts (); - void _destroyAutoSegments (); - void _check ( Net* net ) const; - bool _check ( const char* message ) const; - void printMeasures ( const string& tag ) const; - // Misc. functions. - inline const Flags& flags () const; - inline Flags& flags (); - void reset (); - inline void _add ( GCell* ); - inline void _remove ( GCell* ); - inline void _updateLookup ( GCell* ); - inline void _updateGContacts ( Flags flags=Flags::Horizontal|Flags::Vertical ); - inline void _resizeMatrix (); - inline bool _inDestroy () const; - // Inspector support. - virtual Record* _getRecord () const; - virtual string _getString () const; - virtual string _getTypeName () const; - protected: - AnabaticEngine ( Cell* ); - virtual ~AnabaticEngine (); - virtual void _postCreate (); - virtual void _preDestroy (); - void _gutAnabatic (); - private: - AnabaticEngine ( const AnabaticEngine& ); - AnabaticEngine& operator= ( const AnabaticEngine& ); + static AnabaticEngine* create ( Cell* ); + static AnabaticEngine* get ( const Cell* ); + static const Name& staticGetName (); + virtual const Name& getName () const; + virtual Configuration* getConfiguration (); + inline uint64_t getDensityMode () const; + inline CellViewer* getViewer () const; + inline void setViewer ( CellViewer* ); + inline EngineState getState () const; + inline const Matrix* getMatrix () const; + inline const vector& getGCells () const; + inline const vector& getOvEdges () const; + inline GCell* getSouthWestGCell () const; + inline GCell* getGCellUnder ( DbU::Unit x, DbU::Unit y ) const; + inline GCell* getGCellUnder ( Point ) const; + inline GCellsUnder getGCellsUnder ( Segment* ) const; + Interval getUSide ( Flags direction ) const; + int getCapacity ( Interval, Flags ) const; + size_t getNetsFromEdge ( const Edge*, NetSet& ); + virtual void openSession (); + inline void setState ( EngineState state ); + inline void setDensityMode ( uint64_t ); + inline void addOv ( Edge* ); + inline void removeOv ( Edge* ); + inline const NetDatas& getNetDatas () const; + NetData* getNetData ( Net*, Flags flags=Flags::NoFlags ); + void setupNetDatas (); + void updateMatrix (); + // Dijkstra related functions. + inline int getStamp () const; + inline int incStamp (); + Contact* breakAt ( Segment*, GCell* ); + void ripup ( Segment*, Flags ); + bool unify ( Contact* ); + // Global routing related functions. + void globalRoute (); + void cleanupGlobal (); + void relaxOverConstraineds (); + // Detailed routing related functions. + inline bool isInDemoMode () const; + inline bool isChip () const; + inline bool doWarnOnGCellOverload () const; + inline bool doDestroyBaseContact () const; + inline bool doDestroyBaseSegment () const; + inline bool doDestroyTool () const; + inline DbU::Unit getGlobalThreshold () const; + inline float getSaturateRatio () const; + inline size_t getSaturateRp () const; + inline DbU::Unit getExtensionCap () const; + inline Net* getBlockageNet () const; + inline const ChipTools& getChipTools () const; + inline const vector& getNetOrdering () const; + void invalidateRoutingPads (); + void updateDensity (); + size_t checkGCellDensities (); + inline void setGlobalThreshold ( DbU::Unit ); + inline void setSaturateRatio ( float ); + inline void setSaturateRp ( size_t ); + inline void setBlockageNet ( Net* ); + void chipPrep (); + void setupSpecialNets (); + size_t setupPreRouteds (); + void loadGlobalRouting ( uint32_t method ); + void computeNetConstraints ( Net* ); + void toOptimals ( Net* ); + void updateNetTopology ( Net* ); + bool moveUpNetTrunk ( AutoSegment*, set& globalNets, GCell::Set& invalidateds ); + void layerAssign ( uint32_t method ); + void finalizeLayout (); + inline const AutoContactLut& _getAutoContactLut () const; + inline const AutoSegmentLut& _getAutoSegmentLut () const; + void _link ( AutoContact* ); + void _link ( AutoSegment* ); + void _unlink ( AutoContact* ); + void _unlink ( AutoSegment* ); + AutoContact* _lookup ( Contact* ) const; + AutoSegment* _lookup ( Segment* ) const; + EdgeCapacity* _createCapacity ( Flags, Interval ); + size_t _unrefCapacity ( EdgeCapacity* ); + void _loadGrByNet (); + void _computeNetOptimals ( Net* ); + void _computeNetTerminals ( Net* ); + void _alignate ( Net* ); + void _desaturate ( unsigned int depth, set&, unsigned long& total, unsigned long& globals ); + void _layerAssignByLength ( unsigned long& total, unsigned long& global, set& ); + void _layerAssignByLength ( Net*, unsigned long& total, unsigned long& global, set& ); + void _layerAssignByTrunk ( unsigned long& total, unsigned long& global, set& ); + void _layerAssignByTrunk ( Net*, set&, unsigned long& total, unsigned long& global ); + void _layerAssignNoGlobalM2V ( unsigned long& total, unsigned long& global, set& ); + void _layerAssignNoGlobalM2V ( Net*, set&, unsigned long& total, unsigned long& global ); + void _saveNet ( Net* ); + void _destroyAutoContacts (); + void _destroyAutoSegments (); + void _check ( Net* net ) const; + bool _check ( const char* message ) const; + void printMeasures ( const string& tag ) const; + // Misc. functions. + inline const Flags& flags () const; + inline Flags& flags (); + void reset (); + inline void _add ( GCell* ); + inline void _remove ( GCell* ); + inline void _updateLookup ( GCell* ); + inline void _updateGContacts ( Flags flags=Flags::Horizontal|Flags::Vertical ); + inline void _resizeMatrix (); + inline bool _inDestroy () const; + // Inspector support. + virtual Record* _getRecord () const; + virtual string _getString () const; + virtual string _getTypeName () const; + protected: + AnabaticEngine ( Cell* ); + virtual ~AnabaticEngine (); + virtual void _postCreate (); + virtual void _preDestroy (); + void _gutAnabatic (); + private: + AnabaticEngine ( const AnabaticEngine& ); + AnabaticEngine& operator= ( const AnabaticEngine& ); private: static Name _toolName; Configuration* _configuration; diff --git a/anabatic/src/anabatic/Constants.h b/anabatic/src/anabatic/Constants.h index 285c155d..4c7f3014 100644 --- a/anabatic/src/anabatic/Constants.h +++ b/anabatic/src/anabatic/Constants.h @@ -122,11 +122,12 @@ namespace Anabatic { , EngineGutted = 6 }; - enum EngineAlgorithm { EngineLoadGrByNet = (1 << 0) - , EngineLoadGrByGCell = (1 << 1) - , EngineLayerAssignByLength = (1 << 2) - , EngineLayerAssignByTrunk = (1 << 3) - , EngineNoNetLayerAssign = (1 << 4) + enum EngineAlgorithm { EngineLoadGrByNet = (1 << 0) + , EngineLoadGrByGCell = (1 << 1) + , EngineLayerAssignByLength = (1 << 2) + , EngineLayerAssignByTrunk = (1 << 3) + , EngineLayerAssignNoGlobalM2V = (1 << 4) + , EngineNoNetLayerAssign = (1 << 5) }; diff --git a/katana/src/Manipulator.cpp b/katana/src/Manipulator.cpp index 41f57da1..a358cee5 100644 --- a/katana/src/Manipulator.cpp +++ b/katana/src/Manipulator.cpp @@ -188,8 +188,19 @@ namespace Katana { track = perpandiculars[i]->getTrack(); if (not track) { // The perpandicular is not placed yet. - if (flags & Manipulator::PerpandicularsFirst) { - _fsm.addAction( perpandiculars[i], perpandicularActionFlags ); + if (perpandiculars[i]->isFixedAxis()) { + RoutingPlane* plane = Session::getKatanaEngine()->getRoutingPlaneByLayer(perpandiculars[i]->getLayer()); + Track* track = plane->getTrackByPosition( perpandiculars[i]->getAxis() ); + if (track) { + TrackElement* other = track->getSegment( _segment->getAxis() ); + if (other and (other->getNet() != _segment->getNet()) ) { + _fsm.addAction( other, SegmentAction::OtherRipup ); + } + } + } else { + if (flags & Manipulator::PerpandicularsFirst) { + _fsm.addAction( perpandiculars[i], perpandicularActionFlags ); + } } continue; } diff --git a/katana/src/SegmentFsm.cpp b/katana/src/SegmentFsm.cpp index 51bcb13d..ef42fa36 100644 --- a/katana/src/SegmentFsm.cpp +++ b/katana/src/SegmentFsm.cpp @@ -908,7 +908,12 @@ namespace Katana { cdebug_log(159,0) << "* " << track << " [" << begin << ":" << end << "]" << endl; for ( ; (begin < end) ; ++begin ) { - other = track->getSegment( begin ); + other = track->getSegment( begin ); + otherIsGlobal = otherIsGlobal + or other->isGlobal() + or other->isBlockage() + or other->isFixed() + or other->isFixedAxis(); if (other->getNet() == segment->getNet()) { cdebug_log(159,0) << " | " << begin << " Same net: " << " " << other << endl; @@ -935,7 +940,7 @@ namespace Katana { otherIsGlobal = other->isGlobal() or other->isBlockage() or other->isFixed(); } else { otherOverlap.merge(other->getCanonicalInterval()); - otherIsGlobal = otherIsGlobal or other->isGlobal() or other->isBlockage() or other->isFixed(); + otherIsGlobal = otherIsGlobal or other->isGlobal() or other->isBlockage() or other->isFixed() or other->isFixedAxis(); } } if (not otherOverlap.isEmpty()) {