* ./katabatic:

- Change: In Grid/BaseGrid, add an Abutment Box attribute (to facilitate
        segment truncation in Kite::TrackFixedSegment.
    - Change: In Grid/BaseGrid::Axis, when computing a row/column index using
        the graduation table, if the coordinate is exactly on the last
        graduation, return the last GCell instead of "out of bound".
    - Change: In GCell::hasFreeTrack(), AutoSegment::canMoveUp() &
        AutoSegment::canPivotUp() adds a "reserve" parameter to modify the
        amount of wirelength to remains free after the insertion.
This commit is contained in:
Jean-Paul Chaput 2010-04-23 13:13:54 +00:00
parent 92e55924c4
commit e7b1a5de6e
14 changed files with 146 additions and 106 deletions

View File

@ -2,7 +2,7 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
//
// ===================================================================
//

View File

@ -2,7 +2,7 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
//
// ===================================================================
//
@ -300,8 +300,9 @@ namespace Katabatic {
// Class : "Katabatic::AutoSegment".
size_t AutoSegment::_allocateds = 0;
unsigned long AutoSegment::_maxId = 0;
size_t AutoSegment::_allocateds = 0;
size_t AutoSegment::_globalsCount = 0;
unsigned long AutoSegment::_maxId = 0;
DbU::Unit AutoSegment::getX () const
@ -831,11 +832,11 @@ namespace Katabatic {
#if defined(CHECK_DETERMINISM)
cerr << "Order: AutoSegment::AutoSegment() - <id:" << _id << ">" << endl;
#endif
_allocateds++;
AutoContact* source = Session::lookup(dynamic_cast<Contact*>(segment->getSource()));
AutoContact* target = Session::lookup(dynamic_cast<Contact*>(segment->getTarget()));
_allocateds++;
_gcell = source->getGCell();
setOptimalMax ( (_isHorizontal) ? _gcell->getBoundingBox().getYMax()
: _gcell->getBoundingBox().getXMax() );
@ -847,8 +848,8 @@ namespace Katabatic {
_isGlobal = ( source->getGCell() != target->getGCell() );
break;
}
_isCanonicalLocal = !_isGlobal;
_globalsCount += (_isGlobal) ? 1 : 0;
_isCanonicalLocal = not _isGlobal;
_computeTerminal ( segment );
//if ( source->isTerminal() or target->isTerminal() ) _isTerminal = true;
@ -907,6 +908,7 @@ namespace Katabatic {
AutoSegment::~AutoSegment ()
{
_allocateds--;
if ( _isGlobal and (_globalsCount > 0) ) _globalsCount--;
}
@ -1238,7 +1240,7 @@ namespace Katabatic {
}
bool AutoSegment::canPivotUp ( bool propagate )
bool AutoSegment::canPivotUp ( bool propagate, float reserve )
{
ltrace(200) << "AutoSegment::canPivotUp()" << endl;
@ -1250,7 +1252,7 @@ namespace Katabatic {
vector<GCell*> gcells;
getGCells ( gcells );
for ( size_t i=0 ; i<gcells.size() ; i++ ) {
if ( !gcells[i]->hasFreeTrack(depth) ) return false;
if ( !gcells[i]->hasFreeTrack(depth,reserve) ) return false;
}
ltrace(200) << getAutoSource() << endl;
@ -1270,7 +1272,7 @@ namespace Katabatic {
forEach ( AutoSegment*, isegment, getCollapseds() ) {
isegment->getGCells ( gcells );
for ( size_t i=0 ; i<gcells.size() ; i++ ) {
if ( !gcells[i]->hasFreeTrack(depth) ) return false;
if ( !gcells[i]->hasFreeTrack(depth,reserve) ) return false;
}
if ( isegment->getAutoSource()->getMinDepth() < depth ) return false;
if ( isegment->getAutoTarget()->getMinDepth() < depth ) return false;
@ -1283,7 +1285,7 @@ namespace Katabatic {
}
bool AutoSegment::canMoveUp ( bool propagate )
bool AutoSegment::canMoveUp ( bool propagate, float reserve )
{
ltrace(200) << "AutoSegment::canMoveUp()" << endl;
@ -1296,7 +1298,7 @@ namespace Katabatic {
vector<GCell*> gcells;
getGCells ( gcells );
for ( size_t i=0 ; i<gcells.size() ; i++ ) {
if ( not gcells[i]->hasFreeTrack(depth) ) return false;
if ( not gcells[i]->hasFreeTrack(depth,reserve) ) return false;
}
if ( isLocal() and not propagate ) {
@ -1314,7 +1316,7 @@ namespace Katabatic {
isegment->getGCells ( gcells );
for ( size_t i=0 ; i<gcells.size() ; i++ ) {
if ( not gcells[i]->hasFreeTrack(depth) ) {
if ( not gcells[i]->hasFreeTrack(depth,reserve) ) {
ltrace(200) << "Not enough free track in " << gcells[i] << endl;
return false;
}
@ -1523,9 +1525,9 @@ namespace Katabatic {
Contact* contact = dynamic_cast<Contact*>(hurricaneSegment->getSource());
AutoContact* autoContact = Session::lookup(contact);
if ( !contact ) {
if ( contact == NULL ) {
throw Error ( badSegmentSource, getString(hurricaneSegment).c_str() );
if ( autoContact && ( autoContact != source ) )
if ( autoContact and ( autoContact != source ) )
throw Error ( mismatchSegmentSource
, getString(hurricaneSegment).c_str()
, getString(contact).c_str() );
@ -1533,9 +1535,9 @@ namespace Katabatic {
contact = dynamic_cast<Contact*>(hurricaneSegment->getTarget());
autoContact = Session::lookup(contact);
if ( !contact ) {
if ( contact == NULL ) {
throw Error ( badSegmentTarget, getString(hurricaneSegment).c_str() );
if ( autoContact && ( autoContact != target ) )
if ( autoContact and ( autoContact != target ) )
throw Error ( mismatchSegmentTarget
, getString(hurricaneSegment).c_str()
, getString(contact).c_str() );

View File

@ -2,7 +2,7 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
//
// ===================================================================
//

View File

@ -2,7 +2,7 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
//
// ===================================================================
//

View File

@ -721,7 +721,7 @@ namespace Katabatic {
}
bool GCell::hasFreeTrack ( size_t depth ) const
bool GCell::hasFreeTrack ( size_t depth, float reserve ) const
{
if (_invalid) const_cast<GCell*>(this)->updateDensity();
@ -765,7 +765,7 @@ namespace Katabatic {
<< " " << (_saturateDensities[depth]*capacity) << " vs. " << capacity
<< endl;
return (_saturateDensities[depth]*capacity + 1.0 <= capacity);
return (_saturateDensities[depth]*capacity + 1.0 + reserve <= capacity);
}

View File

@ -54,7 +54,7 @@ namespace Katabatic {
GCellGrid::GCellGrid ( KatabaticEngine* ktbt )
: Grid<GCell>()
: Grid<GCell>(ktbt->getCell()->getAbutmentBox())
, _katabatic(ktbt)
{ }
@ -140,6 +140,18 @@ namespace Katabatic {
}
Interval GCellGrid::getUSide ( unsigned int direction ) const
{
Interval side;
switch ( direction ) {
default:
case Constant::Horizontal: side = Interval(_boundingBox.getXMin(),_boundingBox.getXMax()); break;
case Constant::Vertical: side = Interval(_boundingBox.getYMin(),_boundingBox.getYMax()); break;
}
return side;
}
void GCellGrid::updateContacts ( bool openSession )
{
if ( openSession ) Session::open ( _katabatic );

View File

@ -49,6 +49,11 @@ namespace Katabatic {
unsigned int BaseGrid::Axis::getGraduationNumber ( DbU::Unit position, bool& onGraduation ) const
{
if ( position == _graduations[_graduations.size()-1] ) {
onGraduation = true;
return _graduations.size()-2;
}
vector<DbU::Unit>::const_iterator it = lower_bound ( _graduations.begin()
, _graduations.end()
, position+1
@ -99,11 +104,13 @@ namespace Katabatic {
// Class : "Katabatic::BaseGrid::Axis".
BaseGrid::BaseGrid () : _xGraduations()
, _yGraduations()
, _rows(0)
, _columns(0)
, _rawSize(0)
BaseGrid::BaseGrid ( const Box& bb )
: _boundingBox (bb)
, _xGraduations()
, _yGraduations()
, _rows (0)
, _columns (0)
, _rawSize (0)
{ }

View File

@ -2,7 +2,7 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
//
// ===================================================================
//
@ -38,6 +38,7 @@
#include "hurricane/Cell.h"
#include "crlcore/Utilities.h"
#include "crlcore/Catalog.h"
#include "crlcore/Measures.h"
#include "crlcore/AllianceFramework.h"
@ -170,6 +171,8 @@ namespace Katabatic {
using Hurricane::BasicLayer;
using Hurricane::NetExternalComponents;
using CRL::AllianceFramework;
using CRL::Catalog;
using CRL::CatalogProperty;
using CRL::Measures;
using CRL::addMeasure;
using CRL::getMeasure;
@ -230,7 +233,9 @@ namespace Katabatic {
, _gcellGrid (NULL)
, _routingNets ()
{
addMeasure<size_t> ( cell, "Gates", cell->getInstances().getSize() );
addMeasure<size_t> ( cell, "Gates"
, AllianceFramework::getInstancesCount(cell,AllianceFramework::IgnoreFeeds
|AllianceFramework::Recursive) );
}

View File

@ -2,7 +2,7 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
//
// ===================================================================
//
@ -39,11 +39,13 @@
#include "hurricane/RoutingPads.h"
#include "hurricane/Pad.h"
#include "hurricane/Plug.h"
#include "hurricane/Cell.h"
#include "hurricane/Instance.h"
#include "hurricane/Vertical.h"
#include "hurricane/Horizontal.h"
#include "crlcore/RoutingGauge.h"
#include "crlcore/Measures.h"
#include "katabatic/AutoContact.h"
#include "katabatic/AutoSegment.h"
@ -2217,16 +2219,18 @@ namespace {
return;
}
if ( routingPads.size() > 2 ) {
cerr << Error("For %s, more than two Plugs/Pins (%d) in single GCell."
,getString(net).c_str()
,routingPads.size()) << endl;
ltraceout(99);
return;
}
// if ( routingPads.size() > 2 ) {
// cerr << Error("For %s, more than two Plugs/Pins (%d) in single GCell."
// ,getString(net).c_str()
// ,routingPads.size()) << endl;
// ltraceout(99);
// return;
// }
GCell* gcell = ktbt->getGCellGrid()->getGCell ( routingPads[0]->getCenter()
, routingPads[1]->getCenter() );
sort ( routingPads.begin(), routingPads.end(), SortRpByX(false) ); // increasing X.
GCell* gcell = ktbt->getGCellGrid()->getGCell ( (*routingPads.begin ())->getCenter()
, (*routingPads.rbegin())->getCenter() );
if ( !gcell ) {
cerr << Error("No GCell under %s.",getString(routingPads[0]).c_str()) << endl;
@ -2239,36 +2243,30 @@ namespace {
AutoContact* dummy = NULL;
AutoContact* source = NULL;
AutoContact* target = NULL;
GCellConfiguration::_GCell_rp_AutoContacts ( gcell, routingPads[0], source, dummy, true );
GCellConfiguration::_GCell_rp_AutoContacts ( gcell, routingPads[1], target, dummy, true );
// AutoContact* source = AutoContact::fromRp ( gcell
// , routingPads[0]
// , Session::getContactLayer(0)
// , routingPads[0]->getCenter()
// , DbU::lambda(1.0), DbU::lambda(1.0)
// );
// AutoContact* target = AutoContact::fromRp ( gcell
// , routingPads[1]
// , Session::getContactLayer(0)
// , routingPads[1]->getCenter()
// , DbU::lambda(1.0), DbU::lambda(1.0)
// );
Box sourceBox = source->getNativeConstraintBox ();
Box targetBox = target->getNativeConstraintBox ();
if ( ( sourceBox.getYMax() < targetBox.getYMin() )
|| ( sourceBox.getYMin() > targetBox.getYMax() ) ) {
AutoContact* subContact1 = AutoContact::create ( gcell, net, Session::getContactLayer(1) );
AutoSegment::create ( source, subContact1, Constant::Vertical, AutoSegment::Local, true );
AutoContact* subContact2 = AutoContact::create ( gcell, net, Session::getContactLayer(1) );
AutoSegment::create ( target, subContact2, Constant::Vertical, AutoSegment::Local, true );
AutoSegment::create ( subContact1, subContact2, Constant::Horizontal, AutoSegment::Local, false );
} else
for ( size_t irp=1 ; irp<routingPads.size() ; ++irp ) {
GCellConfiguration::_GCell_rp_AutoContacts ( gcell, routingPads[irp-1], source, dummy, true );
GCellConfiguration::_GCell_rp_AutoContacts ( gcell, routingPads[irp ], target, dummy, true );
AutoSegment::create ( source, target, Constant::Horizontal, AutoSegment::Local, true );
}
// GCellConfiguration::_GCell_rp_AutoContacts ( gcell, routingPads[0], source, dummy, true );
// GCellConfiguration::_GCell_rp_AutoContacts ( gcell, routingPads[1], target, dummy, true );
// Box sourceBox = source->getNativeConstraintBox ();
// Box targetBox = target->getNativeConstraintBox ();
// if ( ( sourceBox.getYMax() < targetBox.getYMin() )
// || ( sourceBox.getYMin() > targetBox.getYMax() ) ) {
// AutoContact* subContact1 = AutoContact::create ( gcell, net, Session::getContactLayer(1) );
// AutoSegment::create ( source, subContact1, Constant::Vertical, AutoSegment::Local, true );
// AutoContact* subContact2 = AutoContact::create ( gcell, net, Session::getContactLayer(1) );
// AutoSegment::create ( target, subContact2, Constant::Vertical, AutoSegment::Local, true );
// AutoSegment::create ( subContact1, subContact2, Constant::Horizontal, AutoSegment::Local, false );
// } else
// AutoSegment::create ( source, target, Constant::Horizontal, AutoSegment::Local, true );
ltraceout(99);
}
@ -2282,10 +2280,12 @@ namespace {
namespace Katabatic {
using Hurricane::Name;
using Hurricane::DebugSession;
using Hurricane::Error;
using Hurricane::Warning;
using Hurricane::Bug;
using CRL::addMeasure;
void KatabaticEngine::_loadGrByNet ()
@ -2316,6 +2316,9 @@ namespace Katabatic {
stopMeasures ();
printMeasures ( "load" );
addMeasure<size_t> ( getCell(), "Globals", AutoSegment::getGlobalsCount() );
addMeasure<size_t> ( getCell(), "Edges" , AutoSegment::getAllocateds() );
}

View File

@ -2,7 +2,7 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
//
// ===================================================================
//
@ -131,7 +131,8 @@ namespace Katabatic {
, vector<AutoSegment*>& collapseds
);
static inline int getTerminalCount ( AutoSegment* seed );
static size_t getAllocateds () { return _allocateds; };
static inline size_t getGlobalsCount ();
static inline size_t getAllocateds ();
static inline unsigned long getMaxId ();
// Constructors & Destructor.
static AutoSegment* create ( AutoContact* source
@ -195,8 +196,8 @@ namespace Katabatic {
inline bool allowOutsideGCell () const;
bool canDesalignate ();
virtual bool canDesalignate ( AutoContact* ) const = 0;
bool canMoveUp ( bool propagate=false );
bool canPivotUp ( bool propagate=false );
bool canMoveUp ( bool propagate=false, float reserve=0.0 );
bool canPivotUp ( bool propagate=false, float reserve=0.0 );
bool canSlacken ( bool propagate=false );
virtual bool _canSlacken () const = 0;
bool canGoOutsideGCell () const;
@ -302,6 +303,7 @@ namespace Katabatic {
protected:
// Internal: Static Attributes.
static size_t _allocateds;
static size_t _globalsCount;
static bool _destroyBase;
static bool _destroyTool;
static unsigned long _maxId;
@ -469,6 +471,10 @@ namespace Katabatic {
}
inline size_t AutoSegment::getGlobalsCount () { return _globalsCount; }
inline size_t AutoSegment::getAllocateds () { return _allocateds; }
} // End of Katabatic namespace.

View File

@ -2,7 +2,7 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
//
// ===================================================================
//

View File

@ -110,7 +110,7 @@ namespace Katabatic {
bool isSaturated ( size_t depth ) const;
inline bool isValid () const;
bool isAboveDensity ( float threshold ) const;
bool hasFreeTrack ( size_t depth ) const;
bool hasFreeTrack ( size_t depth, float reserve ) const;
inline GCellGrid* getGCellGrid () const;
inline unsigned int getDepth () const;
inline unsigned int getIndex () const;

View File

@ -50,15 +50,16 @@ namespace Katabatic {
class GCellGrid : public Grid<GCell> {
public:
Cell* getCell () const;
void updateContacts ( bool openSession=true );
size_t checkDensity () const;
size_t updateDensity ();
bool checkEdgeSaturation ( float threshold ) const;
void _xmlWrite ( ostream& );
virtual Record* _getRecord () const;
virtual string _getString () const;
virtual string _getTypeName () const;
Cell* getCell () const;
Interval getUSide ( unsigned int ) const;
void updateContacts ( bool openSession=true );
size_t checkDensity () const;
size_t updateDensity ();
bool checkEdgeSaturation ( float threshold ) const;
void _xmlWrite ( ostream& );
virtual Record* _getRecord () const;
virtual string _getString () const;
virtual string _getTypeName () const;
// Attributes.
protected:

View File

@ -58,19 +58,20 @@ namespace Katabatic {
public:
class Axis;
public:
inline void destroy ();
inline void destroy ();
// Accessors.
inline unsigned int getColumns () const;
inline unsigned int getRows () const;
inline unsigned int getRawSize () const;
inline unsigned int getIndex ( unsigned int c, unsigned int r ) const;
inline unsigned int getRow ( unsigned int ) const;
inline unsigned int getColumn ( unsigned int ) const;
inline const Axis& getXGrads () const;
inline const Axis& getYGrads () const;
// Inspector Managment.
virtual Record* _getRecord () const;
virtual string _getString () const = 0;
inline const Box& getBoundingBox () const;
inline unsigned int getColumns () const;
inline unsigned int getRows () const;
inline unsigned int getRawSize () const;
inline unsigned int getIndex ( unsigned int c, unsigned int r ) const;
inline unsigned int getRow ( unsigned int ) const;
inline unsigned int getColumn ( unsigned int ) const;
inline const Axis& getXGrads () const;
inline const Axis& getYGrads () const;
// Inspector Managment.
virtual Record* _getRecord () const;
virtual string _getString () const = 0;
public:
// Sub-Class Grid::Axis.
@ -96,6 +97,7 @@ namespace Katabatic {
protected:
// Attributes.
Box _boundingBox;
Axis _xGraduations;
Axis _yGraduations;
unsigned int _rows;
@ -104,7 +106,7 @@ namespace Katabatic {
// Constructors & Destructors.
protected:
BaseGrid ();
BaseGrid ( const Box& );
virtual ~BaseGrid ();
virtual void _postCreate ();
virtual void _preDestroy ();
@ -120,13 +122,14 @@ namespace Katabatic {
inline DbU::Unit& BaseGrid::Axis::operator[] ( unsigned int i ) { return _graduations[i]; }
inline string BaseGrid::Axis::_getTypeName () const { return _TName("BaseGrid::Axis"); }
inline void BaseGrid::destroy () { _preDestroy(); delete this; }
inline unsigned int BaseGrid::getColumns () const { return _columns; };
inline unsigned int BaseGrid::getRows () const { return _rows; };
inline unsigned int BaseGrid::getRawSize () const { return getColumns() * getRows(); }
inline unsigned int BaseGrid::getIndex ( unsigned int c, unsigned int r ) const { return c+(r*getColumns()); }
inline unsigned int BaseGrid::getRow ( unsigned int i ) const { return i / getColumns(); }
inline unsigned int BaseGrid::getColumn ( unsigned int i ) const { return i % getColumns(); }
inline void BaseGrid::destroy () { _preDestroy(); delete this; }
inline const Box& BaseGrid::getBoundingBox () const { return _boundingBox; };
inline unsigned int BaseGrid::getColumns () const { return _columns; };
inline unsigned int BaseGrid::getRows () const { return _rows; };
inline unsigned int BaseGrid::getRawSize () const { return getColumns() * getRows(); }
inline unsigned int BaseGrid::getIndex ( unsigned int c, unsigned int r ) const { return c+(r*getColumns()); }
inline unsigned int BaseGrid::getRow ( unsigned int i ) const { return i / getColumns(); }
inline unsigned int BaseGrid::getColumn ( unsigned int i ) const { return i % getColumns(); }
inline const BaseGrid::Axis& BaseGrid::getXGrads () const { return _xGraduations; }
inline const BaseGrid::Axis& BaseGrid::getYGrads () const { return _yGraduations; }
@ -166,7 +169,7 @@ namespace Katabatic {
// Constructors & Destructors.
protected:
inline Grid ();
inline Grid ( const Box& );
virtual ~Grid ();
private:
Grid ( const Grid& );
@ -187,8 +190,9 @@ namespace Katabatic {
// Inline Functions.
template<typename GCellT>
Grid<GCellT>::Grid () : BaseGrid()
, _gcells()
Grid<GCellT>::Grid ( const Box& bb )
: BaseGrid(bb)
, _gcells ()
{ }