Complete reorganization of where the routing stage is stored in Katana.

* In KatanaEngine:
    - Former situation:
        Each RoutingEvent did store the routing stage it was in. And it
        was misnamed "mode".
    - New organization:
        The routing stage is stored in KatanaEngine itself. It can be
	accessed through a proxy in Session.
* Change: In DataNegociate::update(), when in Realign stage and computing
    non-preferred perpnadicular routing *do not* expand of one pitch
    outside the RoutingPad range.
This commit is contained in:
Jean-Paul Chaput 2021-04-21 13:51:08 +02:00
parent 493ed1ea11
commit a05bd81bab
14 changed files with 53 additions and 79 deletions

View File

@ -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,6 +169,7 @@ namespace Katana {
if (not source->canDrag() and not target->canDrag())
perpandicular->base()->getCanonical( trackFree );
if (Session::getStage() < StagePack)
trackFree.inflate( 1*pitch, 1*pitch );
cdebug_log(159,0) << "Non-Pref Track Perpandicular Free: " << trackFree << endl;

View File

@ -196,6 +196,7 @@ namespace Katana {
, _shortDoglegs ()
, _symmetrics ()
, _mode (DigitalMode)
, _stage (StageNegociate)
, _successState (0)
{
//Entity::setMemoryLimit( 1024 ); // 1Gb.

View File

@ -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();

View File

@ -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())

View File

@ -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<TrackSegment*>(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()

View File

@ -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;

View File

@ -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"; }

View File

@ -20,6 +20,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:
typedef Anabatic::Flags Super;

View File

@ -14,9 +14,7 @@
// +-----------------------------------------------------------------+
#ifndef KATANA_DATA_NEGOCIATE_H
#define KATANA_DATA_NEGOCIATE_H
#pragma once
#include <string>
#include <iostream>
@ -169,5 +167,3 @@ namespace Katana {
INSPECTOR_P_SUPPORT(Katana::DataNegociate);
#endif // KATANA_DATA_NEGOCIATE_H

View File

@ -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<AnabaticEngine*>(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); }

View File

@ -14,9 +14,7 @@
// +-----------------------------------------------------------------+
#ifndef KATANA_NEGOCIATE_WINDOW_H
#define KATANA_NEGOCIATE_WINDOW_H
#pragma once
#include <set>
#include <queue>
#include <vector>
@ -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<GCell*>& );
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

View File

@ -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<TrackElement*> _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; }

View File

@ -14,9 +14,7 @@
// +-----------------------------------------------------------------+
#ifndef KATANA_SESSION_H
#define KATANA_SESSION_H
#pragma once
#include <set>
#include <vector>
#include <string>
@ -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<TrackElement*>&
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