* ./kite:

- Change: Big cleanup. Supress all the GCell level: GCell, GCellGrid,
        GCellRoutingSet. Blockages now managed inside the BuildPower.
    - New: In NegociateWindow, Histogram of GCell densities in Gnuplot
        format.
This commit is contained in:
Jean-Paul Chaput 2010-12-12 21:42:57 +00:00
parent 011be5487b
commit c9e1c3101a
32 changed files with 1128 additions and 4083 deletions

View File

@ -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 <map>
#include <list>
#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<Interval> _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<Track*> _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<const BasicLayer*,Plane*> _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<Interval>::iterator imerge = _blockages.end();
list<Interval>::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<Interval>::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<gaugeDepth ; depth++ ) {
const RegularLayer* routingLayer = dynamic_cast<const RegularLayer*>(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<const BasicLayer*,Plane*>::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<const BasicLayer*,Plane*>::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<const Component*>(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.

View File

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

View File

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

View File

@ -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 <limits>
#include <sstream>
#include <algorithm>
#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<Contact*>() ) {
if ( not bb.contains(icontact->getCenter()) ) continue;
forEach ( Segment*, isegment, icontact->getSlaveComponents().getSubSet<Segment*>() ) {
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<Contact*>() ) {
if ( not bb.contains(icontact->getCenter()) ) continue;
forEach ( Segment*, isegment, icontact->getSlaveComponents().getSubSet<Segment*>() ) {
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<Segment*>() ) {
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<unsigned int>::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<GCell*> gcells;
trackSegment->getGCells ( gcells );
if ( gcells.empty() ) return NULL;
size_t ilower = 0;
for ( size_t i=0 ; i<gcells.size() ; i++ )
if ( gcells[i]->getOrder() < 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<AutoContact*>* contacts = getContacts();
for ( size_t i=0 ; i<contacts->size() ; i++ ) {
forEach ( Component*, component, (*contacts)[i]->getSlaveComponents() ) {
segment = dynamic_cast<Segment*>(*component);
autoSegment = Session::base()->lookup ( segment );
ltrace(149) << autoSegment << endl;
if ( autoSegment ) {
addTrackSegment ( this, autoSegment, true );
}
}
}
// // Effective deletion of rejecteds.
// set<AutoSegment*>::iterator ireject = rejecteds.begin();
// for ( ; ireject != rejecteds.end() ; ireject++ ) {
// }
ltrace(149) << "Horizontal overcell AutoSegments" << endl;
vector<AutoSegment*>* segments = getHSegments();
for ( size_t i=0 ; i<segments->size() ; i++ ) {
addTrackSegment ( this, (*segments)[i], true );
}
ltrace(149) << "Vertical overcell AutoSegments" << endl;
segments = getVSegments();
for ( size_t i=0 ; i<segments->size() ; 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<AutoContact*>* 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<RoutingPad*>(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<GCell*> gcells;
trackSegment->getGCells ( gcells );
GCell* lowest = gcells[0];
bool validPrevious = false;
for ( size_t igcell=0 ; igcell<gcells.size() ; igcell++ ) {
ltrace(200) << "| " << igcell << ":" << gcells[igcell] << endl;
if ( gcells[igcell]->getOrder() < 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<unsigned int>::max()) ? "-" : getString(_order));
s += " ";
s += ((_isRouted) ? "R" : "-");
s += ">";
return s;
}
Record* GCell::_getRecord () const
{ return _base->_getRecord(); }
} // End of Kite namespace.

View File

@ -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 <iostream>
#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<GCell>(kite->getCell()->getBoundingBox())
, _kite(kite)
{ }
void GCellGrid::_postCreate ()
{
// Clone the grid from Katabatic Here.
Katabatic::GCellGrid* base = _kite->base()->getGCellGrid();
vector<Katabatic::GCell*>* baseGCells = base->getGCellVector();
ltrace(80) << "Kite GCell Matrix [" << baseGCells->size() << "]" << endl;
for ( size_t i=0 ; i<baseGCells->size() ; 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<GCell*>::iterator it = _gcells.begin();
vector<GCell*>::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<GCell>::_getRecord ();
record->add ( getSlot ( "_kite", _kite ) );
return record;
return record;
}
} // End of Kite namespace.

View File

@ -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 <limits>
#include <queue>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <boost/bind.hpp>
#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<unsigned int>::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<TrackElement*>& GCellRoutingSet::getOwnedSegments ( vector<TrackElement*>& segments ) const
{
for ( size_t i=0 ; i<_gcells.size() ; i++ ) {
if ( _gcells[i]->isRouted() ) continue;
const vector<TrackElement*>& gcellSegments = _gcells[i]->getOwnedSegments();
for ( size_t j=0 ; j<gcellSegments.size() ; j++ ) {
if ( !gcellSegments[j]->isFixed() )
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<GCell*> 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<TrackElement*>& 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<BorderSegment>().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 << "<o:" << ((_order!=numeric_limits<unsigned int>::max()) ? getString(_order) : "-")
<< " " << _gcells.front() << setprecision(9)
<< " [" << ":" << _minDensity
<< "] " << _gcells.size()
<< ">";
return s.str();
//return "<o:" + ((_order!=numeric_limits<unsigned int>::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.

View File

@ -45,6 +45,7 @@
#include <crlcore/Utilities.h>
#include <crlcore/AllianceFramework.h>
#include <katabatic/GCell.h>
#include <katabatic/GCellGrid.h>
#include <knik/Edge.h>
#include <knik/Vertex.h>
#include <knik/KnikEngine.h>
@ -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<const Katabatic::GCell*>(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

View File

@ -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<GCell*> 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<Segment*>() ) {
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 ();
}

View File

@ -126,7 +126,7 @@ int main ( int argc, char *argv[] )
( "edge,e" , poptions::value<float>(&edgeCapacity)->default_value(65.0)
, "The egde density ratio applied on global router's edges." )
( "cell,c" , poptions::value<string>()
, "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.");

View File

@ -23,9 +23,15 @@
// x-----------------------------------------------------------------x
#include <vector>
#include <algorithm>
#include <iomanip>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/fstream.hpp>
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<float> > _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<nbSets ; ++iset ) {
_sets.push_back ( vector<float>() );
for ( size_t i=0 ; i<binSize ; ++i ) _sets.back().push_back(0);
}
}
Histogram::~Histogram ()
{ }
void Histogram::addSample ( double sample, size_t iset )
{
size_t binIndex = (size_t)rint ( sample / _step );
if ( binIndex > _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<GCell>::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<GCell*> 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<TrackElement*> 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<AutoContact*>* contacts = _gcells[igcell]->getContacts();
for ( size_t i=0 ; i<contacts->size() ; i++ ) {
forEach ( Hook*, ihook, (*contacts)[i]->getBodyHook()->getSlaveHooks() ) {
Hook* sourceHook = dynamic_cast<Segment::SourceHook*>(*ihook);
if ( not sourceHook ) continue;
segment = dynamic_cast<Segment*>(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<TrackElement*>& 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<AutoContact*>* contacts = gcell->getContacts();
for ( size_t i=0 ; i<contacts->size() ; i++ ) {
forEach ( Component*, component, (*contacts)[i]->getSlaveComponents() ) {
segment = dynamic_cast<Segment*>(*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 << " <FirstPass:Negociation - event:" << tty::bold << setw(7) << setfill('0')
cmess1 << " <event:" << tty::bold << setw(7) << setfill('0')
<< RoutingEvent::getProcesseds() << setfill(' ') << tty::reset << ">" << tty::cr;
cmess1.flush ();
} else {
cmess2 << " <FirstPass:Negociation - event:" << setw(7) << setfill('0')
cmess2 << " <event:" << setw(7) << setfill('0')
<< RoutingEvent::getProcesseds() << setfill(' ') << "> 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 << " <SecondPass:Packing - event:"
cmess1 << " <event:"
<< tty::bold << tty::fgcolor(tty::Red) << setw(7) << setfill('0')
<< RoutingEvent::getProcesseds() << setfill(' ') << tty::reset << ">" << tty::cr;
cmess1.flush ();
} else {
cmess1 << " <SecondPass:Packing - event:" << setw(7) << setfill('0')
cmess1 << " <event:" << setw(7) << setfill('0')
<< RoutingEvent::getProcesseds() << setfill(' ') << ">" << 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<GCell*> gcells = rs->getGCells ();
for ( size_t i=0 ; i<gcells.size() ; i++ ) {
ltrace(200) << gcells[i] << endl;
#if defined(CHECK_DETERMINISM)
cerr << "Order: GCell: " << gcells[i] << endl;
#endif
}
Session::setOrder ( rs->getOrder() );
vector<TrackElement*> 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 ; j<gcells.size() ; ++j ) {
// cerr << " INITIAL stiff: " << gcells[j] << ":" << gcells[j]->getStiffness() << 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 ; j<gcells.size() ; ++j ) {
// cerr << " stiff: " << gcells[j] << ":" << gcells[j]->getStiffness() << 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<size_t>( getCell(), "Events" , RoutingEvent::getProcesseds(), 12 );
addMeasure<size_t>( 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 );
}

View File

@ -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<TrackElement*>& perpandiculars
void getPerpandiculars ( TrackElement* segment
, Katabatic::AutoContact* from
, unsigned int direction
, vector<TrackElement*>& 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<TrackElement*> 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<TrackElement*> perpandiculars;
if ( not track ) {
cerr << Bug("%s is not inserted in a <Track>",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<RoutingPad*>(support->getAnchor());
GCell* gcell = Session::lookup ( support->getGCell() );
Katabatic::AutoContact* support = segment->base()->getAutoSource();
RoutingPad* rp = dynamic_cast<RoutingPad*>(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.

File diff suppressed because it is too large Load Diff

View File

@ -72,19 +72,17 @@ namespace Kite {
void RoutingEventQueue::load ( const vector<TrackElement*>& segments )
{
for ( size_t i=0 ; i<segments.size() ; i++ ) {
if ( segments[i]->getDataNegociate()->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 );
}
}

View File

@ -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<Track*> packTracks;
@ -266,7 +257,7 @@ namespace Kite {
if ( not faileds.empty() ) {
set<TrackElement*>::iterator ifailed = faileds.begin();
vector<GCell*> 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."

View File

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

View File

@ -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 <sstream>
#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<RegularLayer*>(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.

View File

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

View File

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

View File

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

View File

@ -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<GCell*> 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<GCell*>& gcells ) const
size_t TrackSegment::getGCells ( vector<Katabatic::GCell*>& gcells ) const
{
vector<GCell*>().swap ( gcells );
vector<Katabatic::GCell*>().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<TrackElement*>& bounds )
{
bounds.clear ();
@ -321,13 +298,6 @@ namespace Kite {
}
unsigned int TrackSegment::getOrder () const
{
if ( _data == NULL ) return numeric_limits<unsigned int>::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<GCell*> 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 ; i<gcells.size() ; ++i ) {
gcells[i]->incSegmentCount ( 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 ; i<gcells.size() ; ++i ) {
gcells[i]->incRoutedCount ( 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<AutoSegment*> 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<AutoSegment*>& invalidateds = Session::getInvalidateds();
// if ( not invalidateds.empty() ) {
// vector<TrackElement*> segments;
// for ( size_t i=0 ; i<invalidateds.size() ; i++ ) {
// ltrace(200) << "slacken: " << invalidateds[i] << endl;
// TrackElement* segment = GCell::addTrackSegment(NULL,invalidateds[i],false);
// segments.push_back ( segment );
// //if ( segment->base()->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 ; i<segments.size() ; i++ ) {
// ltrace(200) << "slacken: " << segments[i] << endl;
// }
// }
ltraceout(200);
} else
@ -611,19 +456,11 @@ namespace Kite {
bool TrackSegment::canPivotUp ( float reserve ) const
{
return _base->canPivotUp(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<AutoSegment*>& invalidateds = Session::getInvalidateds();
if ( not invalidateds.empty() ) {
vector<TrackElement*> segments;
for ( size_t i=0 ; i<invalidateds.size() ; i++ ) {
TrackElement* segment = GCell::addTrackSegment(NULL,invalidateds[i],false);
TrackElement* segment = Session::getNegociateWindow()->addTrackSegment(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 ; i<segments.size() ; i++ ) {
ltrace(200) << "moved: " << segments[i] << endl;
}
}
if ( _data ) {
_data->setState ( 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<AutoSegment*>& invalidateds = Session::getInvalidateds();
if ( not invalidateds.empty() ) {
vector<TrackElement*> segments;
for ( size_t i=0 ; i<invalidateds.size() ; i++ ) {
ltrace(200) << "moved: " << invalidateds[i] << endl;
segments.push_back ( GCell::addTrackSegment(NULL,invalidateds[i],false) );
segments.push_back ( Session::getNegociateWindow()->addTrackSegment(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 ; i<segments.size() ; i++ ) {
ltrace(200) << "moved: " << segments[i] << endl;
}
@ -717,7 +533,7 @@ namespace Kite {
TrackElement* TrackSegment::getSourceDogLeg ()
{
if ( !hasSourceDogLeg() ) return NULL;
if ( not hasSourceDogLeg() ) return NULL;
unsigned int direction = Constant::perpandicular ( getDirection() );
TrackElement* dogleg = NULL;
@ -734,7 +550,7 @@ namespace Kite {
TrackElement* TrackSegment::getTargetDogLeg ()
{
if ( !hasSourceDogLeg() ) return NULL;
if ( not hasSourceDogLeg() ) return NULL;
unsigned int direction = Constant::perpandicular ( getDirection() );
TrackElement* dogleg = NULL;
@ -763,13 +579,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() or hasTargetDogLeg() or isSlackened() ) {
ltrace(200) << "Failed: already has source and/or target dogleg or slackened." << endl;
return false;
@ -785,17 +594,9 @@ namespace Kite {
bool upLayer = (Session::getRoutingGauge()->getLayerDepth(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<GCell*> gcells;
vector<Katabatic::GCell*> 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 ; i<dogLegs.size() ; i++ ) {
ltrace(200) << "Looking up: " << dogLegs[i] << endl;
segments.push_back ( GCell::addTrackSegment(NULL,dogLegs[i]) );
//if ( isSlackened() /*&& (segments[i]->base() == 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 ; i<dogLegs.size() ; i++ ) {
segments[i]->reschedule ( ((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<RoutingPad*>(source->getAnchor()))
or (target and dynamic_cast<RoutingPad*>(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<AutoSegment*>& invalidateds = Session::getInvalidateds();
// if ( not invalidateds.empty() ) {
// vector<TrackElement*> segments;
// for ( size_t i=0 ; i<invalidateds.size() ; i++ ) {
// ltrace(200) << "desaligned: " << invalidateds[i] << endl;
// segments.push_back ( GCell::addTrackSegment(NULL,invalidateds[i],false) );
// segments[i]->reschedule ( 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 ; i<segments.size() ; i++ ) {
// ltrace(200) << "desaligned: " << segments[i] << endl;
// }
// }
ltraceout(200);
}
@ -1114,7 +814,7 @@ namespace Kite {
if ( not invalidateds.empty() ) {
for ( size_t i=0 ; i<invalidateds.size() ; i++ ) {
ltrace(200) << "invalidated: " << invalidateds[i] << endl;
TrackElement* segment = GCell::addTrackSegment(NULL,invalidateds[i],false);
TrackElement* segment = Session::getNegociateWindow()->addTrackSegment(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<RoutingPad*>(source->getAnchor()))
or (target and dynamic_cast<RoutingPad*>(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" : "-");

View File

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

View File

@ -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 <vector>
#include <set>
#include <iostream>
#include <string>
#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<TrackElement*>& 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<AutoSegment*>* getVSegments ();
inline vector<AutoSegment*>* getHSegments ();
inline vector<AutoContact*>* 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<TrackElement*> _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<TrackElement*>& 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<AutoSegment*>* GCell::getVSegments () { return _base->getVSegments(); }
inline vector<AutoSegment*>* GCell::getHSegments () { return _base->getHSegments(); }
inline vector<AutoContact*>* 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<GCell*> GCells;
typedef GenericLocator<GCell*> GCellLocator;
typedef GenericFilter<GCell*> GCellFilter;
} // End of Kite namespace.
INSPECTOR_P_SUPPORT(Kite::GCell);
#endif // __KITE_GCELL__

View File

@ -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<GCell> {
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<GCellGrid*>(this)->base()->getUSide(dir); }
inline bool GCellGrid::checkEdgeSaturation ( float threshold ) const
{ return const_cast<GCellGrid*>(this)->base()->checkEdgeSaturation(threshold); }
} // End of Kite namespace.
#endif // __KITE_GCELL_GRID__

View File

@ -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 <vector>
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<GCell*>& getGCells () const;
vector<TrackElement*>& getOwnedSegments ( vector<TrackElement*>& ) 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<GCell*> _gcells;
vector<BorderSegment> _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<GCell*>& 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__

View File

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

View File

@ -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 <set>
#include <queue>
#include <vector>
@ -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<GCell>* getGridBox () const;
inline KiteEngine* getKiteEngine () const;
inline RoutingEventQueue& getEventQueue ();
inline RoutingEventHistory& getEventHistory ();
inline const vector<GCellRoutingSet*>&
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<TrackElement*>& );
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<GCell>* _gridBox;
vector<GCell*> _criticalGCells;
unsigned int _gcellOrder;
vector<GCellRoutingSet*> _gcellRoutingSets;
RoutingEventQueue _eventQueue;
RoutingEventHistory _eventHistory;
vector<RingSegment> _ring;
unsigned int _slowMotion;
bool _interrupt;
KiteEngine* _kite;
Katabatic::GCellVector _gcells;
std::vector<TrackElement*> _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<GCell>* 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<GCellRoutingSet*>&
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.

View File

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

View File

@ -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<Event> _insertEvents;
vector<Event> _removeEvents;
set<Track*> _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); }

View File

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

View File

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

View File

@ -61,7 +61,6 @@ namespace Kite {
class DataNegociate;
class Track;
class TrackCost;
class GCell;
typedef map<Segment*,TrackElement*> 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<GCell*>& ) 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;

View File

@ -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<GCell*>& ) const;
virtual size_t getGCells ( vector<Katabatic::GCell*>& ) const;
virtual TrackElement* getSourceDogLeg ();
virtual TrackElement* getTargetDogLeg ();
virtual TrackElements getCollapsedPerpandiculars ();
virtual size_t getPerpandicularsBound ( set<TrackElement*>& );
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.