From 44500a23294281275027f4107e306e861e8cc35b Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Sat, 27 Aug 2016 15:59:12 +0200 Subject: [PATCH] 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. --- anabatic/src/AutoContact.cpp | 12 ++++++------ anabatic/src/AutoContactHTee.cpp | 2 ++ anabatic/src/AutoContactTerminal.cpp | 2 ++ anabatic/src/AutoContactVTee.cpp | 2 ++ anabatic/src/GCell.cpp | 4 +++- anabatic/src/Matrix.cpp | 5 +++++ anabatic/src/anabatic/AutoContactHTee.h | 1 + anabatic/src/anabatic/AutoContactTerminal.h | 1 + anabatic/src/anabatic/AutoContactVTee.h | 1 + anabatic/src/anabatic/GCell.h | 14 +++++++++++++- anabatic/src/anabatic/Matrix.h | 1 - 11 files changed, 36 insertions(+), 9 deletions(-) diff --git a/anabatic/src/AutoContact.cpp b/anabatic/src/AutoContact.cpp index 1ca8e040..c0825178 100644 --- a/anabatic/src/AutoContact.cpp +++ b/anabatic/src/AutoContact.cpp @@ -67,9 +67,9 @@ namespace Anabatic { , _gcell (gcell) , _flags (CntInvalidatedCache|CntInCreationStage) , _dxMin (0) - , _dxMax ((int)DbU::toLambda( _gcell->getXMax()-_gcell->getXMin() )) - , _dyMin (0) - , _dyMax ((int)DbU::toLambda( _gcell->getYMax()-_gcell->getYMin() )) + , _dxMax ((int)DbU::toLambda(gcell->getConstraintXMax())) + , _dyMin () + , _dyMax ((int)DbU::toLambda(gcell->getConstraintYMax())) { _allocateds++; _gcell->addContact ( this ); @@ -257,7 +257,7 @@ namespace Anabatic { { if (isUserNativeConstraints()) return getConstraintBox(); if (isFixed()) return Box(_contact->getPosition()); - return _gcell->getBoundingBox(); + return _gcell->getConstraintBox(); } @@ -316,8 +316,8 @@ namespace Anabatic { _contact->setPosition( _gcell->getCenter() ); _dxMin = 0; _dyMin = 0; - _dxMax = (int)DbU::toLambda( _gcell->getXMax()-_gcell->getXMin() ); - _dyMax = (int)DbU::toLambda( _gcell->getYMax()-_gcell->getYMin() ); + _dxMax = (int)DbU::toLambda( gcell->getConstraintXMax() ); + _dyMax = (int)DbU::toLambda( gcell->getConstraintYMax() ); if (cdebug.enabled()) { int dxMin = _dxMin; int dyMin = _dyMin; diff --git a/anabatic/src/AutoContactHTee.cpp b/anabatic/src/AutoContactHTee.cpp index 31e455ed..d14baa7d 100644 --- a/anabatic/src/AutoContactHTee.cpp +++ b/anabatic/src/AutoContactHTee.cpp @@ -49,6 +49,8 @@ namespace Anabatic { AutoContactHTee* AutoContactHTee::create ( GCell* gcell, Net* net, const Layer* layer ) { + _preCreate( gcell, net, layer ); + DbU::Unit viaSide = Session::getViaWidth( layer ); Contact* contact = Contact::create ( net , layer diff --git a/anabatic/src/AutoContactTerminal.cpp b/anabatic/src/AutoContactTerminal.cpp index 94196938..ca01b6a9 100644 --- a/anabatic/src/AutoContactTerminal.cpp +++ b/anabatic/src/AutoContactTerminal.cpp @@ -88,6 +88,8 @@ namespace Anabatic { cdebug_log(145,0) << "AutoContactTerminal::create(... x, y, ...)" << endl; cdebug_log(145,0) << "@ x:" << DbU::getValueString(x) << " y:" << DbU::getValueString(y) << endl; + _preCreate( gcell, anchor->getNet(), layer ); + Point anchorPosition = anchor->getPosition(); Contact* contact = Contact::create( anchor diff --git a/anabatic/src/AutoContactVTee.cpp b/anabatic/src/AutoContactVTee.cpp index 28764a13..d5816618 100644 --- a/anabatic/src/AutoContactVTee.cpp +++ b/anabatic/src/AutoContactVTee.cpp @@ -49,6 +49,8 @@ namespace Anabatic { AutoContactVTee* AutoContactVTee::create ( GCell* gcell, Net* net, const Layer* layer ) { + _preCreate( gcell, net, layer ); + DbU::Unit viaSide = Session::getViaWidth( layer ); Contact* contact = Contact::create( net , layer diff --git a/anabatic/src/GCell.cpp b/anabatic/src/GCell.cpp index 72abc23e..b59b12e4 100644 --- a/anabatic/src/GCell.cpp +++ b/anabatic/src/GCell.cpp @@ -553,6 +553,8 @@ namespace Anabatic { { const GCell* current = this; + if (not this) cerr << Error("*this* is NULL!") << endl; + while ( current ) { 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() ); _anabatic->_updateLookup( this ); - _anabatic->getMatrix()->show(); + //_anabatic->getMatrix()->show(); cdebug_tabw(110,-1); } diff --git a/anabatic/src/Matrix.cpp b/anabatic/src/Matrix.cpp index 9a5db8d4..4f210ed0 100644 --- a/anabatic/src/Matrix.cpp +++ b/anabatic/src/Matrix.cpp @@ -73,10 +73,14 @@ namespace Anabatic { 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); cdebug_log(110,0) << "Matrix::getUnder() (" << DbU::getValueString(x) << " " << DbU::getValueString(y) << ") index:" << index << endl; + return (index < 0) ? NULL : _gcells[index]->getUnder(x,y); } @@ -133,6 +137,7 @@ namespace Anabatic { cdebug_tabw(110,-1); } + void Matrix::show () const { cdebug_log(111,0) << this << endl; diff --git a/anabatic/src/anabatic/AutoContactHTee.h b/anabatic/src/anabatic/AutoContactHTee.h index 2181f38c..b46c0b7a 100644 --- a/anabatic/src/anabatic/AutoContactHTee.h +++ b/anabatic/src/anabatic/AutoContactHTee.h @@ -31,6 +31,7 @@ namespace Anabatic { class AutoContactHTee : public AutoContact { + typedef AutoContact Super; friend class AutoContact; public: static AutoContactHTee* create ( GCell*, Net*, const Layer* ); diff --git a/anabatic/src/anabatic/AutoContactTerminal.h b/anabatic/src/anabatic/AutoContactTerminal.h index 6da7dde2..d179ca81 100644 --- a/anabatic/src/anabatic/AutoContactTerminal.h +++ b/anabatic/src/anabatic/AutoContactTerminal.h @@ -28,6 +28,7 @@ namespace Anabatic { class AutoContactTerminal : public AutoContact { + typedef AutoContact Super; friend class AutoContact; public: static AutoContactTerminal* create ( GCell* gcell diff --git a/anabatic/src/anabatic/AutoContactVTee.h b/anabatic/src/anabatic/AutoContactVTee.h index e682fbe9..e819fe88 100644 --- a/anabatic/src/anabatic/AutoContactVTee.h +++ b/anabatic/src/anabatic/AutoContactVTee.h @@ -28,6 +28,7 @@ namespace Anabatic { class AutoContactVTee : public AutoContact { + typedef AutoContact Super; friend class AutoContact; public: static AutoContactVTee* create ( GCell*, Net*, const Layer* ); diff --git a/anabatic/src/anabatic/GCell.h b/anabatic/src/anabatic/GCell.h index f0c87c54..e26d78b1 100644 --- a/anabatic/src/anabatic/GCell.h +++ b/anabatic/src/anabatic/GCell.h @@ -149,8 +149,11 @@ namespace Anabatic { inline DbU::Unit getYMin () const; inline DbU::Unit getXMax ( 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 Point getCenter () const; + inline Box getConstraintBox () const; inline const vector& getWestEdges () const; inline const vector& getEastEdges () const; inline const vector& getNorthEdges () const; @@ -330,12 +333,21 @@ namespace Anabatic { : _eastEdges[0]->getOpposite(this)->getXMin() - shrink; } 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; } + 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 { 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 { if (direction.isset(Flags::Vertical)) return Interval( getYMin(), getYMax() ); diff --git a/anabatic/src/anabatic/Matrix.h b/anabatic/src/anabatic/Matrix.h index d9903afa..26bc33d7 100644 --- a/anabatic/src/anabatic/Matrix.h +++ b/anabatic/src/anabatic/Matrix.h @@ -112,7 +112,6 @@ namespace Anabatic { }; - // Matrix inline functions. inline Box Matrix::getArea () const { return _area; } inline DbU::Unit Matrix::getSide () const { return _side; }