diff --git a/anabatic/src/AnabaticEngine.cpp b/anabatic/src/AnabaticEngine.cpp index ababcc25..c1c0f50f 100644 --- a/anabatic/src/AnabaticEngine.cpp +++ b/anabatic/src/AnabaticEngine.cpp @@ -405,6 +405,14 @@ namespace Anabatic { } + void AnabaticEngine::updateMatrix() + { + _matrix.setCell( getCell(), Session::getSliceHeight() ); + for ( GCell* gcell : _gcells ){ + gcell->_revalidate(); + } + } + size_t AnabaticEngine::getNetsFromEdge ( const Edge* edge, NetSet& nets ) { size_t count = 0; diff --git a/anabatic/src/Constants.cpp b/anabatic/src/Constants.cpp index 8508d00f..3dfc6b34 100644 --- a/anabatic/src/Constants.cpp +++ b/anabatic/src/Constants.cpp @@ -31,11 +31,13 @@ namespace Anabatic { const unsigned int Flags::Invalidated = (1 << 4); // Flags for GCell objects states only. const unsigned int Flags::DeviceGCell = (1 << 5); - const unsigned int Flags::ChannelGCell = (1 << 6); - const unsigned int Flags::StrutGCell = (1 << 7); - const unsigned int Flags::MatrixGCell = (1 << 8); - const unsigned int Flags::IoPadGCell = (1 << 9); - const unsigned int Flags::Saturated = (1 << 10); + const unsigned int Flags::HChannelGCell = (1 << 6); + const unsigned int Flags::VChannelGCell = (1 << 7); + const unsigned int Flags::HStrutGCell = (1 << 8); + const unsigned int Flags::VStrutGCell = (1 << 9); + const unsigned int Flags::MatrixGCell = (1 << 10); + const unsigned int Flags::IoPadGCell = (1 << 11); + const unsigned int Flags::Saturated = (1 << 12); // Flags for Anabatic objects states only. const unsigned int Flags::DemoMode = (1 << 5); const unsigned int Flags::WarnOnGCellOverload = (1 << 6); @@ -53,7 +55,7 @@ namespace Anabatic { const unsigned int Flags::EndsMask = Source|Target; const unsigned int Flags::DirectionMask = Horizontal|Vertical; const unsigned int Flags::DestroyMask = DestroyGCell|DestroyBaseContact|DestroyBaseSegment; - const unsigned int Flags::GCellTypeMask = DeviceGCell|ChannelGCell|StrutGCell|MatrixGCell|IoPadGCell; + const unsigned int Flags::GCellTypeMask = DeviceGCell|HChannelGCell|VChannelGCell|HStrutGCell|VStrutGCell|MatrixGCell|IoPadGCell; // Flags for functions arguments only. const unsigned int Flags::Create = (1 << 5); const unsigned int Flags::WithPerpands = (1 << 6); @@ -94,19 +96,21 @@ namespace Anabatic { string Flags::_getString () const { string s = ""; - s += (_flags & Horizontal ) ? 'h' : '-'; - s += (_flags & Vertical ) ? 'v' : '-'; - s += (_flags & Source ) ? 'S' : '-'; - s += (_flags & Target ) ? 'T' : '-'; - s += (_flags & DeviceGCell ) ? 'd' : '-'; - s += (_flags & ChannelGCell) ? 'c' : '-'; - s += (_flags & StrutGCell ) ? 's' : '-'; - s += (_flags & MatrixGCell ) ? 'm' : '-'; + s += (_flags & Horizontal ) ? 'h' : '-'; + s += (_flags & Vertical ) ? 'v' : '-'; + s += (_flags & Source ) ? 'S' : '-'; + s += (_flags & Target ) ? 'T' : '-'; + s += (_flags & DeviceGCell ) ? 'd' : '-'; + s += (_flags & HChannelGCell) ? 'c' : '-'; + s += (_flags & VChannelGCell) ? 'c' : '-'; + s += (_flags & HStrutGCell ) ? 's' : '-'; + s += (_flags & VStrutGCell ) ? 's' : '-'; + s += (_flags & MatrixGCell ) ? 'm' : '-'; s += ","; - s += (_flags & Invalidated ) ? 'i' : '-'; - s += (_flags & DestroyGCell) ? 'D' : '-'; - s += (_flags & AboveLayer ) ? 'A' : '-'; - s += (_flags & BelowLayer ) ? 'B' : '-'; + s += (_flags & Invalidated ) ? 'i' : '-'; + s += (_flags & DestroyGCell ) ? 'D' : '-'; + s += (_flags & AboveLayer ) ? 'A' : '-'; + s += (_flags & BelowLayer ) ? 'B' : '-'; return s; } diff --git a/anabatic/src/Dijkstra.cpp b/anabatic/src/Dijkstra.cpp index 0a9451c1..395b3489 100644 --- a/anabatic/src/Dijkstra.cpp +++ b/anabatic/src/Dijkstra.cpp @@ -498,11 +498,10 @@ namespace Anabatic { else targetContact = target->breakGoThrough( _net ); } - if ( (source->getGCell()->getXMin() > target->getGCell()->getXMin()) - or (source->getGCell()->getYMin() > target->getGCell()->getYMin()) ) - std::swap( sourceContact, targetContact ); - if (aligneds.front()->isHorizontal()) { + if (sourceContact->getX() > targetContact->getX()) + std::swap( sourceContact, targetContact ); + segment = Horizontal::create( sourceContact , targetContact , _anabatic->getConfiguration()->getGHorizontalLayer() @@ -511,6 +510,9 @@ namespace Anabatic { ); for ( Edge* through : aligneds ) through->add( segment ); } else { + if (sourceContact->getY() > targetContact->getY()) + std::swap( sourceContact, targetContact ); + segment = Vertical::create( sourceContact , targetContact , _anabatic->getConfiguration()->getGVerticalLayer() diff --git a/anabatic/src/GCell.cpp b/anabatic/src/GCell.cpp index 58ce5c98..72abc23e 100644 --- a/anabatic/src/GCell.cpp +++ b/anabatic/src/GCell.cpp @@ -277,7 +277,7 @@ namespace Anabatic { : Super(anabatic->getCell()) , _observable () , _anabatic (anabatic) - , _flags (Flags::ChannelGCell|Flags::Invalidated) + , _flags (Flags::HChannelGCell|Flags::Invalidated) , _westEdges () , _eastEdges () , _southEdges () @@ -796,7 +796,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/LoadGlobalRouting.cpp b/anabatic/src/LoadGlobalRouting.cpp index ed522f93..56294f6b 100644 --- a/anabatic/src/LoadGlobalRouting.cpp +++ b/anabatic/src/LoadGlobalRouting.cpp @@ -658,9 +658,11 @@ namespace { void _do_xG_xM2 (); void _do_1G_1M3 (); void _do_xG_xM3 (); - void _doChannel (); + void _doHChannel (); + void _doVChannel (); + void _doHStrut (); + void _doVStrut (); void _doDevice (); - void _doStrut (); void _doIoPad (); private: @@ -1086,8 +1088,10 @@ namespace { } } else { if (_gcell->isDevice ()) _doDevice(); - else if (_gcell->isChannel()) _doChannel(); - else if (_gcell->isStrut ()) _doStrut(); + else if (_gcell->isHChannel()) _doHChannel(); + else if (_gcell->isVChannel()) _doVChannel(); + else if (_gcell->isHStrut ()) _doHStrut(); + else if (_gcell->isVStrut ()) _doVStrut(); else if (_gcell->isIoPad ()) _doIoPad(); else throw Bug( "Unmanaged GCell type: %s in %s\n" @@ -2091,7 +2095,7 @@ namespace { void GCellTopology::_doDevice () { cdebug_log(145,1) << "void GCellTopology::_doDevice ()" << _gcell << endl; - + /* // Find NE and SW routing pads Horizontal* hne = NULL; Vertical* vne = NULL; @@ -2140,30 +2144,55 @@ namespace { } } } + // SetExternal + create AutoContact northEast + southWest, Placed center of segment if (hne) cerr << "NE: " << hne << endl; else cerr << "NE: " << vne << endl; if (hsw) cerr << "SW: " << hsw << endl; else cerr << "SW: " << vsw << endl; - + */ /*problem: How to create routing pad with segment only without plugs */ + + // _north, _south, _west, _east => segment GContact + // if nort or east + // detach wire from GContact to AutoContact + // move Segment to wire X (vertical), Y (horizontal) given by AutoContact + // do accordingly for _south and _west + //throw Error( "GCellTopology::_doDevice() Unimplemented, blame goes to E. Lao." ); } - void GCellTopology::_doChannel () + void GCellTopology::_doHChannel () { - /*throw Error( "GCellTopology::_doChannel() Unimplemented, blame goes to E. Lao.\n" + + /*throw Error( "GCellTopology::_doHChannel() Unimplemented, blame goes to E. Lao.\n" " On: %s." , getString(_gcell).c_str() );*/ } - void GCellTopology::_doStrut () + void GCellTopology::_doVChannel () { - //throw Error( "GCellTopology::_doStrut() Unimplemented, blame goes to E. Lao." ); + + /*throw Error( "GCellTopology::_doVChannel() Unimplemented, blame goes to E. Lao.\n" + " On: %s." + , getString(_gcell).c_str() + );*/ + } + + + void GCellTopology::_doHStrut () + { + //throw Error( "GCellTopology::_doHStrut() Unimplemented, blame goes to E. Lao." ); + } + + + void GCellTopology::_doVStrut () + { + //throw Error( "GCellTopology::_doVStrut() Unimplemented, blame goes to E. Lao." ); } diff --git a/anabatic/src/Matrix.cpp b/anabatic/src/Matrix.cpp index 13149d6c..9a5db8d4 100644 --- a/anabatic/src/Matrix.cpp +++ b/anabatic/src/Matrix.cpp @@ -122,23 +122,27 @@ namespace Anabatic { int index = indexMin.index(); while ( index <= indexMax.index() ) { + cdebug_log(110,0) << "i,j = " << index2i(index) << "," << index2j(index) + << " " << getGridPoint(index) << endl; if (updateArea.contains(getGridPoint(index))) _gcells[index] = gcell; - if (index <= indexMax.j()) ++index; - else index += _imax - xspan; + if (index2j(index) <= indexMax.j()) ++index; + else index += _imax - xspan; } cdebug_tabw(110,-1); } - void Matrix::show () const { cdebug_log(111,0) << this << endl; for ( size_t i=0 ; i<_gcells.size() ; ++i ) { - cdebug_log(111,0) << "[" << setw(3) << setfill('0') << i << setfill(' ') << "] (" - << setw(3) << index2i(i) << "," - << setw(3) << index2j(i) << ") " << _gcells[i] << endl; + //cdebug_log(111,0) << "[" << setw(3) << setfill('0') << i << setfill(' ') << "] (" + // << setw(3) << index2i(i) << "," + // << setw(3) << index2j(i) << ") " << _gcells[i] << endl; + cdebug_log(111,0) << "[" << i << "] (" + << index2i(i) << "," + << index2j(i) << ") " << _gcells[i] << endl; } } diff --git a/anabatic/src/anabatic/AnabaticEngine.h b/anabatic/src/anabatic/AnabaticEngine.h index 32cb9bb3..2f271784 100644 --- a/anabatic/src/anabatic/AnabaticEngine.h +++ b/anabatic/src/anabatic/AnabaticEngine.h @@ -208,6 +208,7 @@ namespace Anabatic { inline const NetDatas& getNetDatas () const; NetData* getNetData ( Net*, unsigned int flags=Flags::NoFlags ); void setupNetDatas (); + void updateMatrix (); // Dijkstra related functions. inline int getStamp () const; inline int incStamp (); diff --git a/anabatic/src/anabatic/Constants.h b/anabatic/src/anabatic/Constants.h index 139801d0..edde5d73 100644 --- a/anabatic/src/anabatic/Constants.h +++ b/anabatic/src/anabatic/Constants.h @@ -33,8 +33,10 @@ namespace Anabatic { static const unsigned int Invalidated ; // = (1 << 4); // Flags for GCell objects states only. static const unsigned int DeviceGCell ; // = (1 << 5); - static const unsigned int ChannelGCell ; // = (1 << 6); - static const unsigned int StrutGCell ; // = (1 << 7); + static const unsigned int HChannelGCell ; // = (1 << 6); + static const unsigned int VChannelGCell ; // = (1 << 6); + static const unsigned int HStrutGCell ; // = (1 << 7); + static const unsigned int VStrutGCell ; // = (1 << 7); static const unsigned int MatrixGCell ; // = (1 << 8); static const unsigned int IoPadGCell ; // = (1 << 9); static const unsigned int Saturated ; // = (1 << 10); @@ -55,7 +57,7 @@ namespace Anabatic { static const unsigned int EndsMask ; // = Source|Target; static const unsigned int DirectionMask ; // = Horizontal|Vertical; static const unsigned int DestroyMask ; // = DestroyGCell|DestroyBaseContact|DestroyBaseSegment; - static const unsigned int GCellTypeMask ; // = DeviceGCell|ChannelGCell|StrutGCell|MatrixGCell|IoPadGCell; + static const unsigned int GCellTypeMask ; // = DeviceGCell|HChannelGCell|VChannelGCell|HStrutGCell|VStrutGCell|MatrixGCell|IoPadGCell; // Flags for functions arguments only. static const unsigned int Create ; // = (1 << 5); static const unsigned int WithPerpands ; diff --git a/anabatic/src/anabatic/GCell.h b/anabatic/src/anabatic/GCell.h index e7d1a1e5..f0c87c54 100644 --- a/anabatic/src/anabatic/GCell.h +++ b/anabatic/src/anabatic/GCell.h @@ -131,8 +131,10 @@ namespace Anabatic { inline bool isVFlat () const; inline bool isFlat () const; inline bool isDevice () const; - inline bool isChannel () const; - inline bool isStrut () const; + inline bool isHChannel () const; + inline bool isVChannel () const; + inline bool isHStrut () const; + inline bool isVStrut () const; inline bool isMatrix () const; inline bool isIoPad () const; bool isWest ( GCell* ) const; @@ -231,8 +233,8 @@ namespace Anabatic { void _add ( Edge* edge, Flags side ); void _remove ( Edge* edge, Flags side=Flags::AllSides ); void _destroyEdges (); - private: void _revalidate (); + private: void _moveEdges ( GCell* dest, size_t ibegin, Flags flags ); public: // Observers. @@ -290,8 +292,10 @@ namespace Anabatic { inline bool GCell::isVFlat () const { return getXMin() == getXMax(); } inline bool GCell::isFlat () const { return isHFlat() or isVFlat(); } inline bool GCell::isDevice () const { return _flags & Flags::DeviceGCell; } - inline bool GCell::isChannel () const { return _flags & Flags::ChannelGCell; } - inline bool GCell::isStrut () const { return _flags & Flags::StrutGCell; } + inline bool GCell::isHChannel () const { return _flags & Flags::HChannelGCell; } + inline bool GCell::isVChannel () const { return _flags & Flags::VChannelGCell; } + inline bool GCell::isHStrut () const { return _flags & Flags::HStrutGCell; } + inline bool GCell::isVStrut () const { return _flags & Flags::VStrutGCell; } inline bool GCell::isMatrix () const { return _flags & Flags::MatrixGCell; } inline bool GCell::isIoPad () const { return _flags & Flags::IoPadGCell; } inline bool GCell::isSaturated () const { return _flags & Flags::Saturated; } diff --git a/anabatic/src/anabatic/Matrix.h b/anabatic/src/anabatic/Matrix.h index 2a12465c..d9903afa 100644 --- a/anabatic/src/anabatic/Matrix.h +++ b/anabatic/src/anabatic/Matrix.h @@ -94,6 +94,7 @@ namespace Anabatic { inline GCell* getUnder ( Point ) const; void setCell ( Cell*, DbU::Unit side ); void updateLookup ( GCell* ); + void resize ( Box area, DbU::Unit side ); void show () const; // Inspector support. virtual Record* _getRecord () const;