diff --git a/katana/src/DataNegociate.cpp b/katana/src/DataNegociate.cpp index a938401f..6e59edee 100644 --- a/katana/src/DataNegociate.cpp +++ b/katana/src/DataNegociate.cpp @@ -131,7 +131,7 @@ namespace Katana { continue; } - if (RoutingEvent::getStage() == RoutingEvent::Repair) + if (RoutingEvent::getStage() == StageRepair) perpandicular->base()->setFlagsOnAligneds( AutoSegment::SegUnbound ); //cerr << "perpandicular:" << perpandicular << endl; @@ -169,7 +169,8 @@ namespace Katana { if (not source->canDrag() and not target->canDrag()) perpandicular->base()->getCanonical( trackFree ); - trackFree.inflate( 1*pitch, 1*pitch ); + if (Session::getStage() < StagePack) + trackFree.inflate( 1*pitch, 1*pitch ); cdebug_log(159,0) << "Non-Pref Track Perpandicular Free: " << trackFree << endl; //_perpandicularFree.intersection diff --git a/katana/src/KatanaEngine.cpp b/katana/src/KatanaEngine.cpp index e8766df4..4399a163 100644 --- a/katana/src/KatanaEngine.cpp +++ b/katana/src/KatanaEngine.cpp @@ -196,6 +196,7 @@ namespace Katana { , _shortDoglegs () , _symmetrics () , _mode (DigitalMode) + , _stage (StageNegociate) , _successState (0) { //Entity::setMemoryLimit( 1024 ); // 1Gb. diff --git a/katana/src/Manipulator.cpp b/katana/src/Manipulator.cpp index 67cfaeb4..1e229620 100644 --- a/katana/src/Manipulator.cpp +++ b/katana/src/Manipulator.cpp @@ -1671,7 +1671,7 @@ namespace Katana { if (not data) continue; if (data->getState() >= DataNegociate::RepairFailed) continue; - if (RoutingEvent::getStage() == RoutingEvent::Repair) { + if (RoutingEvent::getStage() == StageRepair) { if (_segment->getDataNegociate()->getState() < DataNegociate::Repair) _segment->getDataNegociate()->resetRipupCount(); diff --git a/katana/src/NegociateWindow.cpp b/katana/src/NegociateWindow.cpp index d73509f8..14b959c5 100644 --- a/katana/src/NegociateWindow.cpp +++ b/katana/src/NegociateWindow.cpp @@ -510,8 +510,7 @@ namespace Katana { void NegociateWindow::_pack ( size_t& count, bool last ) { uint64_t limit = _katana->getEventsLimit(); - uint32_t pushStage = RoutingEvent::getStage(); - RoutingEvent::setStage( RoutingEvent::Pack ); + _katana->setStage( StagePack ); RoutingEventQueue packQueue; //for ( size_t i = (count > 600) ? count-600 : 0 @@ -554,8 +553,6 @@ namespace Katana { if (RoutingEvent::getProcesseds() >= limit) setInterrupt( true ); } // Count will be wrong! - - RoutingEvent::setStage( pushStage ); } @@ -578,7 +575,7 @@ namespace Katana { if (cdebug.enabled(9000)) _eventQueue.dump(); size_t count = 0; - RoutingEvent::setStage( RoutingEvent::Negociate ); + _katana->setStage( StageNegociate ); while ( not _eventQueue.empty() and not isInterrupted() ) { RoutingEvent* event = _eventQueue.pop(); @@ -642,7 +639,7 @@ namespace Katana { cmess1 << " o Repair Stage." << endl; cdebug_log(159,0) << "Loadind Repair queue." << endl; - RoutingEvent::setStage( RoutingEvent::Repair ); + _katana->setStage( StageRepair ); for ( size_t i=0 ; (i<_eventHistory.size()) and not isInterrupted() ; i++ ) { RoutingEvent* event = _eventHistory.getNth(i); @@ -685,7 +682,7 @@ namespace Katana { cmess1 << " o Realign Stage." << endl; cdebug_log(159,0) << "Loadind realign queue." << endl; - RoutingEvent::setStage( RoutingEvent::Realign ); + _katana->setStage( StageRealign ); for ( size_t i=0 ; (i<_eventHistory.size()) and not isInterrupted() ; i++ ) { RoutingEvent* event = _eventHistory.getNth(i); if (not event->isCloned() and event->getSegment()->canRealign()) diff --git a/katana/src/RoutingEvent.cpp b/katana/src/RoutingEvent.cpp index 45dddea9..6fdd0181 100644 --- a/katana/src/RoutingEvent.cpp +++ b/katana/src/RoutingEvent.cpp @@ -173,21 +173,19 @@ namespace Katana { uint32_t RoutingEvent::_idCounter = 0; - uint32_t RoutingEvent::_stage = RoutingEvent::Negociate; uint32_t RoutingEvent::_allocateds = 0; uint32_t RoutingEvent::_processeds = 0; uint32_t RoutingEvent::_cloneds = 0; - uint32_t RoutingEvent::getStage () { return _stage; } + uint32_t RoutingEvent::getStage () { return Session::getStage(); } uint32_t RoutingEvent::getAllocateds () { return _allocateds; } uint32_t RoutingEvent::getProcesseds () { return _processeds; } uint32_t RoutingEvent::getCloneds () { return _cloneds; } - void RoutingEvent::setStage ( uint32_t stage ) { _stage = stage; } void RoutingEvent::resetProcesseds () { _processeds = 0; } - RoutingEvent::RoutingEvent ( TrackElement* segment, uint32_t mode ) + RoutingEvent::RoutingEvent ( TrackElement* segment ) : _cloned (false) , _processed (false) , _disabled (false) @@ -205,7 +203,6 @@ namespace Katana { , _tracksNb (0) , _tracksFree (0) , _insertState (0) - , _mode (mode) , _rippleState (0) , _eventLevel (0) , _key (this) @@ -229,7 +226,7 @@ namespace Katana { } - RoutingEvent* RoutingEvent::create ( TrackElement* segment, uint32_t mode ) + RoutingEvent* RoutingEvent::create ( TrackElement* segment ) { // if (not dynamic_cast(segment)) { // cerr << Error( "RoutingEvent::create() Can only create event from TrackSegment:\n" @@ -237,7 +234,7 @@ namespace Katana { // ) << endl; // } - RoutingEvent* event = new RoutingEvent ( segment, mode ); + RoutingEvent* event = new RoutingEvent ( segment ); ++_allocateds; return event; @@ -286,10 +283,6 @@ namespace Katana { { return getState() == DataNegociate::Unimplemented; } - void RoutingEvent::setMode ( uint32_t mode ) - { _mode = mode; } - - uint32_t RoutingEvent::getState () const { DataNegociate* data = _segment->getDataNegociate(); @@ -313,7 +306,7 @@ namespace Katana { void RoutingEvent::setAxisHintFromParent () { - if (getStage() == Repair) return; + if (Session::getStage() == StageRepair) return; TrackElement* parent = _segment->getParent(); if (not parent) return; @@ -348,7 +341,7 @@ namespace Katana { return NULL; } - if ( (getStage() != Repair) and isUnimplemented() ) { + if ( (Session::getStage() != StageRepair) and isUnimplemented() ) { cdebug_log(159,0) << "Reschedule: cancelled (Unimplemented) -> " << fork << endl; return NULL; } @@ -370,15 +363,10 @@ namespace Katana { if (fork->_eventLevel < eventLevel) fork->_eventLevel = eventLevel; - if (getStage() == Repair) { - fork->setMode( RoutingEvent::Repair ); + if (Session::getStage() == StageRepair) { if (_segment->getDataNegociate()->getState() < DataNegociate::Repair) _segment->getDataNegociate()->resetRipupCount(); _segment->getDataNegociate()->setState( DataNegociate::Repair ); - } else if (getStage() == RoutingEvent::Pack) { - fork->setMode( RoutingEvent::Pack ); - } else if (getStage() == RoutingEvent::Realign) { - fork->setMode( RoutingEvent::Realign ); } queue.repush( fork ); @@ -457,7 +445,7 @@ namespace Katana { //_preCheck( _segment ); _eventLevel = 0; - if (_mode != Pack) history.push( this ); + if (Session::getStage() != StagePack) history.push( this ); if ( isProcessed() or isDisabled() ) { cdebug_log(159,0) << "Already processed or disabled." << endl; @@ -468,13 +456,13 @@ namespace Katana { setProcessed(); setTimeStamp( _processeds ); - switch ( _mode ) { - case Negociate: _processNegociate( queue, history ); break; - case Pack: _processPack ( queue, history ); break; - case Repair: _processRepair ( queue, history ); break; - case Realign: _processRealign ( queue, history ); break; + switch ( Session::getStage() ) { + case StageNegociate: _processNegociate( queue, history ); break; + case StagePack: _processPack ( queue, history ); break; + case StageRepair: _processRepair ( queue, history ); break; + case StageRealign: _processRealign ( queue, history ); break; default: - cerr << Bug( "RoutingEvent::process() - Unknown mode value:%d.", _mode ) << endl; + cerr << Bug( "RoutingEvent::process() - Unknown stage value:%d.", Session::getStage() ) << endl; break; } } @@ -707,7 +695,7 @@ namespace Katana { _segment->base()->getOptimal ( _optimal ); cdebug_log(159,0) << "Stage:" << RoutingEvent::getStage() << endl; - if (RoutingEvent::getStage() == RoutingEvent::Repair) { + if (Session::getStage() == StageRepair) { if (_segment->isStrongTerminal(Flags::Propagate)) { cdebug_log(159,0) << "Not expanding on Terminals:" << _constraints << endl; } else if ( _segment->base()->getAutoSource()->isFixed() diff --git a/katana/src/RoutingEventQueue.cpp b/katana/src/RoutingEventQueue.cpp index ca208c3c..063a7086 100644 --- a/katana/src/RoutingEventQueue.cpp +++ b/katana/src/RoutingEventQueue.cpp @@ -66,7 +66,7 @@ namespace Katana { cinfo << "[INFO] Already in Track - " << segments[i] << endl; continue; } - RoutingEvent* event = RoutingEvent::create(segments[i]); + RoutingEvent* event = RoutingEvent::create( segments[i] ); event->updateKey(); _events.insert( event ); } diff --git a/katana/src/SegmentFsm.cpp b/katana/src/SegmentFsm.cpp index e4f1a932..09c2be30 100644 --- a/katana/src/SegmentFsm.cpp +++ b/katana/src/SegmentFsm.cpp @@ -434,13 +434,6 @@ namespace Katana { RoutingEvent* fork = event->reschedule( queue, eventLevel ); - if (fork) { - uint32_t mode = RoutingEvent::Repair; - if (RoutingEvent::getStage() < RoutingEvent::Repair) - mode = (_type&PackingMode) ? RoutingEvent::Pack : RoutingEvent::Negociate; - fork->setMode( mode ); - } - cdebug_tabw(159,-1); DebugSession::close(); return true; @@ -636,8 +629,8 @@ namespace Katana { and (_data1->getState() < DataNegociate::Minimize) and (_data1->getRipupCount() < 5)) ? TrackCost::DiscardGlobals : 0; - flags |= (RoutingEvent::getStage() == RoutingEvent::Repair ) ? TrackCost::IgnoreSharedLength : 0; - flags |= (RoutingEvent::getStage() == RoutingEvent::Realign) ? TrackCost::IgnoreTerminals : 0; + flags |= (Session::getStage() == StageRepair ) ? TrackCost::IgnoreSharedLength : 0; + flags |= (Session::getStage() == StageRealign) ? TrackCost::IgnoreTerminals : 0; if (flags & TrackCost::DiscardGlobals) { cdebug_log(159,0) << "TrackCost::Compare() - DiscardGlobals" << endl; diff --git a/katana/src/Session.cpp b/katana/src/Session.cpp index 5ce674e6..fceef318 100644 --- a/katana/src/Session.cpp +++ b/katana/src/Session.cpp @@ -146,6 +146,10 @@ namespace Katana { { return Session::getKatanaEngine()->getConfiguration(); } + uint32_t Session::getStage () + { return get("getStage()")->_getKatanaEngine()->getStage(); } + + AutoContact* Session::lookup ( Contact* contact ) { return Super::lookup(contact); } @@ -476,6 +480,10 @@ namespace Katana { } + void Session::setStage ( uint32_t stage ) + { get("setStage()")->_getKatanaEngine()->setStage(stage); } + + string Session::_getTypeName () const { return "Katana::Session"; } diff --git a/katana/src/katana/Constants.h b/katana/src/katana/Constants.h index c3aa32c9..46934281 100644 --- a/katana/src/katana/Constants.h +++ b/katana/src/katana/Constants.h @@ -19,6 +19,12 @@ namespace Katana { + + static const uint32_t StageNegociate = 1; + static const uint32_t StagePack = 2; + static const uint32_t StageRepair = 3; + static const uint32_t StageRealign = 4; + class Flags : public Anabatic::Flags { public: diff --git a/katana/src/katana/DataNegociate.h b/katana/src/katana/DataNegociate.h index ca7454e8..1a85353a 100644 --- a/katana/src/katana/DataNegociate.h +++ b/katana/src/katana/DataNegociate.h @@ -14,9 +14,7 @@ // +-----------------------------------------------------------------+ -#ifndef KATANA_DATA_NEGOCIATE_H -#define KATANA_DATA_NEGOCIATE_H - +#pragma once #include #include @@ -169,5 +167,3 @@ namespace Katana { INSPECTOR_P_SUPPORT(Katana::DataNegociate); - -#endif // KATANA_DATA_NEGOCIATE_H diff --git a/katana/src/katana/KatanaEngine.h b/katana/src/katana/KatanaEngine.h index ff2888e4..a1a9c64f 100644 --- a/katana/src/katana/KatanaEngine.h +++ b/katana/src/katana/KatanaEngine.h @@ -84,6 +84,7 @@ namespace Katana { inline Configuration* getKatanaConfiguration (); virtual Configuration* getConfiguration (); inline uint32_t getSuccessState () const; + inline uint32_t getStage () const; inline uint64_t getEventsLimit () const; inline uint32_t getRipupLimit ( uint32_t type ) const; uint32_t getRipupLimit ( const TrackElement* ) const; @@ -113,6 +114,7 @@ namespace Katana { inline void setGlobalRoutingSuccess ( bool ) const; inline void setDetailedRoutingSuccess ( bool ) const; virtual void openSession (); + inline void setStage ( uint32_t ); inline void setViewer ( CellViewer* ); inline void setPostEventCb ( Configuration::PostEventCb_t ); inline void setEventLimit ( uint64_t ); @@ -170,6 +172,7 @@ namespace Katana { TrackElementPairing _shortDoglegs; DataSymmetricMap _symmetrics; uint32_t _mode; + uint32_t _stage; mutable uint32_t _successState; protected: // Constructors & Destructors. @@ -196,6 +199,7 @@ namespace Katana { inline CellViewer* KatanaEngine::getViewer () const { return _viewer; } inline AnabaticEngine* KatanaEngine::base () { return static_cast(this); } inline Configuration* KatanaEngine::getKatanaConfiguration () { return _configuration; } + inline uint32_t KatanaEngine::getStage () const { return _stage; } inline Configuration::PostEventCb_t& KatanaEngine::getPostEventCb () { return _configuration->getPostEventCb(); } inline uint32_t KatanaEngine::getSuccessState () const { return _successState; } inline uint64_t KatanaEngine::getEventsLimit () const { return _configuration->getEventsLimit(); } @@ -213,6 +217,7 @@ namespace Katana { inline NegociateWindow* KatanaEngine::getNegociateWindow () { return _negociateWindow; } inline size_t KatanaEngine::getRoutingPlanesSize () const { return _routingPlanes.size(); } inline void KatanaEngine::setViewer ( CellViewer* viewer ) { _viewer=viewer; } + inline void KatanaEngine::setStage ( uint32_t stage ) { _stage=stage; } inline void KatanaEngine::setEventLimit ( uint64_t limit ) { _configuration->setEventsLimit(limit); } inline void KatanaEngine::setRipupLimit ( uint32_t type, uint32_t limit ) { _configuration->setRipupLimit(limit,type); } inline void KatanaEngine::setRipupCost ( uint32_t cost ) { _configuration->setRipupCost(cost); } diff --git a/katana/src/katana/NegociateWindow.h b/katana/src/katana/NegociateWindow.h index 94ef45d2..2bc04b2d 100644 --- a/katana/src/katana/NegociateWindow.h +++ b/katana/src/katana/NegociateWindow.h @@ -14,9 +14,7 @@ // +-----------------------------------------------------------------+ -#ifndef KATANA_NEGOCIATE_WINDOW_H -#define KATANA_NEGOCIATE_WINDOW_H - +#pragma once #include #include #include @@ -89,11 +87,6 @@ namespace Katana { // Class : "Katana::NegociateWindow". class NegociateWindow { - - public: - enum Stage { Negociation = 1 - , Packing = 2 - }; public: static NegociateWindow* create ( KatanaEngine* ); void destroy (); @@ -104,10 +97,8 @@ namespace Katana { inline RoutingEventQueue& getEventQueue (); inline RoutingEventHistory& getEventHistory (); inline RoutingEventLoop& getEventLoop (); - inline Stage getStage () const; void setGCells ( const vector& ); inline void setInterrupt ( bool ); - inline void setStage ( Stage ); double computeWirelength (); TrackElement* createTrackSegment ( AutoSegment*, Flags flags ); void addRoutingEvent ( TrackElement*, uint32_t level ); @@ -157,6 +148,3 @@ namespace Katana { } // Katana namespace. - - -#endif // KATANA_NEGOCIATE_WINDOW_H diff --git a/katana/src/katana/RoutingEvent.h b/katana/src/katana/RoutingEvent.h index 017388ab..b0037b2e 100644 --- a/katana/src/katana/RoutingEvent.h +++ b/katana/src/katana/RoutingEvent.h @@ -91,18 +91,14 @@ namespace Katana { }; friend class Compare; - public: - enum Mode { Negociate=1, Pack=2, Repair=3, Realign=4 }; - public: static uint32_t getStage (); static uint32_t getAllocateds (); static uint32_t getProcesseds (); static uint32_t getCloneds (); static void resetProcesseds (); - static void setStage ( uint32_t ); public: - static RoutingEvent* create ( TrackElement*, uint32_t mode=Negociate ); + static RoutingEvent* create ( TrackElement* ); RoutingEvent* clone () const; void destroy (); inline bool isCloned () const; @@ -142,7 +138,6 @@ namespace Katana { ); void setSegment ( TrackElement* ); RoutingEvent* reschedule ( RoutingEventQueue&, uint32_t eventLevel ); - void setMode ( uint32_t ); void setState ( uint32_t ); inline void setTimeStamp ( uint32_t ); inline void setProcessed ( bool state=true ); @@ -166,7 +161,7 @@ namespace Katana { string _getString () const; string _getTypeName () const; private: - RoutingEvent ( TrackElement*, uint32_t mode ); + RoutingEvent ( TrackElement* ); ~RoutingEvent (); protected: @@ -195,7 +190,6 @@ namespace Katana { unsigned int _tracksNb :16; unsigned int _tracksFree :16; unsigned int _insertState : 6; - unsigned int _mode : 4; unsigned int _rippleState : 4; uint32_t _eventLevel; //vector _perpandiculars; @@ -212,7 +206,6 @@ namespace Katana { inline bool RoutingEvent::isOverConstrained () const { return _overConstrained; } inline uint32_t RoutingEvent::getId () const { return _id; } inline uint32_t RoutingEvent::getTimeStamp () const { return _timeStamp; } - inline bool RoutingEvent::getMode () const { return _mode; } inline bool RoutingEvent::canMinimize () const { return not _minimized; } inline const RoutingEvent::Key& RoutingEvent::getKey () const { return _key; } inline TrackElement* RoutingEvent::getSegment () const { return _segment; } diff --git a/katana/src/katana/Session.h b/katana/src/katana/Session.h index e08e04be..a999bce6 100644 --- a/katana/src/katana/Session.h +++ b/katana/src/katana/Session.h @@ -14,9 +14,7 @@ // +-----------------------------------------------------------------+ -#ifndef KATANA_SESSION_H -#define KATANA_SESSION_H - +#pragma once #include #include #include @@ -68,6 +66,7 @@ namespace Katana { static Session* get ( const char* message=NULL ); inline static Super* base (); inline static bool isEmpty (); + static uint32_t getStage (); inline static KatanaEngine* getKatanaEngine (); static Configuration* getConfiguration (); inline static Net* getBlockageNet (); @@ -77,6 +76,7 @@ namespace Katana { inline static const std::vector& getIndirectInvalids (); static void setInterrupt ( bool ); + static void setStage ( uint32_t ); inline static Interval& toAxisInterval ( Interval&, size_t depth ); inline static void addIndirectInvalid ( TrackElement* ); inline static void addInsertEvent ( TrackMarker* , Track* ); @@ -220,5 +220,3 @@ namespace Katana { } // Katana namespace. - -#endif // KATANA_SESSION_H