Correct management of last E/N GCell boundaries.

* Bug: In Anabatic::GCell, new functions getConstraintUMax() to return the
    correct bounding box for the last north/east GCell. The GCells do not
    own their north/east edges, except for the last ones. Thoses functions
    must distinct from getUMax() because for them, the shrink is always
    applied. getConstraintBox() uses the "getConstraintUMax()" functions.
* Bug: In Anabatic::AutoContact, initialize the constraint box from the
    new GCell::getConstraintUMax(), to manage correctly the boundaries
    of the nothernmost & easternmost GCells. The problem was showing for
    pins on the north/east side of a circuit, the constraint
* Bug: In Anabatic::AutoContactHTee, Anabatic::AutoContactVTee and
    Anabatic::AutoContactTerminal forgot to call the _preCreate() function
    in the various create().
* Bug: In Matrix::getUnder(), if on the N/E boundary, decrease by one to
    be enclosed in it.
This commit is contained in:
Jean-Paul Chaput 2016-08-27 15:59:12 +02:00
parent 41b1b72b7c
commit 44500a2329
11 changed files with 36 additions and 9 deletions

View File

@ -67,9 +67,9 @@ namespace Anabatic {
, _gcell (gcell) , _gcell (gcell)
, _flags (CntInvalidatedCache|CntInCreationStage) , _flags (CntInvalidatedCache|CntInCreationStage)
, _dxMin (0) , _dxMin (0)
, _dxMax ((int)DbU::toLambda( _gcell->getXMax()-_gcell->getXMin() )) , _dxMax ((int)DbU::toLambda(gcell->getConstraintXMax()))
, _dyMin (0) , _dyMin ()
, _dyMax ((int)DbU::toLambda( _gcell->getYMax()-_gcell->getYMin() )) , _dyMax ((int)DbU::toLambda(gcell->getConstraintYMax()))
{ {
_allocateds++; _allocateds++;
_gcell->addContact ( this ); _gcell->addContact ( this );
@ -257,7 +257,7 @@ namespace Anabatic {
{ {
if (isUserNativeConstraints()) return getConstraintBox(); if (isUserNativeConstraints()) return getConstraintBox();
if (isFixed()) return Box(_contact->getPosition()); if (isFixed()) return Box(_contact->getPosition());
return _gcell->getBoundingBox(); return _gcell->getConstraintBox();
} }
@ -316,8 +316,8 @@ namespace Anabatic {
_contact->setPosition( _gcell->getCenter() ); _contact->setPosition( _gcell->getCenter() );
_dxMin = 0; _dxMin = 0;
_dyMin = 0; _dyMin = 0;
_dxMax = (int)DbU::toLambda( _gcell->getXMax()-_gcell->getXMin() ); _dxMax = (int)DbU::toLambda( gcell->getConstraintXMax() );
_dyMax = (int)DbU::toLambda( _gcell->getYMax()-_gcell->getYMin() ); _dyMax = (int)DbU::toLambda( gcell->getConstraintYMax() );
if (cdebug.enabled()) { if (cdebug.enabled()) {
int dxMin = _dxMin; int dxMin = _dxMin;
int dyMin = _dyMin; int dyMin = _dyMin;

View File

@ -49,6 +49,8 @@ namespace Anabatic {
AutoContactHTee* AutoContactHTee::create ( GCell* gcell, Net* net, const Layer* layer ) AutoContactHTee* AutoContactHTee::create ( GCell* gcell, Net* net, const Layer* layer )
{ {
_preCreate( gcell, net, layer );
DbU::Unit viaSide = Session::getViaWidth( layer ); DbU::Unit viaSide = Session::getViaWidth( layer );
Contact* contact = Contact::create ( net Contact* contact = Contact::create ( net
, layer , layer

View File

@ -88,6 +88,8 @@ namespace Anabatic {
cdebug_log(145,0) << "AutoContactTerminal::create(... x, y, ...)" << endl; cdebug_log(145,0) << "AutoContactTerminal::create(... x, y, ...)" << endl;
cdebug_log(145,0) << "@ x:" << DbU::getValueString(x) << " y:" << DbU::getValueString(y) << endl; cdebug_log(145,0) << "@ x:" << DbU::getValueString(x) << " y:" << DbU::getValueString(y) << endl;
_preCreate( gcell, anchor->getNet(), layer );
Point anchorPosition = anchor->getPosition(); Point anchorPosition = anchor->getPosition();
Contact* contact = Contact::create( anchor Contact* contact = Contact::create( anchor

View File

@ -49,6 +49,8 @@ namespace Anabatic {
AutoContactVTee* AutoContactVTee::create ( GCell* gcell, Net* net, const Layer* layer ) AutoContactVTee* AutoContactVTee::create ( GCell* gcell, Net* net, const Layer* layer )
{ {
_preCreate( gcell, net, layer );
DbU::Unit viaSide = Session::getViaWidth( layer ); DbU::Unit viaSide = Session::getViaWidth( layer );
Contact* contact = Contact::create( net Contact* contact = Contact::create( net
, layer , layer

View File

@ -553,6 +553,8 @@ namespace Anabatic {
{ {
const GCell* current = this; const GCell* current = this;
if (not this) cerr << Error("*this* is NULL!") << endl;
while ( current ) { while ( current ) {
if (not current->isFlat() and current->getBoundingBox().contains(x,y)) break; if (not current->isFlat() and current->getBoundingBox().contains(x,y)) break;
@ -796,7 +798,7 @@ namespace Anabatic {
cerr << Error( "GCell::_revalidate(): %s, Y Min is greater than Max.", getString(this).c_str() ); cerr << Error( "GCell::_revalidate(): %s, Y Min is greater than Max.", getString(this).c_str() );
_anabatic->_updateLookup( this ); _anabatic->_updateLookup( this );
_anabatic->getMatrix()->show(); //_anabatic->getMatrix()->show();
cdebug_tabw(110,-1); cdebug_tabw(110,-1);
} }

View File

@ -73,10 +73,14 @@ namespace Anabatic {
GCell* Matrix::getUnder ( DbU::Unit x, DbU::Unit y ) const GCell* Matrix::getUnder ( DbU::Unit x, DbU::Unit y ) const
{ {
if (x == _area.getXMax()) --x;
if (y == _area.getYMax()) --y;
int index = xy2maxIndex(x,y); int index = xy2maxIndex(x,y);
cdebug_log(110,0) << "Matrix::getUnder() (" cdebug_log(110,0) << "Matrix::getUnder() ("
<< DbU::getValueString(x) << " " << DbU::getValueString(x) << " "
<< DbU::getValueString(y) << ") index:" << index << endl; << DbU::getValueString(y) << ") index:" << index << endl;
return (index < 0) ? NULL : _gcells[index]->getUnder(x,y); return (index < 0) ? NULL : _gcells[index]->getUnder(x,y);
} }
@ -133,6 +137,7 @@ namespace Anabatic {
cdebug_tabw(110,-1); cdebug_tabw(110,-1);
} }
void Matrix::show () const void Matrix::show () const
{ {
cdebug_log(111,0) << this << endl; cdebug_log(111,0) << this << endl;

View File

@ -31,6 +31,7 @@ namespace Anabatic {
class AutoContactHTee : public AutoContact { class AutoContactHTee : public AutoContact {
typedef AutoContact Super;
friend class AutoContact; friend class AutoContact;
public: public:
static AutoContactHTee* create ( GCell*, Net*, const Layer* ); static AutoContactHTee* create ( GCell*, Net*, const Layer* );

View File

@ -28,6 +28,7 @@ namespace Anabatic {
class AutoContactTerminal : public AutoContact { class AutoContactTerminal : public AutoContact {
typedef AutoContact Super;
friend class AutoContact; friend class AutoContact;
public: public:
static AutoContactTerminal* create ( GCell* gcell static AutoContactTerminal* create ( GCell* gcell

View File

@ -28,6 +28,7 @@ namespace Anabatic {
class AutoContactVTee : public AutoContact { class AutoContactVTee : public AutoContact {
typedef AutoContact Super;
friend class AutoContact; friend class AutoContact;
public: public:
static AutoContactVTee* create ( GCell*, Net*, const Layer* ); static AutoContactVTee* create ( GCell*, Net*, const Layer* );

View File

@ -149,8 +149,11 @@ namespace Anabatic {
inline DbU::Unit getYMin () const; inline DbU::Unit getYMin () const;
inline DbU::Unit getXMax ( int shrink=0 ) const; inline DbU::Unit getXMax ( int shrink=0 ) const;
inline DbU::Unit getYMax ( int shrink=0 ) const; inline DbU::Unit getYMax ( int shrink=0 ) const;
inline DbU::Unit getConstraintXMax () const;
inline DbU::Unit getConstraintYMax () const;
inline Interval getSide ( Flags direction ) const; inline Interval getSide ( Flags direction ) const;
inline Point getCenter () const; inline Point getCenter () const;
inline Box getConstraintBox () const;
inline const vector<Edge*>& getWestEdges () const; inline const vector<Edge*>& getWestEdges () const;
inline const vector<Edge*>& getEastEdges () const; inline const vector<Edge*>& getEastEdges () const;
inline const vector<Edge*>& getNorthEdges () const; inline const vector<Edge*>& getNorthEdges () const;
@ -330,12 +333,21 @@ namespace Anabatic {
: _eastEdges[0]->getOpposite(this)->getXMin() - shrink; } : _eastEdges[0]->getOpposite(this)->getXMin() - shrink; }
inline DbU::Unit GCell::getYMax ( int shrink ) const inline DbU::Unit GCell::getYMax ( int shrink ) const
{ return _northEdges.empty() ? getCell()->getAbutmentBox().getYMax() - shrink { return _northEdges.empty() ? getCell()->getAbutmentBox().getYMax() - shrink
: _northEdges[0]->getOpposite(this)->getYMin() - shrink; } : _northEdges[0]->getOpposite(this)->getYMin() - shrink; }
inline DbU::Unit GCell::getConstraintXMax () const
{ return getXMax( _eastEdges .empty() ? -1 : 0 ); }
inline DbU::Unit GCell::getConstraintYMax () const
{ return getYMax( _northEdges .empty() ? -1 : 0 ); }
inline Point GCell::getCenter () const inline Point GCell::getCenter () const
{ return Point( (getXMin()+getXMax())/2, (getYMin()+getYMax())/2); } { return Point( (getXMin()+getXMax())/2, (getYMin()+getYMax())/2); }
inline Box GCell::getConstraintBox () const
{ return Box( getXMin(), getYMin(), getConstraintXMax(), getConstraintYMax() ); }
inline Interval GCell::getSide ( Flags direction ) const inline Interval GCell::getSide ( Flags direction ) const
{ {
if (direction.isset(Flags::Vertical)) return Interval( getYMin(), getYMax() ); if (direction.isset(Flags::Vertical)) return Interval( getYMin(), getYMax() );

View File

@ -112,7 +112,6 @@ namespace Anabatic {
}; };
// Matrix inline functions. // Matrix inline functions.
inline Box Matrix::getArea () const { return _area; } inline Box Matrix::getArea () const { return _area; }
inline DbU::Unit Matrix::getSide () const { return _side; } inline DbU::Unit Matrix::getSide () const { return _side; }