From e78c3f21ef77f22a4a4244d8a7f3e181a7377dad Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Sat, 20 May 2017 12:33:12 +0200 Subject: [PATCH] Added analog type on segment NetRoutingProperty. * New: In Anabatic_AutoSegments collection, added a Flag to the constructors to allow different behavior between digital and analog modes. For "Aligneds" and "Perpandiculars" collections, now manage a new Flag WithDoglegs to follow aligned globals through local doglegs (for analog nets). Adjust the log level of collections to 144 (formerly 145). * New: In Anabatic::AutoSegment, new flag SegAnalog for segments that are part of an analog net. Note that with this flag, we reach the 32 bits limit... * Change: In Anabatic::Constants, Flags are now declared as BaseFlags objects and *not* uint64_t. This avoids overload resolution problems with arithmetical overload of the operators. The BaseFlags/Flags types are now completly "isolated" from the uint64_t, it has the advantage of showing where unwanted previous implicit conversions where occuring. * Change: In Katana::Constants, Flags values are now of BaseFlags type instead of uint64_t. * Change: In Anabatic::Dijkstra, lots of log cleanup. * Change: In Anabatic::GCell::getSide(), make the "shrink" parameter visible to allow to substract the topmost and rightmost track for axis span computation in AutoSegment::computeOptimal(). Used for analog mode. * Change: In NetRoutingState, added a flag for analog mode. Use uint32_t for the flags type. * New: In Isobar, export the NetRoutingState and NetRoutingExtension objects. --- anabatic/src/AutoHorizontal.cpp | 7 +- anabatic/src/AutoSegment.cpp | 95 +++++-- anabatic/src/AutoSegments.cpp | 102 ++++++-- anabatic/src/AutoVertical.cpp | 7 +- anabatic/src/Constants.cpp | 189 +++++++++----- anabatic/src/Dijkstra.cpp | 174 +++++++------ anabatic/src/GCell.cpp | 8 +- anabatic/src/LoadGlobalRouting.cpp | 5 +- anabatic/src/NetOptimals.cpp | 2 +- anabatic/src/anabatic/AutoContact.h | 22 +- anabatic/src/anabatic/AutoSegment.h | 17 +- anabatic/src/anabatic/AutoSegments.h | 4 +- anabatic/src/anabatic/Constants.h | 117 +++++---- anabatic/src/anabatic/GCell.h | 22 +- crlcore/src/cyclop/Cyclop.cpp | 2 +- hurricane/src/hurricane/Flags.cpp | 8 + hurricane/src/hurricane/Net.cpp | 5 + .../src/hurricane/NetRoutingProperty.cpp | 21 +- hurricane/src/hurricane/hurricane/Flags.h | 16 +- hurricane/src/hurricane/hurricane/Net.h | 1 + .../hurricane/hurricane/NetRoutingProperty.h | 47 ++-- hurricane/src/isobar/CMakeLists.txt | 4 + hurricane/src/isobar/PyHurricane.cpp | 11 + hurricane/src/isobar/PyNet.cpp | 89 +------ hurricane/src/isobar/PyNetRoutingProperty.cpp | 240 ++++++++++++++++++ hurricane/src/isobar/PyNetRoutingState.cpp | 159 ++++++++++++ .../src/isobar/hurricane/isobar/PyHurricane.h | 31 ++- .../hurricane/isobar/PyNetRoutingProperty.h | 59 +++++ .../hurricane/isobar/PyNetRoutingState.h | 59 +++++ katana/src/Constants.cpp | 24 +- katana/src/KatanaEngine.cpp | 2 +- katana/src/Manipulator.cpp | 4 +- katana/src/PyKatanaFlags.cpp | 8 +- katana/src/RoutingEvent.cpp | 5 +- katana/src/katana/Constants.h | 24 +- 35 files changed, 1155 insertions(+), 435 deletions(-) create mode 100644 hurricane/src/isobar/PyNetRoutingProperty.cpp create mode 100644 hurricane/src/isobar/PyNetRoutingState.cpp create mode 100644 hurricane/src/isobar/hurricane/isobar/PyNetRoutingProperty.h create mode 100644 hurricane/src/isobar/hurricane/isobar/PyNetRoutingState.h diff --git a/anabatic/src/AutoHorizontal.cpp b/anabatic/src/AutoHorizontal.cpp index 889c4cc4..820b3167 100644 --- a/anabatic/src/AutoHorizontal.cpp +++ b/anabatic/src/AutoHorizontal.cpp @@ -185,7 +185,7 @@ namespace Anabatic { GCell* gcell = getAutoSource()->getGCell(); GCell* end = getAutoTarget()->getGCell(); - cdebug_log(149,0) << "yprobe: " << DbU::getValueString(yprobe) << endl; + cdebug_log(144,0) << "yprobe: " << DbU::getValueString(yprobe) << endl; if (gcell->getXMin() > end->getXMin()) std::swap( gcell, end ); if (yprobe == gcell->getConstraintYMax()) yprobe--; @@ -808,6 +808,11 @@ namespace Anabatic { segment2->setFlags( SegWeakTerminal1 ); } + if (isAnalog()) { + segment1->setFlags( SegAnalog ); + segment2->setFlags( SegAnalog ); + } + cdebug_log(149,0) << "Session::dogleg[x+1] perpand: " << segment1 << endl; cdebug_log(149,0) << "Session::dogleg[x+2] new paral: " << segment2 << endl; cdebug_log(149,0) << "Session::dogleg[x+0] original: " << this << endl; diff --git a/anabatic/src/AutoSegment.cpp b/anabatic/src/AutoSegment.cpp index 7f8f116d..e8afa042 100644 --- a/anabatic/src/AutoSegment.cpp +++ b/anabatic/src/AutoSegment.cpp @@ -303,9 +303,13 @@ namespace Anabatic { // Class : "Anabatic::AutoSegment". - size_t AutoSegment::_allocateds = 0; - size_t AutoSegment::_globalsCount = 0; - unsigned long AutoSegment::_maxId = 0; + size_t AutoSegment::_allocateds = 0; + size_t AutoSegment::_globalsCount = 0; + bool AutoSegment::_analogMode = false; + + + void AutoSegment::setAnalogMode ( bool state ) { _analogMode = state; } + bool AutoSegment::getAnalogMode () { return _analogMode; } AutoSegment::AutoSegment ( Segment* segment ) @@ -334,6 +338,7 @@ namespace Anabatic { if (source->isTerminal()) setFlags( SegSourceTerminal ); if (target->isTerminal()) setFlags( SegTargetTerminal ); + if (_analogMode) setFlags( SegAnalog ); source->invalidate( Flags::Topology ); } @@ -630,20 +635,20 @@ namespace Anabatic { AutoSegments AutoSegment::getAligneds ( Flags flags ) { - cdebug_log(145,0) << "AutoSegment::getAligneds() - flags:" << flags << endl; + cdebug_log(145,0) << "AutoSegment::getAligneds() - flags:" << flags.asString(FlagsFunction) << endl; return AutoSegments_Aligneds( this, flags ); } AutoSegments AutoSegment::getConnecteds ( Flags flags ) { - cdebug_log(145,0) << "AutoSegment::getConnecteds() - flags:" << flags << endl; + cdebug_log(145,0) << "AutoSegment::getConnecteds() - flags:" << flags.asString(FlagsFunction) << endl; return AutoSegments_Connecteds( this, flags ); } - AutoSegments AutoSegment::getPerpandiculars () - { return AutoSegments_Perpandiculars( this ); } + AutoSegments AutoSegment::getPerpandiculars ( Flags flags ) + { return AutoSegments_Perpandiculars( this, flags ); } bool AutoSegment::checkDepthSpin () const @@ -916,21 +921,50 @@ namespace Anabatic { { cdebug_log(145,1) << "computeOptimal() - " << this << endl; - DbU::Unit optimalMin; - DbU::Unit optimalMax; - DbU::Unit constraintMin; - DbU::Unit constraintMax; + DbU::Unit optimalMin; + DbU::Unit optimalMax; + DbU::Unit constraintMin; + DbU::Unit constraintMax; + vector aligneds; getConstraints( constraintMin, constraintMax ); if (isUserDefined()) { optimalMin = optimalMax = getAxis(); + aligneds.push_back( this ); } else { DbU::Unit minGCell = getOrigin(); DbU::Unit maxGCell = getExtremity(); DbU::Unit terminalMin; DbU::Unit terminalMax; AttractorsMap attractors; + + Flags flags = (isAnalog() ? Flags::WithDoglegs : Flags::NoFlags); + Flags f2 = flags | Flags::WithSelf; + cdebug_log(145,0) << "Test | :" << flags.asString(FlagsFunction) << endl; + + getAligneds( Flags::WithSelf|flags ).fill( aligneds ); + + if (not getGCell()->isMatrix()) { + Flags direction = (isHorizontal()) ? Flags::Vertical : Flags::Horizontal; + Interval gcellSide ( false ); + vector gcells; + DbU::Unit pitch = getPitch(); + + cdebug_log(145,0) << "Using pitch for L/T shrink:" << DbU::getValueString(pitch) << endl; + for ( AutoSegment* aligned : aligneds ) { + aligned->getGCells( gcells ); + for ( GCell* gcell : gcells ) { + gcellSide.intersection( gcell->getSide(direction,pitch) ); + cdebug_log(145,0) << "| gcellSide:" << gcellSide << " (from " << gcell << ")" << endl; + } + } + minGCell = gcellSide.getVMin(); + maxGCell = gcellSide.getVMax(); + } + + cdebug_log(145,0) << "GCell interval [" << DbU::getValueString(minGCell) + << ":" << DbU::getValueString(maxGCell) << "]" << endl; AutoContact* anchor = getAutoSource(); if (anchor->isTerminal()) { @@ -964,9 +998,11 @@ namespace Anabatic { attractors.addAttractor( terminalMax ); } - forEach( AutoSegment*, autoSegment, getPerpandiculars() ) { - cdebug_log(145,1) << "| Perpandicular " << *autoSegment << endl; + for ( AutoSegment* autoSegment : getPerpandiculars(flags) ) { + cdebug_log(145,1) << "| Perpandicular " << autoSegment << endl; if (autoSegment->isGlobal()) { + cdebug_log(145,0) << "Used as global." << endl; + // Sloppy implentation. DbU::Unit perpandMin = autoSegment->getSourceU(); DbU::Unit perpandMax = autoSegment->getTargetU(); @@ -980,7 +1016,7 @@ namespace Anabatic { DbU::Unit terminalMin; DbU::Unit terminalMax; - if (getTerminalInterval( *autoSegment + if (getTerminalInterval( autoSegment , NULL , isHorizontal() , terminalMin @@ -1022,19 +1058,26 @@ namespace Anabatic { setInBound( constraintMin, constraintMax, optimalMin ); setInBound( constraintMin, constraintMax, optimalMax ); - cdebug_log(145,0) << "Applying constraint on: " << this << endl; - setOptimalMin( optimalMin ); - setOptimalMax( optimalMax ); - processeds.insert( this ); - if (not isNotAligned()) { - for ( AutoSegment* autoSegment : getAligneds() ) { - cdebug_log(145,0) << "Applying constraint on: " << autoSegment << endl; - autoSegment->setOptimalMin( optimalMin ); - autoSegment->setOptimalMax( optimalMax ); - processeds.insert( autoSegment ); - } + for ( AutoSegment* aligned : aligneds ) { + cdebug_log(145,0) << "Applying constraint on: " << aligned << endl; + aligned->setOptimalMin( optimalMin ); + aligned->setOptimalMax( optimalMax ); + processeds.insert( aligned ); } + // cdebug_log(145,0) << "Applying constraint on: " << this << endl; + // setOptimalMin( optimalMin ); + // setOptimalMax( optimalMax ); + // processeds.insert( this ); + // if (not isNotAligned()) { + // for ( AutoSegment* autoSegment : getAligneds() ) { + // cdebug_log(145,0) << "Applying constraint on: " << autoSegment << endl; + // autoSegment->setOptimalMin( optimalMin ); + // autoSegment->setOptimalMax( optimalMax ); + // processeds.insert( autoSegment ); + // } + // } + cdebug_tabw(145,-1); } @@ -2295,7 +2338,7 @@ namespace Anabatic { continue; } - if (autoSegment->isHorizontal() xor (flags & Flags::Horizontal)) continue; + if (autoSegment->isHorizontal() xor (bool)(flags & Flags::Horizontal)) continue; cdebug_log(145,0) << "| " << autoSegment << endl; diff --git a/anabatic/src/AutoSegments.cpp b/anabatic/src/AutoSegments.cpp index 5559ba57..0bb8ad8c 100644 --- a/anabatic/src/AutoSegments.cpp +++ b/anabatic/src/AutoSegments.cpp @@ -20,6 +20,36 @@ #include "anabatic/AutoSegment.h" +namespace { + + using namespace Anabatic; + + + AutoContact* isLocalDogleg ( AutoSegment* current, AutoContact* from, AutoSegment* master ) + { + if (not current->isLocal() or not from->isTurn()) return NULL; + + AutoContact* to = current->getOppositeAnchor( from ); + if (not to->isTurn()) return NULL; + + AutoSegment* targetGlobal = to->getPerpandicular( current ); + if (not targetGlobal->isGlobal() or (master->getLayer() != targetGlobal->getLayer())) return NULL; + + cdebug_log(144,0) << "Global aligned though dogleg:" << targetGlobal << endl; + + Interval masterConstraints; + Interval targetConstraints; + master ->getConstraints( masterConstraints ); + targetGlobal->getConstraints( targetConstraints ); + if (not targetConstraints.intersect(masterConstraints)) return NULL; + + return to; + } + + +} // Anonymous namespace. + + namespace Anabatic { using namespace std; @@ -36,7 +66,7 @@ namespace Anabatic { void AutoSegmentStack::push ( AutoContact* contact, AutoSegment* segment ) { - cdebug_log(145,0) << "Stacking " << contact << " + " << segment << endl; + cdebug_log(144,0) << "Stacking " << contact << " + " << segment << endl; push_back( make_pair(contact,segment) ); } @@ -299,9 +329,13 @@ namespace Anabatic { , _stack () { if (not _master) return; - _flags |= (_master->isHorizontal()) ? Flags::Horizontal : Flags::Vertical; - cdebug_log(145,0) << "AutoSegments_Aligneds::Locator::Locator() - _flags:" << _flags << endl; + cdebug_log(145,0) << "Flags:" << _flags.asString(FlagsFunction) << endl; + + _flags |= (_master->isHorizontal()) ? Flags::Horizontal : Flags::Vertical; + if (_flags & Flags::WithDoglegs) _flags |= Flags::WithPerpands; + + cdebug_log(144,0) << "AutoSegments_Aligneds::Locator::Locator() _flags:" << _flags.asString(FlagsFunction) << endl; AutoContact* contact = segment->getAutoSource(); if (contact) _stack.push( contact, segment ); @@ -330,29 +364,45 @@ namespace Anabatic { AutoSegment* sourceSegment = _stack.getAutoSegment (); _stack.pop (); + cdebug_log(144,1) << "Iterate over: " << sourceContact << endl; LocatorHelper helper (sourceContact, _flags); for ( ; helper.isValid() ; helper.progress() ) { AutoSegment* currentSegment = helper.getSegment(); - cdebug_log(145,0) << "Looking at: " << currentSegment << endl; + cdebug_log(144,0) << "| " << currentSegment << endl; if (currentSegment == sourceSegment) continue; - if ( (not (_flags & Flags::NoCheckLayer)) - and AutoSegment::areAlignedsAndDiffLayer(currentSegment,_master)) { - cerr << Error("Aligned segments not in same layer (aligneds locator)\n" - " %s\n" - " %s." - ,getString(_master).c_str() - ,getString(currentSegment).c_str()) << endl; - continue; - } + if (AutoSegment::areAligneds(currentSegment,_master)) { + if ( (not (_flags & Flags::NoCheckLayer)) + and AutoSegment::areAlignedsAndDiffLayer(currentSegment,_master)) { + cerr << Error( "Aligned segments not in same layer (aligneds locator)\n" + " %s\n" + " %s." + ,getString(_master).c_str() + ,getString(currentSegment).c_str() ) << endl; + continue; + } - AutoContact* targetContact = currentSegment->getOppositeAnchor( sourceContact ); - if (targetContact) _stack.push( targetContact, currentSegment ); + AutoContact* targetContact = currentSegment->getOppositeAnchor( sourceContact ); + if (targetContact) _stack.push( targetContact, currentSegment ); + } else { + if (_flags & Flags::WithDoglegs) { + AutoContact* targetContact = isLocalDogleg( currentSegment, sourceContact, _master ); + + if (targetContact) { + cdebug_log(144,0) << "Stacking dogleg global. " << endl; + _stack.push( targetContact, currentSegment ); + continue; + } + } + } } + cdebug_tabw(144,-1); + if (_stack.getAutoSegment() == _master) continue; + if (not AutoSegment::areAligneds(_stack.getAutoSegment(),_master)) continue; break; } } @@ -397,8 +447,8 @@ namespace Anabatic { , _stack () , _perpandiculars() { - cdebug_log(145,0) << "AutoSegments_Perpandiculars::Locator::Locator()" << endl; - cdebug_log(145,0) << " " << _master << endl; + cdebug_log(144,0) << "AutoSegments_Perpandiculars::Locator::Locator(): _flags:" << _flags.asString(FlagsFunction) << endl; + cdebug_log(144,0) << " " << _master << endl; if (not _master) return; if (_master->isHorizontal()) _flags |= Flags::Horizontal; @@ -423,7 +473,7 @@ namespace Anabatic { void AutoSegments_Perpandiculars::Locator::progress () { - cdebug_log(145,1) << "AutoSegments_Perpandiculars::Locator::progress()" << endl; + cdebug_log(144,1) << "AutoSegments_Perpandiculars::Locator::progress()" << endl; if (not _perpandiculars.empty()) _perpandiculars.pop_back(); if (not _perpandiculars.empty()) return; @@ -433,14 +483,14 @@ namespace Anabatic { AutoSegment* sourceSegment = _stack.getAutoSegment(); _stack.pop(); - cdebug_log(145,0) << "Iterate over: " << sourceContact << endl; + cdebug_log(144,0) << "Iterate over: " << sourceContact << endl; LocatorHelper helper (sourceContact, _flags); for ( ; helper.isValid() ; helper.progress() ) { AutoSegment* currentSegment = helper.getSegment(); if (currentSegment == sourceSegment) continue; - cdebug_log(145,0) << "| " << currentSegment << endl; + cdebug_log(144,0) << "| " << currentSegment << endl; if (AutoSegment::areAligneds(currentSegment,_master)) { AutoContact* targetContact = currentSegment->getOppositeAnchor( sourceContact ); @@ -449,7 +499,7 @@ namespace Anabatic { if (_master->getLayer() != currentSegment->getLayer()) { continue; } - cdebug_log(145,0) << "Stacking target. " << endl; + cdebug_log(144,0) << "Stacking target. " << endl; _stack.push( targetContact, currentSegment ); // if ( (_master->isHorizontal() and sourceContact->isHTee()) @@ -463,11 +513,11 @@ namespace Anabatic { // continue; // } - // cdebug_log(145,0) << "Stacking target. " << endl; + // cdebug_log(144,0) << "Stacking target. " << endl; // _stack.push( targetContact, currentSegment ); // } } else { - cdebug_log(145,0) << "No opposite anchor to: " << sourceContact << endl; + cdebug_log(144,0) << "No opposite anchor to: " << sourceContact << endl; } } else { if ( (_flags & Flags::WithDoglegs) and currentSegment->isLocal() and sourceContact->isTurn() ) { @@ -475,13 +525,13 @@ namespace Anabatic { if (targetContact->isTurn()) { AutoSegment* targetGlobal = targetContact->getPerpandicular( currentSegment ); if (targetGlobal->isGlobal() and (_master->getLayer() == targetGlobal->getLayer())) { - cdebug_log(145,0) << "Global aligned though dogleg:" << targetGlobal << endl; + cdebug_log(144,0) << "Global aligned though dogleg:" << targetGlobal << endl; Interval masterConstraints; Interval targetConstraints; _master ->getConstraints( masterConstraints ); targetGlobal->getConstraints( targetConstraints ); if (targetConstraints.intersect(masterConstraints)) { - cdebug_log(145,0) << "Stacking dogleg global. " << endl; + cdebug_log(144,0) << "Stacking dogleg global. " << endl; _stack.push( targetContact, currentSegment ); continue; } @@ -497,7 +547,7 @@ namespace Anabatic { if (not _perpandiculars.empty()) break; } - cdebug_tabw(145,-1); + cdebug_tabw(144,-1); } diff --git a/anabatic/src/AutoVertical.cpp b/anabatic/src/AutoVertical.cpp index 958b1db1..a44da88d 100644 --- a/anabatic/src/AutoVertical.cpp +++ b/anabatic/src/AutoVertical.cpp @@ -181,7 +181,7 @@ namespace Anabatic { GCell* gcell = getAutoSource()->getGCell(); GCell* end = getAutoTarget()->getGCell(); - cdebug_log(149,0) << "xprobe: " << DbU::getValueString(xprobe) << endl; + cdebug_log(144,0) << "xprobe: " << DbU::getValueString(xprobe) << endl; if (gcell->getYMin() > end->getYMin()) std::swap( gcell, end ); if (xprobe == gcell->getConstraintXMax()) xprobe--; @@ -722,6 +722,11 @@ namespace Anabatic { segment2->setFlags( SegWeakTerminal1 ); } + if (isAnalog()) { + segment1->setFlags( SegAnalog ); + segment2->setFlags( SegAnalog ); + } + cdebug_log(149,0) << "Session::dogleg[x+1] perpand: " << segment1 << endl; cdebug_log(149,0) << "Session::dogleg[x+2] new paral: " << segment2 << endl; cdebug_log(149,0) << "Session::dogleg[x+0] original: " << this << endl; diff --git a/anabatic/src/Constants.cpp b/anabatic/src/Constants.cpp index 66b2a2d4..3ebe5f6a 100644 --- a/anabatic/src/Constants.cpp +++ b/anabatic/src/Constants.cpp @@ -14,82 +14,131 @@ // +-----------------------------------------------------------------+ -#include #include "anabatic/Constants.h" namespace Anabatic { using std::string; + using std::ostringstream; + using Hurricane::BaseFlags; - const uint64_t Flags::NoFlags = 0; + + const BaseFlags Flags::NoFlags = 0; // Flags used for both objects states & functions arguments. - const uint64_t Flags::Horizontal = (1L << 0); - const uint64_t Flags::Vertical = (1L << 1); - const uint64_t Flags::Source = (1L << 2); - const uint64_t Flags::Target = (1L << 3); - const uint64_t Flags::Invalidated = (1L << 4); + const BaseFlags Flags::Horizontal = (1L << 0); + const BaseFlags Flags::Vertical = (1L << 1); + const BaseFlags Flags::Source = (1L << 2); + const BaseFlags Flags::Target = (1L << 3); + const BaseFlags Flags::Invalidated = (1L << 4); // Flags for GCell objects states only. - const uint64_t Flags::DeviceGCell = (1L << 5); - const uint64_t Flags::HChannelGCell = (1L << 6); - const uint64_t Flags::VChannelGCell = (1L << 7); - const uint64_t Flags::StrutGCell = (1L << 8); - const uint64_t Flags::MatrixGCell = (1L << 9); - const uint64_t Flags::IoPadGCell = (1L << 10); - const uint64_t Flags::Saturated = (1L << 11); + const BaseFlags Flags::DeviceGCell = (1L << 5); + const BaseFlags Flags::HChannelGCell = (1L << 6); + const BaseFlags Flags::VChannelGCell = (1L << 7); + const BaseFlags Flags::StrutGCell = (1L << 8); + const BaseFlags Flags::MatrixGCell = (1L << 9); + const BaseFlags Flags::IoPadGCell = (1L << 10); + const BaseFlags Flags::Saturated = (1L << 11); // Flags for Anabatic objects states only. - const uint64_t Flags::DemoMode = (1L << 5); - const uint64_t Flags::WarnOnGCellOverload = (1L << 6); - const uint64_t Flags::DestroyGCell = (1L << 7); - const uint64_t Flags::DestroyBaseContact = (1L << 8); - const uint64_t Flags::DestroyBaseSegment = (1L << 9); + const BaseFlags Flags::DemoMode = (1L << 5); + const BaseFlags Flags::WarnOnGCellOverload = (1L << 6); + const BaseFlags Flags::DestroyGCell = (1L << 7); + const BaseFlags Flags::DestroyBaseContact = (1L << 8); + const BaseFlags Flags::DestroyBaseSegment = (1L << 9); // Flags for NetDatas objects states only. - const uint64_t Flags::GlobalRouted = (1L << 5); + const BaseFlags Flags::GlobalRouted = (1L << 5); // Masks. - const uint64_t Flags::WestSide = Horizontal|Target; - const uint64_t Flags::EastSide = Horizontal|Source; - const uint64_t Flags::SouthSide = Vertical |Target; - const uint64_t Flags::NorthSide = Vertical |Source; - const uint64_t Flags::AllSides = WestSide|EastSide|SouthSide|NorthSide ; - const uint64_t Flags::EndsMask = Source|Target; - const uint64_t Flags::DirectionMask = Horizontal|Vertical; - const uint64_t Flags::DestroyMask = DestroyGCell|DestroyBaseContact|DestroyBaseSegment; - const uint64_t Flags::GCellTypeMask = DeviceGCell|HChannelGCell|VChannelGCell|StrutGCell|MatrixGCell|IoPadGCell; + const BaseFlags Flags::WestSide = Horizontal|Target; + const BaseFlags Flags::EastSide = Horizontal|Source; + const BaseFlags Flags::SouthSide = Vertical |Target; + const BaseFlags Flags::NorthSide = Vertical |Source; + const BaseFlags Flags::AllSides = WestSide|EastSide|SouthSide|NorthSide ; + const BaseFlags Flags::EndsMask = Source|Target; + const BaseFlags Flags::DirectionMask = Horizontal|Vertical; + const BaseFlags Flags::DestroyMask = DestroyGCell|DestroyBaseContact|DestroyBaseSegment; + const BaseFlags Flags::GCellTypeMask = DeviceGCell|HChannelGCell|VChannelGCell|StrutGCell|MatrixGCell|IoPadGCell; // Flags for functions arguments only. - const uint64_t Flags::Create = (1L << 5); - const uint64_t Flags::WithPerpands = (1L << 6); - const uint64_t Flags::WithDoglegs = (1L << 7); - const uint64_t Flags::WithSelf = (1L << 8); - const uint64_t Flags::AboveLayer = (1L << 9); - const uint64_t Flags::BelowLayer = (1L << 10); - const uint64_t Flags::OpenSession = (1L << 11); - const uint64_t Flags::Realignate = (1L << 12); - const uint64_t Flags::NativeConstraints = (1L << 13); - const uint64_t Flags::ForceMove = (1L << 14); - const uint64_t Flags::WarnOnError = (1L << 15); - const uint64_t Flags::Topology = (1L << 16); - const uint64_t Flags::GlobalSegment = (1L << 17); - const uint64_t Flags::AllowTerminal = (1L << 18); - const uint64_t Flags::AllowLocal = (1L << 19); - const uint64_t Flags::IgnoreContacts = (1L << 20); - const uint64_t Flags::Propagate = (1L << 21); - const uint64_t Flags::Superior = (1L << 22); - const uint64_t Flags::DoglegOnLeft = (1L << 23); - const uint64_t Flags::DoglegOnRight = (1L << 24); - const uint64_t Flags::WithNeighbors = (1L << 25); - const uint64_t Flags::NoCheckLayer = (1L << 26); - const uint64_t Flags::HalfSlacken = (1L << 27); - const uint64_t Flags::NoGCellShrink = (1L << 28); - const uint64_t Flags::CParanoid = (1L << 29); - const uint64_t Flags::CheckLowDensity = (1L << 30); - const uint64_t Flags::CheckLowUpDensity = (1L << 31); - const uint64_t Flags::NoUpdate = (1L << 32); + const BaseFlags Flags::Create = (1L << 5); + const BaseFlags Flags::WithPerpands = (1L << 6); + const BaseFlags Flags::WithDoglegs = (1L << 7); + const BaseFlags Flags::WithSelf = (1L << 8); + const BaseFlags Flags::AboveLayer = (1L << 9); + const BaseFlags Flags::BelowLayer = (1L << 10); + const BaseFlags Flags::OpenSession = (1L << 11); + const BaseFlags Flags::Realignate = (1L << 12); + const BaseFlags Flags::NativeConstraints = (1L << 13); + const BaseFlags Flags::ForceMove = (1L << 14); + const BaseFlags Flags::WarnOnError = (1L << 15); + const BaseFlags Flags::Topology = (1L << 16); + const BaseFlags Flags::GlobalSegment = (1L << 17); + const BaseFlags Flags::AllowTerminal = (1L << 18); + const BaseFlags Flags::AllowLocal = (1L << 19); + const BaseFlags Flags::IgnoreContacts = (1L << 20); + const BaseFlags Flags::Propagate = (1L << 21); + const BaseFlags Flags::Superior = (1L << 22); + const BaseFlags Flags::DoglegOnLeft = (1L << 23); + const BaseFlags Flags::DoglegOnRight = (1L << 24); + const BaseFlags Flags::WithNeighbors = (1L << 25); + const BaseFlags Flags::NoCheckLayer = (1L << 26); + const BaseFlags Flags::HalfSlacken = (1L << 27); + const BaseFlags Flags::NoGCellShrink = (1L << 28); + const BaseFlags Flags::CParanoid = (1L << 29); + const BaseFlags Flags::CheckLowDensity = (1L << 30); + const BaseFlags Flags::CheckLowUpDensity = (1L << 31); + const BaseFlags Flags::NoUpdate = (1L << 32); Flags::~Flags () { } + string Flags::asString ( uint32_t mode ) const + { + ostringstream s; + + s << ((_flags & (uint64_t)Horizontal ) ? "h" : "-"); + s << ((_flags & (uint64_t)Vertical ) ? "v" : "-"); + s << ((_flags & (uint64_t)Source ) ? "S" : "-"); + s << ((_flags & (uint64_t)Target ) ? "T" : "-"); + s << ((_flags & (uint64_t)Invalidated) ? "i" : "-"); + + switch ( mode ) { + case FlagsFunction: + s << ((_flags & (uint64_t)Create ) ? "C" : "-"); + s << ((_flags & (uint64_t)WithPerpands ) ? "P" : "-"); + s << ((_flags & (uint64_t)WithDoglegs ) ? "D" : "-"); + s << ((_flags & (uint64_t)WithSelf ) ? "s" : "-"); + s << ((_flags & (uint64_t)AboveLayer ) ? "a" : "-"); + s << ((_flags & (uint64_t)BelowLayer ) ? "b" : "-"); + s << ((_flags & (uint64_t)OpenSession ) ? "o" : "-"); + s << ((_flags & (uint64_t)Realignate ) ? "R" : "-"); + s << ((_flags & (uint64_t)NativeConstraints) ? "N" : "-"); + s << ((_flags & (uint64_t)ForceMove ) ? "m" : "-"); + s << ((_flags & (uint64_t)WarnOnError ) ? "w" : "-"); + s << ((_flags & (uint64_t)Topology ) ? "t" : "-"); + s << ((_flags & (uint64_t)GlobalSegment ) ? "G" : "-"); + s << ((_flags & (uint64_t)AllowTerminal ) ? "t" : "-"); + s << ((_flags & (uint64_t)AllowLocal ) ? "l" : "-"); + s << ((_flags & (uint64_t)IgnoreContacts ) ? "i" : "-"); + s << ((_flags & (uint64_t)Propagate ) ? "p" : "-"); + s << ((_flags & (uint64_t)Superior ) ? "S" : "-"); + s << ((_flags & (uint64_t)DoglegOnLeft ) ? "L" : "-"); + s << ((_flags & (uint64_t)DoglegOnRight ) ? "R" : "-"); + s << ((_flags & (uint64_t)WithNeighbors ) ? "N" : "-"); + s << ((_flags & (uint64_t)NoCheckLayer ) ? "L" : "-"); + s << ((_flags & (uint64_t)HalfSlacken ) ? "h" : "-"); + s << ((_flags & (uint64_t)NoGCellShrink ) ? "s" : "-"); + s << ((_flags & (uint64_t)CParanoid ) ? "p" : "-"); + s << ((_flags & (uint64_t)CheckLowDensity ) ? "l" : "-"); + s << ((_flags & (uint64_t)CheckLowUpDensity) ? "u" : "-"); + s << ((_flags & (uint64_t)NoUpdate ) ? "u" : "-"); + break; + } + + s << " (" << value() << ")"; + return s.str(); + } + string Flags::_getTypeName () const { return "Anabatic::Flags"; } @@ -97,20 +146,20 @@ 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 & HChannelGCell) ? 'c' : '-'; - s += (_flags & VChannelGCell) ? 'c' : '-'; - s += (_flags & StrutGCell ) ? 's' : '-'; - s += (_flags & MatrixGCell ) ? 'm' : '-'; + s += (_flags & (uint64_t)Horizontal ) ? 'h' : '-'; + s += (_flags & (uint64_t)Vertical ) ? 'v' : '-'; + s += (_flags & (uint64_t)Source ) ? 'S' : '-'; + s += (_flags & (uint64_t)Target ) ? 'T' : '-'; + s += (_flags & (uint64_t)DeviceGCell ) ? 'd' : '-'; + s += (_flags & (uint64_t)HChannelGCell) ? 'c' : '-'; + s += (_flags & (uint64_t)VChannelGCell) ? 'c' : '-'; + s += (_flags & (uint64_t)StrutGCell ) ? 's' : '-'; + s += (_flags & (uint64_t)MatrixGCell ) ? 'm' : '-'; s += ","; - s += (_flags & Invalidated ) ? 'i' : '-'; - s += (_flags & DestroyGCell ) ? 'D' : '-'; - s += (_flags & AboveLayer ) ? 'A' : '-'; - s += (_flags & BelowLayer ) ? 'B' : '-'; + s += (_flags & (uint64_t)Invalidated ) ? 'i' : '-'; + s += (_flags & (uint64_t)DestroyGCell ) ? 'D' : '-'; + s += (_flags & (uint64_t)AboveLayer ) ? 'A' : '-'; + s += (_flags & (uint64_t)BelowLayer ) ? 'B' : '-'; return s; } diff --git a/anabatic/src/Dijkstra.cpp b/anabatic/src/Dijkstra.cpp index 998e6300..b3ad7cf7 100644 --- a/anabatic/src/Dijkstra.cpp +++ b/anabatic/src/Dijkstra.cpp @@ -1106,21 +1106,22 @@ namespace Anabatic { + "-" + DbU::getValueString(_gcell->getYMin()) + "-" + DbU::getValueString(_gcell->getXMax()) + "-" + DbU::getValueString(_gcell->getYMax()) + ")" - /*+ " rps:" + getString(_rpCount) - + " deg:" + getString(_degree) - + " connexId:" + ((_connexId >= 0) ? getString(_connexId) : "None")*/ + //+ " rps:" + getString(_rpCount) + //+ " deg:" + getString(_degree) + + " connexId:" + ((_connexId >= 0) ? getString(_connexId) : "None") + " d:" + ((_distance == unreached) ? "unreached" : ((_distance == unreachable) ? "unreachable" : DbU::getValueString(_distance)) ) - /*+ "+" + getString(_branchId) - + " stamp:" + (hasValidStamp() ? "valid" : "outdated")*/ + //+ "+" + getString(_branchId) + //+ " stamp:" + (hasValidStamp() ? "valid" : "outdated") + " from:" + ((_from) ? "set" : "NULL") - //+ " from2:" + ((_adata) ? _adata->getFrom2() : "NULL") - + " restricted:" + (isNRestricted() ? "N" : "-") + //+ " from2:" + ((_adata) ? _adata->getFrom2() : "NULL") + + " restricted:" + + (isNRestricted() ? "N" : "-") + (isSRestricted() ? "S" : "-") + (isERestricted() ? "E" : "-") + (isWRestricted() ? "W" : "-") - //+ " isiSet:" +(isiSet() ? "1" : "0") + //+ " isiSet:" +(isiSet() ? "1" : "0") + ">"; return s; } @@ -1241,9 +1242,10 @@ namespace Anabatic { for ( Component* component : _net->getComponents() ) { RoutingPad* rp = dynamic_cast( component ); if (rp) { - if ( _attachSymContactsHook( rp ) ) continue; // ANALOG - rps.push_back( rp ); + if (_attachSymContactsHook(rp)) continue; // ANALOG + cdebug_log(112,0) << "| " << rp << endl; + rps.push_back( rp ); continue; } } @@ -1267,9 +1269,9 @@ namespace Anabatic { continue; } - cdebug_log(112,0) << "Current Search area: " << _searchArea << ", gcell: " << gcell << endl; + cdebug_log(112,0) << "Merge search area: " << _searchArea << ", gcell: " << gcell << endl; _searchArea.merge( gcell->getBoundingBox() ); - cdebug_log(112,0) << "New Search area: " << _searchArea << endl; + cdebug_log(112,0) << "Search area: " << _searchArea << endl; Vertex* seed = gcell->getObserver(GCell::Observable::Vertex); GCell* gseed = seed->getGCell(); @@ -1302,6 +1304,7 @@ namespace Anabatic { } _searchArea.inflate( _searchAreaHalo ); + cdebug_log(112,0) << "Search halo: " << _searchAreaHalo << endl; cdebug_log(112,0) << "Search area: " << _searchArea << endl; setAxisTargets(); @@ -1514,95 +1517,109 @@ namespace Anabatic { { cdebug_log(112,1) << "Dijkstra::_propagate() " << _net << endl; while ( not _queue.empty() ) { - cdebug_log(111,0) << "Number of targets left: " << _targets.size() << " and needaxis? " << needAxisTarget() << endl; + cdebug_log(111,0) << "Number of targets left: " << _targets.size() + << " and needaxis? " << needAxisTarget() << endl; + _queue.dump(); Vertex* current = _queue.top(); GCell* gcurrent = current->getGCell(); - cdebug_log(111,0) << endl << "[Current Vertex]: " << current << ", current->getConnexId() == _connectedsId):" << (current->getConnexId() == _connectedsId)<< ", (current->getConnexId() < 0): " << current->getConnexId() << endl; + cdebug_log(111,1) << "Current:" << current << endl; _queue.pop(); if ( current->isAxisTarget() and needAxisTarget()) unsetFlags(Mode::AxisTarget); else if ((current->getConnexId() == _connectedsId) or (current->getConnexId() < 0)) { + cdebug_log(111,1) << "Looking for neighbors:" << endl; for ( Edge* edge : current->getGCell()->getEdges() ) { - cdebug_log(111,0) << endl << "===================================================================================" << endl << endl; + cdebug_log(111,0) << "@ Edge " << edge << endl; + if (edge == current->getFrom()) { - cdebug_log(111,0) << "edge == current->getFrom()" << endl; + cdebug_log(111,0) << "| Reject: edge == current->getFrom()" << endl; continue; - } else cdebug_log(111,0) << "edge != current->getFrom()" << endl; + } - if (_checkFrom2(edge, current)) continue; // ANALOG + if (_checkFrom2(edge, current)) { // ANALOG + cdebug_log(111,0) << "| Reject: _checkFrom2()" << endl; + continue; + } GCell* gneighbor = edge->getOpposite(current->getGCell()); - Vertex* vneighbor = gneighbor->getObserver(GCell::Observable::Vertex); - if (!gneighbor->isMatrix()) vneighbor->createAData(); + Vertex* vneighbor = gneighbor->getObserver( GCell::Observable::Vertex ); + if (not gneighbor->isMatrix()) vneighbor->createAData(); + + cdebug_log(111,0) << "+ Neighbor:" << vneighbor << endl; if (vneighbor->getConnexId() == _connectedsId) { - cdebug_log(111,0) << "ConnectedsId" << endl; + cdebug_log(111,0) << "| Reject: Neighbor already reached (has connectedsId)" << endl; continue; } if (not _searchArea.intersect(gneighbor->getBoundingBox())) { - cdebug_log(111,0) << "not in _searchArea: " << _searchArea << ", gneighbor area: " << gneighbor->getBoundingBox() << endl; + cdebug_log(111,0) << "| Reject: not in _searchArea: " << _searchArea << ", gneighbor area: " << gneighbor->getBoundingBox() << endl; continue; } ////////////////////////////////////// DEBUG ////////////////////////////////////// - cdebug_log(111,0) << "| Net : " << _net << endl; - cdebug_log(111,0) << "| [Curr]: " << current << endl; + cdebug_tabw(111,1); if (current->getFrom()) { cdebug_log(111,0) << "| From: " << current->getFrom()->getOpposite(gcurrent) << endl; current->getIntervFrom().print(); } if (current->getFrom2()) { - cdebug_log(111,0) << "| FROM2: " << current->getFrom2()->getOpposite(gcurrent) << endl; + cdebug_log(111,0) << "| From2: " << current->getFrom2()->getOpposite(gcurrent) << endl; current->getIntervFrom2().print(); } - cdebug_log(111,0) << "| Edge " << edge << endl; - cdebug_log(111,0) << "+ Neighbor: " << vneighbor << endl; - if ((vneighbor->getFrom() != NULL)&&(vneighbor->hasValidStamp())) { + if ( (vneighbor->getFrom() != NULL) and (vneighbor->hasValidStamp()) ) { cdebug_log(111,0) << "| Neighbor GETFROM:" << vneighbor->getFrom()->getOpposite( gneighbor ) << endl; cdebug_log(111,0) << "Distance prev : " << DbU::getValueString(vneighbor->getDistance()) << endl; } /////////////////////////////////////////////////////////////////////////////////// - cdebug_log(111,0) << "Calc distance1" << endl; DbU::Unit distance = _distanceCb( current, vneighbor, edge ); bool isDistance2shorter = _isDistance2Shorter ( distance, current, vneighbor, edge ); // ANALOG - if ( (distance == vneighbor->getDistance()) and ((!gcurrent->isMatrix()) and (!gneighbor->isMatrix())) ){ + if ( (distance == vneighbor->getDistance()) + and ( (not gcurrent->isMatrix()) and (not gneighbor->isMatrix()) ) ) { _pushEqualDistance( distance, isDistance2shorter, current, vneighbor, edge ); // ANALOG - - } else if ( (distance < vneighbor->getDistance()) and (distance != Vertex::unreachable) ){ - if (vneighbor->getDistance() != Vertex::unreached) _queue.erase( vneighbor ); - else { - if (not vneighbor->hasValidStamp()) { - cdebug_log(111,0) << "[case: Distance FIRST]" << endl; - vneighbor->setConnexId( -1 ); - vneighbor->setStamp ( _stamp ); - vneighbor->setDegree ( 1 ); - vneighbor->setRpCount ( 0 ); - vneighbor->unsetFlags(Vertex::AxisTarget); + } else + if ( (distance < vneighbor->getDistance()) and (distance != Vertex::unreachable) ) { + if (vneighbor->getDistance() != Vertex::unreached) _queue.erase( vneighbor ); + else { + if (not vneighbor->hasValidStamp()) { + cdebug_log(111,0) << "Vertex reached for the first time" << endl; + vneighbor->setConnexId( -1 ); + vneighbor->setStamp ( _stamp ); + vneighbor->setDegree ( 1 ); + vneighbor->setRpCount ( 0 ); + vneighbor->unsetFlags(Vertex::AxisTarget); + } } + cdebug_log(111,0) << "Vertex reached through a shorter path" << endl; + _updateGRAData( vneighbor, isDistance2shorter, current ); // ANALOG + + vneighbor->setBranchId( current->getBranchId() ); + vneighbor->setDistance( distance ); + vneighbor->setFrom ( edge ); + _queue.push( vneighbor ); + cdebug_log(111,0) << "Push: (size:" << _queue.size() << ") " << vneighbor << endl; + } else { + cdebug_log(111,0) << "Reject: Vertex reached through a *longer* path" << endl; } - cdebug_log(111,0) << "[case: Distance INFERIOR]" << endl; - _updateGRAData ( vneighbor, isDistance2shorter, current ); // ANALOG - vneighbor->setBranchId( current->getBranchId() ); - vneighbor->setDistance( distance ); - vneighbor->setFrom ( edge ); - _queue.push( vneighbor ); - cdebug_log(111,0) << "Push: (size:" << _queue.size() << ") " << vneighbor << endl; - } + cdebug_tabw(111,-1); } + cdebug_tabw(111,-2); continue; } + cdebug_tabw(111,-1); + // We did reach another target (different ). // Tag back the path, with a higher . _traceback( current ); + cdebug_tabw(112,-1); return true; } @@ -1611,11 +1628,9 @@ namespace Anabatic { , getString(_net).c_str() ) << endl; - cdebug_tabw(112, 0) << "Targets are: " << endl; - for ( Vertex* v : _targets ) { - cdebug_tabw(112, 0) << v << endl; - } - cdebug_tabw(112, 0) << "End Targets are." << endl; + cdebug_log(112, 0) << "Unreached targets:" << endl; + for ( Vertex* v : _targets ) + cdebug_log(112, 0) << "| " << v << endl; cdebug_tabw(112,-1); return false; @@ -1792,7 +1807,7 @@ namespace Anabatic { void Dijkstra::run ( Dijkstra::Mode mode ) { - DebugSession::open( _net, 112, 120 ); + DebugSession::open( _net, 111, 120 ); cdebug_log(112,1) << "Dijkstra::run() on " << _net << " mode:" << mode << endl; _mode = mode; @@ -2029,14 +2044,14 @@ namespace Anabatic { { if (current->getFrom2()){ if (edge == current->getFrom2()) { - cdebug_log(111,0) << "edge == current->getFrom2()" << endl; + //cdebug_log(111,0) << "edge == current->getFrom2()" << endl; return true; } else { - cdebug_log(111,0) << "edge != current->getFrom2(): " << current->getFrom2() << endl; + //cdebug_log(111,0) << "edge != current->getFrom2(): " << current->getFrom2() << endl; return false; } } else { - cdebug_log(111,0) << "current->getFrom2() = NULL" << endl; + //cdebug_log(111,0) << "current->getFrom2() = NULL" << endl; return false; } } @@ -2044,42 +2059,53 @@ namespace Anabatic { bool Dijkstra::_isDistance2Shorter ( DbU::Unit& distance, Vertex* current, Vertex* vneighbor, Edge* edge ) { + cdebug_log(111,1) << "Dijkstra::_isDistance2Shorter()" << endl; + DbU::Unit distance2 = Vertex::unreachable; bool isDistance2shorter = false; GCell* gneighbor = edge->getOpposite(current->getGCell()); + if (current->getFrom2()) { - cdebug_log(111,0) << "HAS 2nd getfrom" << edge << endl; + cdebug_log(111,0) << "Has second ::getFrom()" << edge << endl; + current->setFlags(Vertex::From2Mode); - cdebug_log(111,0) << "Calc distance2" << endl; distance2 = _distanceCb( current, vneighbor, edge ); current->unsetFlags(Vertex::From2Mode); - cdebug_log(111,0) << "Distance1 curr: " << DbU::getValueString(distance) << endl; - cdebug_log(111,0) << "Distance2 curr: " << DbU::getValueString(distance2) << endl; - if (distance > distance2){ - cdebug_log(111,0) << "=> distance2 is shorter" << endl; + + cdebug_log(111,0) << "Distance 1 from current: " << DbU::getValueString(distance) << endl; + cdebug_log(111,0) << "Distance 2 from current: " << DbU::getValueString(distance2) << endl; + + if (distance > distance2) { + cdebug_log(111,0) << "* Distance 2 is shorter" << endl; + isDistance2shorter = true; distance = distance2; } else if (distance == distance2) { - cdebug_log(111,0) << "distance == distance2" << endl; + cdebug_log(111,0) << "* Distance 1 equal Distance 2" << endl; + Point pcurr = current->getStartPathPoint(vneighbor); - current->setFlags(Vertex::From2Mode); + current->setFlags( Vertex::From2Mode ); Point pcurr2 = current->getStartPathPoint(vneighbor); - current->unsetFlags(Vertex::From2Mode); + current->unsetFlags( Vertex::From2Mode ); Point pnext = gneighbor->getCenter(); - if (calcDistance(pcurr, pnext) > calcDistance(pcurr2, pnext)) { - cdebug_log(111,0) << "=> distance2 is shorter" << endl; + + if (calcDistance(pcurr,pnext) > calcDistance(pcurr2,pnext)) { + cdebug_log(111,0) << "* Distance 2 is shorter" << endl; + isDistance2shorter = true; distance = distance2; } else { - cdebug_log(111,0) << "=> distance1 is shorter" << endl; + cdebug_log(111,0) << "* Distance 1 is shorter" << endl; } } else { - cdebug_log(111,0) << "=> distance1 is shorter" << endl; + cdebug_log(111,0) << "* Distance 1 is shorter" << endl; } } else { - cdebug_log(111,0) << "NO 2nd getfrom" << endl; - cdebug_log(111,0) << "Distance1 curr: " << DbU::getValueString(distance) << endl; + cdebug_log(111,0) << "No second ::getFrom()" << endl; + cdebug_log(111,0) << "Distance 1 from current: " << DbU::getValueString(distance) << endl; } + + cdebug_tabw(111,-1); return isDistance2shorter; } @@ -2245,6 +2271,8 @@ namespace Anabatic { , _net->getCell()->getAbutmentBox().getYMax() ) ); + } else if (gcell->isDevice()){ + _searchArea.merge( _net->getCell()->getAbutmentBox() ); } } else if (gcell->isDevice()){ _searchArea.merge( _net->getCell()->getAbutmentBox() ); diff --git a/anabatic/src/GCell.cpp b/anabatic/src/GCell.cpp index a864a438..67ed9dbf 100644 --- a/anabatic/src/GCell.cpp +++ b/anabatic/src/GCell.cpp @@ -581,10 +581,10 @@ namespace Anabatic { Box GCell::getBorder ( const GCell* s, const GCell* t ) { Flags flags = Flags::NoFlags; - flags |= (s->getXMax() == t->getXMin()) ? Flags::EastSide : 0; - flags |= (t->getXMax() == s->getXMin()) ? Flags::WestSide : 0; - flags |= (s->getYMax() == t->getYMin()) ? Flags::NorthSide : 0; - flags |= (t->getYMax() == s->getYMin()) ? Flags::SouthSide : 0; + flags |= (s->getXMax() == t->getXMin()) ? Flags::EastSide : Flags::NoFlags; + flags |= (t->getXMax() == s->getXMin()) ? Flags::WestSide : Flags::NoFlags; + flags |= (s->getYMax() == t->getYMin()) ? Flags::NorthSide : Flags::NoFlags; + flags |= (t->getYMax() == s->getYMin()) ? Flags::SouthSide : Flags::NoFlags; if (flags & Flags::Vertical) { if (flags & Flags::Horizontal) return Box(); diff --git a/anabatic/src/LoadGlobalRouting.cpp b/anabatic/src/LoadGlobalRouting.cpp index 2b75b81f..fe4801bb 100644 --- a/anabatic/src/LoadGlobalRouting.cpp +++ b/anabatic/src/LoadGlobalRouting.cpp @@ -3411,12 +3411,15 @@ namespace Anabatic { for ( Net* net : getCell()->getNets() ) { if (NetRoutingExtension::isAutomaticGlobalRoute(net)) { - DebugSession::open( net, 145, 150 ); + DebugSession::open( net, 144, 150 ); + AutoSegment::setAnalogMode( NetRoutingExtension::isAnalog(net) ); + cerr << net << " AnalogMode:" << NetRoutingExtension::get(net) << endl; _loadNetGlobalRouting( net ); Session::revalidate(); DebugSession::close(); } } + AutoSegment::setAnalogMode( false ); #if defined(CHECK_DATABASE) _check ( "after Anabatic loading" ); diff --git a/anabatic/src/NetOptimals.cpp b/anabatic/src/NetOptimals.cpp index 90470f59..df9f6301 100644 --- a/anabatic/src/NetOptimals.cpp +++ b/anabatic/src/NetOptimals.cpp @@ -37,7 +37,7 @@ namespace Anabatic { void AnabaticEngine::_computeNetOptimals ( Net* net ) { - DebugSession::open( net, 140, 150 ); + DebugSession::open( net, 144, 150 ); cdebug_log(149,0) << "Anabatic::_computeNetOptimals( " << net << " )" << endl; cdebug_tabw(145,1); diff --git a/anabatic/src/anabatic/AutoContact.h b/anabatic/src/anabatic/AutoContact.h index d738d42e..ae817945 100644 --- a/anabatic/src/anabatic/AutoContact.h +++ b/anabatic/src/anabatic/AutoContact.h @@ -294,13 +294,13 @@ namespace Anabatic { inline LocatorHelper::LocatorHelper ( AutoContact* contact, Flags flags ) : _flags(flags), _index(_min()), _contact(contact) { - cdebug_tabw(145,1); - cdebug_log(145,0) << "CTOR LocatorHelper " << contact->_getString() << endl; - cdebug_log(145,0) << "+ _min():" << _min() << endl; - cdebug_log(145,0) << "+ _max():" << _max() << endl; - cdebug_log(145,0) << "+ getSegment(_min()):" << _contact->getSegment(_min()) << endl; + cdebug_tabw(144,1); + cdebug_log(144,0) << "CTOR LocatorHelper " << contact->_getString() << endl; + cdebug_log(144,0) << "+ _min():" << _min() << endl; + cdebug_log(144,0) << "+ _max():" << _max() << endl; + cdebug_log(144,0) << "+ getSegment(_min()):" << _contact->getSegment(_min()) << endl; if (not _contact->getSegment(_index)) progress(); - cdebug_tabw(145,-1); + cdebug_tabw(144,-1); } inline bool LocatorHelper::isValid () const @@ -314,20 +314,20 @@ namespace Anabatic { inline AutoSegment* LocatorHelper::getSegment () const { - cdebug_log(145,0) << " LocatorHelper::getSegment(" << _index << ") - " << _contact->getSegment(_index) << endl; + cdebug_log(144,0) << " LocatorHelper::getSegment(" << _index << ") - " << _contact->getSegment(_index) << endl; return (_index < _max()) ? _contact->getSegment(_index) : NULL; } inline void LocatorHelper::progress () { - cdebug_tabw(145,1); + cdebug_tabw(144,1); ++_index; - cdebug_log(145,0) << "LocatorHelper::progress() [" << _index << "] " << _contact->getSegment(_index) << endl; + cdebug_log(144,0) << "LocatorHelper::progress() [" << _index << "] " << _contact->getSegment(_index) << endl; while ((_index < _max()) and (_contact->getSegment(_index) == NULL)) { ++_index; - cdebug_log(145,0) << "LocatorHelper::progress() [" << _index << "] " << _contact->getSegment(_index) << endl; + cdebug_log(144,0) << "LocatorHelper::progress() [" << _index << "] " << _contact->getSegment(_index) << endl; } - cdebug_tabw(145,-1); + cdebug_tabw(144,-1); } diff --git a/anabatic/src/anabatic/AutoSegment.h b/anabatic/src/anabatic/AutoSegment.h index c32c654a..8e88f3cf 100644 --- a/anabatic/src/anabatic/AutoSegment.h +++ b/anabatic/src/anabatic/AutoSegment.h @@ -93,6 +93,7 @@ namespace Anabatic { , SegInvalidatedLayer = (1<<28) , SegCreated = (1<<29) , SegUserDefined = (1<<30) + , SegAnalog = (1<<31) // Masks. , SegWeakTerminal = SegStrongTerminal|SegWeakTerminal1|SegWeakTerminal2 , SegNotAligned = SegNotSourceAligned|SegNotTargetAligned @@ -127,7 +128,8 @@ namespace Anabatic { public: typedef std::function< void(AutoSegment*) > RevalidateCb_t; public: - static void setDestroyMode ( bool ); + static void setAnalogMode ( bool ); + static bool getAnalogMode (); static AutoSegment* create ( AutoContact* source , AutoContact* target , Segment* hurricaneSegment @@ -201,6 +203,7 @@ namespace Anabatic { inline bool isUserDefined () const; bool isReduceCandidate () const; bool isUTurn () const; + inline bool isAnalog () const; virtual bool _canSlacken () const = 0; bool canReduce () const; bool mustRaise () const; @@ -312,7 +315,7 @@ namespace Anabatic { AutoSegments getCachedOnTargetContact ( Flags direction ); AutoSegments getAligneds ( Flags flags=Flags::NoFlags ); AutoSegments getConnecteds ( Flags flags=Flags::NoFlags ); - AutoSegments getPerpandiculars (); + AutoSegments getPerpandiculars ( Flags flags=Flags::NoFlags ); size_t getAlignedContacts ( map& ) const ; // Observers. template< typename OwnerT > @@ -337,9 +340,7 @@ namespace Anabatic { // Internal: Static Attributes. static size_t _allocateds; static size_t _globalsCount; - static bool _destroyBase; - static bool _destroyTool; - static unsigned long _maxId; + static bool _analogMode; // Internal: Attributes. const unsigned long _id; GCell* _gcell; @@ -492,6 +493,7 @@ namespace Anabatic { inline bool AutoSegment::isInvalidatedLayer () const { return _flags & SegInvalidatedLayer; } inline bool AutoSegment::isCreated () const { return _flags & SegCreated; } inline bool AutoSegment::isUserDefined () const { return _flags & SegUserDefined; } + inline bool AutoSegment::isAnalog () const { return _flags & SegAnalog; } inline void AutoSegment::setFlags ( uint32_t flags ) { _flags |= flags; } inline void AutoSegment::unsetFlags ( uint32_t flags ) { _flags &= ~flags; } @@ -519,10 +521,7 @@ namespace Anabatic { inline bool AutoSegment::CompareId::operator() ( const AutoSegment* lhs, const AutoSegment* rhs ) const { return lhs->getId() < rhs->getId(); } - - inline unsigned long AutoSegment::getMaxId () - { return _maxId; } - + inline uint32_t AutoSegment::swapSourceTargetFlags ( AutoSegment* segment ) { uint32_t segFlags = segment->getFlags(); diff --git a/anabatic/src/anabatic/AutoSegments.h b/anabatic/src/anabatic/AutoSegments.h index 979ad288..44a84447 100644 --- a/anabatic/src/anabatic/AutoSegments.h +++ b/anabatic/src/anabatic/AutoSegments.h @@ -258,7 +258,9 @@ namespace Anabatic { : AutoSegmentHC() , _flags (flags) , _segment(segment) - { } + { + cdebug_log(145,0) << "Flags:" << _flags.asString(FlagsFunction) << std::endl; + } inline AutoSegments_Aligneds::AutoSegments_Aligneds ( const AutoSegments_Aligneds& autosegments ) diff --git a/anabatic/src/anabatic/Constants.h b/anabatic/src/anabatic/Constants.h index 7092fa11..3c482aa1 100644 --- a/anabatic/src/anabatic/Constants.h +++ b/anabatic/src/anabatic/Constants.h @@ -24,72 +24,73 @@ namespace Anabatic { class Flags : public Hurricane::BaseFlags { public: - static const uint64_t NoFlags ; // = 0; + static const BaseFlags NoFlags ; // = 0; // Flags used for both objects states & functions arguments. - static const uint64_t Horizontal ; // = (1 << 0); - static const uint64_t Vertical ; // = (1 << 1); - static const uint64_t Source ; // = (1 << 2); - static const uint64_t Target ; // = (1 << 3); - static const uint64_t Invalidated ; // = (1 << 4); + static const BaseFlags Horizontal ; // = (1 << 0); + static const BaseFlags Vertical ; // = (1 << 1); + static const BaseFlags Source ; // = (1 << 2); + static const BaseFlags Target ; // = (1 << 3); + static const BaseFlags Invalidated ; // = (1 << 4); // Flags for GCell objects states only. - static const uint64_t DeviceGCell ; // = (1 << 5); - static const uint64_t HChannelGCell ; // = (1 << 6); - static const uint64_t VChannelGCell ; // = (1 << 7); - static const uint64_t StrutGCell ; // = (1 << 8); - static const uint64_t MatrixGCell ; // = (1 << 9); - static const uint64_t IoPadGCell ; // = (1 << 10); - static const uint64_t Saturated ; // = (1 << 11); + static const BaseFlags DeviceGCell ; // = (1 << 5); + static const BaseFlags HChannelGCell ; // = (1 << 6); + static const BaseFlags VChannelGCell ; // = (1 << 7); + static const BaseFlags StrutGCell ; // = (1 << 8); + static const BaseFlags MatrixGCell ; // = (1 << 9); + static const BaseFlags IoPadGCell ; // = (1 << 10); + static const BaseFlags Saturated ; // = (1 << 11); // Flags for Anabatic objects states only. - static const uint64_t DemoMode ; // = (1 << 5); - static const uint64_t WarnOnGCellOverload ; // = (1 << 6); - static const uint64_t DestroyGCell ; // = (1 << 7); - static const uint64_t DestroyBaseContact ; // = (1 << 8); - static const uint64_t DestroyBaseSegment ; // = (1 << 9); + static const BaseFlags DemoMode ; // = (1 << 5); + static const BaseFlags WarnOnGCellOverload ; // = (1 << 6); + static const BaseFlags DestroyGCell ; // = (1 << 7); + static const BaseFlags DestroyBaseContact ; // = (1 << 8); + static const BaseFlags DestroyBaseSegment ; // = (1 << 9); // Flags for NetDatas objects states only. - static const uint64_t GlobalRouted ; // = (1 << 5); + static const BaseFlags GlobalRouted ; // = (1 << 5); // Masks. - static const uint64_t WestSide ; // = Horizontal|Target; - static const uint64_t EastSide ; // = Horizontal|Source; - static const uint64_t SouthSide ; // = Vertical |Target; - static const uint64_t NorthSide ; // = Vertical |Source; - static const uint64_t AllSides ; // = WestSide|EastSide|SouthSide|NorthSide ; - static const uint64_t EndsMask ; // = Source|Target; - static const uint64_t DirectionMask ; // = Horizontal|Vertical; - static const uint64_t DestroyMask ; // = DestroyGCell|DestroyBaseContact|DestroyBaseSegment; - static const uint64_t GCellTypeMask ; // = DeviceGCell|HChannelGCell|VChannelGCell|StrutGCell|MatrixGCell|IoPadGCell; + static const BaseFlags WestSide ; // = Horizontal|Target; + static const BaseFlags EastSide ; // = Horizontal|Source; + static const BaseFlags SouthSide ; // = Vertical |Target; + static const BaseFlags NorthSide ; // = Vertical |Source; + static const BaseFlags AllSides ; // = WestSide|EastSide|SouthSide|NorthSide ; + static const BaseFlags EndsMask ; // = Source|Target; + static const BaseFlags DirectionMask ; // = Horizontal|Vertical; + static const BaseFlags DestroyMask ; // = DestroyGCell|DestroyBaseContact|DestroyBaseSegment; + static const BaseFlags GCellTypeMask ; // = DeviceGCell|HChannelGCell|VChannelGCell|StrutGCell|MatrixGCell|IoPadGCell; // Flags for functions arguments only. - static const uint64_t Create ; // = (1 << 5); - static const uint64_t WithPerpands ; - static const uint64_t WithDoglegs ; - static const uint64_t WithSelf ; - static const uint64_t AboveLayer ; - static const uint64_t BelowLayer ; - static const uint64_t OpenSession ; - static const uint64_t Realignate ; - static const uint64_t NativeConstraints ; - static const uint64_t ForceMove ; - static const uint64_t WarnOnError ; - static const uint64_t Topology ; - static const uint64_t GlobalSegment ; - static const uint64_t AllowTerminal ; - static const uint64_t AllowLocal ; - static const uint64_t IgnoreContacts ; - static const uint64_t Propagate ; - static const uint64_t Superior ; - static const uint64_t DoglegOnLeft ; - static const uint64_t DoglegOnRight ; - static const uint64_t WithNeighbors ; - static const uint64_t NoCheckLayer ; - static const uint64_t HalfSlacken ; - static const uint64_t NoGCellShrink ; - static const uint64_t CParanoid ; - static const uint64_t CheckLowDensity ; - static const uint64_t CheckLowUpDensity ; - static const uint64_t NoUpdate ; + static const BaseFlags Create ; // = (1 << 5); + static const BaseFlags WithPerpands ; + static const BaseFlags WithDoglegs ; + static const BaseFlags WithSelf ; + static const BaseFlags AboveLayer ; + static const BaseFlags BelowLayer ; + static const BaseFlags OpenSession ; + static const BaseFlags Realignate ; + static const BaseFlags NativeConstraints ; + static const BaseFlags ForceMove ; + static const BaseFlags WarnOnError ; + static const BaseFlags Topology ; + static const BaseFlags GlobalSegment ; + static const BaseFlags AllowTerminal ; + static const BaseFlags AllowLocal ; + static const BaseFlags IgnoreContacts ; + static const BaseFlags Propagate ; + static const BaseFlags Superior ; + static const BaseFlags DoglegOnLeft ; + static const BaseFlags DoglegOnRight ; + static const BaseFlags WithNeighbors ; + static const BaseFlags NoCheckLayer ; + static const BaseFlags HalfSlacken ; + static const BaseFlags NoGCellShrink ; + static const BaseFlags CParanoid ; + static const BaseFlags CheckLowDensity ; + static const BaseFlags CheckLowUpDensity ; + static const BaseFlags NoUpdate ; public: inline Flags ( uint64_t flags = NoFlags ); inline Flags ( const Hurricane::BaseFlags& ); virtual ~Flags (); + virtual std::string asString ( uint32_t mode ) const; virtual std::string _getTypeName () const; virtual std::string _getString () const; }; @@ -99,6 +100,10 @@ namespace Anabatic { Flags::Flags ( const Hurricane::BaseFlags& flags ) : BaseFlags(flags) { } + enum FlagsMode { FlagsFunction = 1 + }; + + enum EngineState { EngineCreation = 1 , EngineGlobalLoaded = 2 , EngineActive = 3 diff --git a/anabatic/src/anabatic/GCell.h b/anabatic/src/anabatic/GCell.h index 2e6662f9..8958fcc7 100644 --- a/anabatic/src/anabatic/GCell.h +++ b/anabatic/src/anabatic/GCell.h @@ -155,9 +155,9 @@ namespace Anabatic { inline DbU::Unit getYMax ( int shrink=0 ) const; inline DbU::Unit getXCenter () const; inline DbU::Unit getYCenter () const; - inline DbU::Unit getConstraintXMax () const; - inline DbU::Unit getConstraintYMax () const; - inline Interval getSide ( Flags direction ) const; + inline DbU::Unit getConstraintXMax ( int shrink=0 ) const; + inline DbU::Unit getConstraintYMax ( int shrink=0 ) const; + inline Interval getSide ( Flags direction, int shrink=0 ) const; inline Point getCenter () const; inline Box getConstraintBox () const; inline const vector& getWestEdges () const; @@ -340,7 +340,7 @@ namespace Anabatic { inline Flags& GCell::flags () { return _flags; } inline DbU::Unit GCell::getXMax ( int shrink ) const - { return _eastEdges.empty() ? getCell()->getAbutmentBox().getXMax() - shrink + { return _eastEdges.empty() ? getCell()->getAbutmentBox().getXMax() - shrink : _eastEdges[0]->getOpposite(this)->getXMin() - shrink; } inline DbU::Unit GCell::getYMax ( int shrink ) const @@ -350,11 +350,11 @@ namespace Anabatic { inline DbU::Unit GCell::getXCenter () const { return (getXMin()+getXMax())/2; } inline DbU::Unit GCell::getYCenter () const { return (getYMin()+getYMax())/2; } - inline DbU::Unit GCell::getConstraintXMax () const - { return getXMax( _eastEdges.empty() ? 0 : 1 ); } + inline DbU::Unit GCell::getConstraintXMax ( int shrink ) const + { return getXMax( shrink + (_eastEdges.empty() ? 0 : 1) ); } - inline DbU::Unit GCell::getConstraintYMax () const - { return getYMax( _northEdges.empty() ? 0 : 1 ); } + inline DbU::Unit GCell::getConstraintYMax ( int shrink ) const + { return getYMax( shrink + (_northEdges.empty() ? 0 : 1) ); } inline Point GCell::getCenter () const { return Point( (getXMin()+getXMax())/2, (getYMin()+getYMax())/2); } @@ -362,10 +362,10 @@ namespace Anabatic { inline Box GCell::getConstraintBox () const { return Box( getXMin(), getYMin(), getConstraintXMax(), getConstraintYMax() ); } - inline Interval GCell::getSide ( Flags direction ) const + inline Interval GCell::getSide ( Flags direction, int shrink ) const { - if (direction.isset(Flags::Vertical)) return Interval( getYMin(), getConstraintYMax() ); - return Interval( getXMin(), getConstraintXMax() ); + if (direction.isset(Flags::Vertical)) return Interval( getYMin(), getConstraintYMax(shrink) ); + return Interval( getXMin(), getConstraintXMax(shrink) ); } inline void GCell::setObserver ( size_t slot, BaseObserver* observer ) diff --git a/crlcore/src/cyclop/Cyclop.cpp b/crlcore/src/cyclop/Cyclop.cpp index 70ee6adf..2b5a8d8f 100644 --- a/crlcore/src/cyclop/Cyclop.cpp +++ b/crlcore/src/cyclop/Cyclop.cpp @@ -71,7 +71,7 @@ namespace CRL { connect ( openAction, SIGNAL(triggered()), this, SLOT(openCell()) ); } - QMenu* debugMenu = createDebugMenu (); + /*QMenu* debugMenu =*/ createDebugMenu (); _stressDisplayAction = new QAction ( tr("Stress Display"), this ); _stressDisplayAction->setObjectName ( "viewer.menuBar.debug.stressDisplay" ); _stressDisplayAction->setStatusTip ( tr("Intensive use of display redrawing") ); diff --git a/hurricane/src/hurricane/Flags.cpp b/hurricane/src/hurricane/Flags.cpp index b764800e..5e6d2e74 100644 --- a/hurricane/src/hurricane/Flags.cpp +++ b/hurricane/src/hurricane/Flags.cpp @@ -41,6 +41,14 @@ namespace Hurricane { { } + string BaseFlags::asString ( uint32_t ) const + { + std::ostringstream formatted; + formatted << _flags; + return formatted.str(); + } + + string BaseFlags::_getTypeName () const { return "Flags"; } diff --git a/hurricane/src/hurricane/Net.cpp b/hurricane/src/hurricane/Net.cpp index d4861668..7fd24af7 100644 --- a/hurricane/src/hurricane/Net.cpp +++ b/hurricane/src/hurricane/Net.cpp @@ -32,6 +32,7 @@ #include "hurricane/Pad.h" #include "hurricane/UpdateSession.h" #include "hurricane/NetExternalComponents.h" +#include "hurricane/NetRoutingProperty.h" namespace Hurricane { @@ -514,6 +515,10 @@ void Net::setDirection(const Direction& direction) _direction = direction; } +void Net::setRoutingState(uint32_t state) +// ************************************** +{ NetRoutingExtension::get(this)->setFlags( state ); } + bool Net::hasAlias(const Name& name) const // *************************************** { diff --git a/hurricane/src/hurricane/NetRoutingProperty.cpp b/hurricane/src/hurricane/NetRoutingProperty.cpp index a067d706..915b1755 100644 --- a/hurricane/src/hurricane/NetRoutingProperty.cpp +++ b/hurricane/src/hurricane/NetRoutingProperty.cpp @@ -49,6 +49,7 @@ namespace Hurricane { s += (isSymHorizontal ()) ? 'h' : '-'; s += (isSymVertical ()) ? 'v' : '-'; s += (isSymMaster ()) ? 'M' : '-'; + s += (isAnalog ()) ? 'A' : '-'; return s; } @@ -164,8 +165,8 @@ namespace Hurricane { { check( stack, "JsonNetRoutingProperty::toData" ); - string sflags = get( stack, "_state" ); - unsigned int flags = 0; + string sflags = get( stack, "_state" ); + uint32_t flags = 0; flags |= (sflags[0] == 'e') ? NetRoutingState::Excluded : 0; flags |= (sflags[1] == 'f') ? NetRoutingState::Fixed : 0; @@ -176,6 +177,7 @@ namespace Hurricane { flags |= (sflags[6] == 'h') ? NetRoutingState::Horizontal : 0; flags |= (sflags[7] == 'v') ? NetRoutingState::Vertical : 0; flags |= (sflags[8] == 'M') ? NetRoutingState::SymmetricMaster : 0; + flags |= (sflags[9] == 'A') ? NetRoutingState::Analog : 0; NetRoutingProperty* property = NULL; DBo* dbo = stack.back_dbo(); @@ -188,7 +190,7 @@ namespace Hurricane { , getString(net).c_str() ) << endl; NetRoutingState* state = property->getState(); - state->unsetFlags( (unsigned int)-1 ); + state->unsetFlags( (uint32_t)-1 ); state->setFlags ( flags ); state->setSymAxis( DbU::fromDb( get(stack,"_axis") ) ); } else { @@ -231,15 +233,16 @@ namespace Hurricane { } - NetRoutingState* NetRoutingExtension::create ( Net* net ) + NetRoutingState* NetRoutingExtension::create ( Net* net, uint32_t flags ) { get( net ); - if (_cache) return _cache; + if (not _cache) { + NetRoutingProperty* property = new NetRoutingProperty( net ); + net->put( property ); - NetRoutingProperty* property = new NetRoutingProperty( net ); - net->put( property ); - - _cache = property->getState(); + _cache = property->getState(); + } + _cache->setFlags( flags ); return _cache; } diff --git a/hurricane/src/hurricane/hurricane/Flags.h b/hurricane/src/hurricane/hurricane/Flags.h index be243968..46085480 100644 --- a/hurricane/src/hurricane/hurricane/Flags.h +++ b/hurricane/src/hurricane/hurricane/Flags.h @@ -85,6 +85,9 @@ namespace Hurricane { inline bool operator < ( uint64_t ) const; inline bool operator > ( uint64_t ) const; inline operator bool () const; + inline uint64_t value () const; + virtual std::string asString ( uint32_t mode ) const; + inline operator uint64_t () const; //inline operator unsigned int () const; // Hurricane Managment. virtual std::string _getTypeName () const; @@ -97,7 +100,7 @@ namespace Hurricane { // Inline Functions. - inline BaseFlags::BaseFlags ( uint64_t flags ) : _flags(flags) { } + inline BaseFlags::BaseFlags ( uint64_t flags ) : _flags(flags) { } inline bool BaseFlags::zero () const { return _flags == 0; } inline BaseFlags& BaseFlags::reset ( BaseFlags flags ) { _flags &= ~flags._flags; return *this; } inline bool BaseFlags::isset ( BaseFlags flags ) const { return _flags & flags._flags; } @@ -137,6 +140,8 @@ namespace Hurricane { inline bool BaseFlags::operator < ( uint64_t flags ) const { return _flags < flags; } inline bool BaseFlags::operator > ( uint64_t flags ) const { return _flags > flags; } inline BaseFlags::operator bool () const { return _flags != 0; } + inline uint64_t BaseFlags::value () const { return _flags; } + inline BaseFlags::operator uint64_t () const { return _flags; } //inline BaseFlags::operator unsigned int () const { return _flags; } //inline BaseFlags::operator unsigned int () const { return _flags; } @@ -164,6 +169,15 @@ namespace Hurricane { return record; } + // inline BaseFlags operator bitor ( const BaseFlags& lhs, const BaseFlags& rhs ) { BaseFlags r( lhs ); r |= rhs; return r; } + // inline BaseFlags operator bitor ( const BaseFlags& lhs, uint64_t rhs ) { BaseFlags r( lhs ); r |= rhs; return r; } + // inline BaseFlags operator bitor ( uint64_t lhs, const BaseFlags& rhs ) { BaseFlags r( rhs ); r |= lhs; return r; } + // inline BaseFlags operator bitand ( const BaseFlags& lhs, const BaseFlags& rhs ) { BaseFlags r( lhs ); r &= rhs; return r; } + // inline BaseFlags operator bitand ( const BaseFlags& lhs, uint64_t rhs ) { BaseFlags r( lhs ); r &= rhs; return r; } + // inline BaseFlags operator bitand ( uint64_t lhs, const BaseFlags& rhs ) { BaseFlags r( rhs ); r &= lhs; return r; } + // inline BaseFlags operator^ ( const BaseFlags& lhs, const BaseFlags& rhs ) { BaseFlags r( lhs ); r ^= rhs; return r; } + // inline BaseFlags operator^ ( const BaseFlags& lhs, uint64_t rhs ) { BaseFlags r( lhs ); r ^= rhs; return r; } + // inline BaseFlags operator^ ( uint64_t lhs, const BaseFlags& rhs ) { BaseFlags r( rhs ); r ^= lhs; return r; } } // Hurricane namespace. diff --git a/hurricane/src/hurricane/hurricane/Net.h b/hurricane/src/hurricane/hurricane/Net.h index 7eddc371..66da21cb 100644 --- a/hurricane/src/hurricane/hurricane/Net.h +++ b/hurricane/src/hurricane/hurricane/Net.h @@ -233,6 +233,7 @@ class Net : public Entity { public: void setType(const Type& type); public: void setDirection(const Direction& direction); public: void setPosition(const Point& position); + public: void setRoutingState(uint32_t state); public: void materialize(); public: void unmaterialize(); public: bool addAlias(const Name& name); diff --git a/hurricane/src/hurricane/hurricane/NetRoutingProperty.h b/hurricane/src/hurricane/hurricane/NetRoutingProperty.h index 33aa3b6a..4b063254 100644 --- a/hurricane/src/hurricane/hurricane/NetRoutingProperty.h +++ b/hurricane/src/hurricane/hurricane/NetRoutingProperty.h @@ -48,6 +48,7 @@ namespace Hurricane { , Vertical = (1<< 6) , Symmetric = (1<< 7) , SymmetricMaster = (1<< 8) + , Analog = (1<< 9) }; public: inline bool isExcluded () const; @@ -61,31 +62,32 @@ namespace Hurricane { inline bool isSymVertical () const; inline bool isSymMaster () const; inline bool isSymSlave () const; + inline bool isAnalog () const; inline Net* getNet () const; inline Net* getSymNet () const; inline DbU::Unit getSymAxis () const; - inline unsigned int getFlags () const; + inline uint32_t getFlags () const; inline void setSymNet ( Net* ); inline void setSymAxis ( DbU::Unit ); - inline void setFlags ( unsigned int mask ); - inline void unsetFlags ( unsigned int mask ); + inline void setFlags ( uint32_t mask ); + inline void unsetFlags ( uint32_t mask ); inline bool isSelfSym () const; DbU::Unit getSymValue ( DbU::Unit ) const; std::string _getString () const; Record* _getRecord () const; private: - inline NetRoutingState ( Net*, unsigned int flags=0 ); + inline NetRoutingState ( Net*, uint32_t flags=0 ); NetRoutingState ( const NetRoutingState& ) = delete; inline void setNet ( Net* ); private: Net* _net; Net* _symNet; - unsigned int _flags; + uint32_t _flags; DbU::Unit _axis; }; - inline NetRoutingState::NetRoutingState ( Net* net, unsigned int flags ) : _net(net), _symNet(NULL), _flags(flags), _axis(0) { } + inline NetRoutingState::NetRoutingState ( Net* net, uint32_t flags ) : _net(net), _symNet(NULL), _flags(flags), _axis(0) { } inline bool NetRoutingState::isExcluded () const { return _flags & Excluded; }; inline bool NetRoutingState::isFixed () const { return _flags & Fixed; }; @@ -97,17 +99,18 @@ namespace Hurricane { inline bool NetRoutingState::isSymHorizontal () const { return _flags & Horizontal; } inline bool NetRoutingState::isSymVertical () const { return _flags & Vertical; } inline bool NetRoutingState::isSymMaster () const { return _flags & SymmetricMaster; } + inline bool NetRoutingState::isAnalog () const { return _flags & Analog; } inline Net* NetRoutingState::getSymNet () const { return _symNet; } inline DbU::Unit NetRoutingState::getSymAxis () const { return _axis; } - inline unsigned int NetRoutingState::getFlags () const { return _flags; }; + inline uint32_t NetRoutingState::getFlags () const { return _flags; }; inline Net* NetRoutingState::getNet () const { return _net; } - inline void NetRoutingState::setFlags ( unsigned int mask ) { _flags |= mask; } - inline void NetRoutingState::unsetFlags ( unsigned int mask ) { _flags &= ~mask; } + inline void NetRoutingState::setFlags ( uint32_t mask ) { _flags |= mask; } + inline void NetRoutingState::unsetFlags ( uint32_t mask ) { _flags &= ~mask; } inline void NetRoutingState::setNet ( Net* net ) { _net = net; } inline void NetRoutingState::setSymNet ( Net* symNet ) { _symNet = symNet; } inline void NetRoutingState::setSymAxis ( DbU::Unit axis ) { _axis = axis; } - inline bool NetRoutingState::isSelfSym () const { return ( (_symNet == NULL) and (isSymmetric()) ); } - inline bool NetRoutingState::isSymSlave () const { return ( (_symNet != NULL) and (!isSymMaster()) ); } + inline bool NetRoutingState::isSelfSym () const { return (_symNet == NULL) and (isSymmetric()); } + inline bool NetRoutingState::isSymSlave () const { return (_symNet != NULL) and (not isSymMaster()); } // ------------------------------------------------------------------- @@ -169,15 +172,16 @@ namespace Hurricane { static inline bool isSymHorizontal ( const Net* ); static inline bool isSymVertical ( const Net* ); static inline bool isSymMaster ( const Net* ); - static inline unsigned int getFlags ( const Net* ); + static inline bool isAnalog ( const Net* ); + static inline uint32_t getFlags ( const Net* ); static inline Net* getSymNet ( const Net* ); static inline DbU::Unit getSymAxis ( const Net* ); static inline void setSymNet ( const Net*, Net* ); static inline void setSymAxis ( const Net*, DbU::Unit ); - static inline void setFlags ( const Net*, unsigned int mask ); - static inline void unsetFlags ( const Net*, unsigned int mask ); + static inline void setFlags ( const Net*, uint32_t mask ); + static inline void unsetFlags ( const Net*, uint32_t mask ); static NetRoutingState* get ( const Net* ); - static NetRoutingState* create ( Net* ); + static NetRoutingState* create ( Net*, uint32_t flags=0 ); private: static const Net* _owner; static NetRoutingState* _cache; @@ -247,7 +251,14 @@ namespace Hurricane { } - inline unsigned int NetRoutingExtension::getFlags ( const Net* net ) + inline bool NetRoutingExtension::isAnalog ( const Net* net ) + { + NetRoutingState* state = get( net ); + return (state == NULL) ? false : state->isAnalog(); + } + + + inline uint32_t NetRoutingExtension::getFlags ( const Net* net ) { NetRoutingState* state = get( net ); return (state == NULL) ? 0 : state->getFlags(); @@ -268,7 +279,7 @@ namespace Hurricane { } - inline void NetRoutingExtension::setFlags ( const Net* net, unsigned int mask ) + inline void NetRoutingExtension::setFlags ( const Net* net, uint32_t mask ) { NetRoutingState* state = get( net ); if (state != NULL) state->setFlags( mask ); @@ -289,7 +300,7 @@ namespace Hurricane { } - inline void NetRoutingExtension::unsetFlags ( const Net* net, unsigned int mask ) + inline void NetRoutingExtension::unsetFlags ( const Net* net, uint32_t mask ) { NetRoutingState* state = get( net ); if (state != NULL) state->unsetFlags( mask ); diff --git a/hurricane/src/isobar/CMakeLists.txt b/hurricane/src/isobar/CMakeLists.txt index 70a2273d..16e22c7b 100644 --- a/hurricane/src/isobar/CMakeLists.txt +++ b/hurricane/src/isobar/CMakeLists.txt @@ -44,6 +44,8 @@ PyNetDirection.cpp PyNetCollection.cpp PyNetExternalComponents.cpp + PyNetRoutingState.cpp + PyNetRoutingProperty.cpp PyOccurrence.cpp PyOccurrenceCollection.cpp PyHook.cpp @@ -108,6 +110,8 @@ hurricane/isobar/PyNetDirection.h hurricane/isobar/PyNetCollection.h hurricane/isobar/PyNetExternalComponents.h + hurricane/isobar/PyNetRoutingState.h + hurricane/isobar/PyNetRoutingProperty.h hurricane/isobar/PyOccurrence.h hurricane/isobar/PyOccurrenceCollection.h hurricane/isobar/PyHook.h diff --git a/hurricane/src/isobar/PyHurricane.cpp b/hurricane/src/isobar/PyHurricane.cpp index 0a492e1a..3063e5a9 100644 --- a/hurricane/src/isobar/PyHurricane.cpp +++ b/hurricane/src/isobar/PyHurricane.cpp @@ -56,6 +56,8 @@ #include "hurricane/isobar/PyNetDirection.h" #include "hurricane/isobar/PyNetCollection.h" #include "hurricane/isobar/PyNetExternalComponents.h" +#include "hurricane/isobar/PyNetRoutingState.h" +#include "hurricane/isobar/PyNetRoutingProperty.h" #include "hurricane/isobar/PyHyperNet.h" #include "hurricane/isobar/PyHook.h" #include "hurricane/isobar/PyHookCollection.h" @@ -539,6 +541,8 @@ extern "C" { PyPlugCollection_LinkPyType (); PyNetCollection_LinkPyType (); PyNetExternalComponents_LinkPyType (); + PyNetRoutingState_LinkPyType (); + PyNetRoutingExtension_LinkPyType (); PyCellCollection_LinkPyType (); PyPinPlacementStatus_LinkPyType (); PyPinDirection_LinkPyType (); @@ -606,6 +610,8 @@ extern "C" { PYTYPE_READY ( NetDirection ) PYTYPE_READY ( NetCollection ) PYTYPE_READY ( NetCollectionLocator ) + PYTYPE_READY ( NetRoutingState ) + PYTYPE_READY ( NetRoutingExtension ) PYTYPE_READY ( CellCollection ) PYTYPE_READY ( CellCollectionLocator ) PYTYPE_READY ( PinPlacementStatus ) @@ -762,6 +768,10 @@ extern "C" { PyModule_AddObject ( module, "ViaLayer" , (PyObject*)&PyTypeViaLayer ); Py_INCREF ( &PyTypeNetExternalComponents ); PyModule_AddObject ( module, "NetExternalComponents", (PyObject*)&PyTypeNetExternalComponents ); + Py_INCREF ( &PyTypeNetRoutingState ); + PyModule_AddObject ( module, "NetRoutingState" , (PyObject*)&PyTypeNetRoutingState ); + Py_INCREF ( &PyTypeNetRoutingExtension ); + PyModule_AddObject ( module, "NetRoutingExtension" , (PyObject*)&PyTypeNetRoutingExtension ); Py_INCREF ( &PyTypeDebugSession ); PyModule_AddObject ( module, "DebugSession" , (PyObject*)&PyTypeDebugSession ); Py_INCREF ( &PyTypeUpdateSession ); @@ -813,6 +823,7 @@ extern "C" { PyPin_postModuleInit(); PyRoutingPad_postModuleInit(); PyNet_postModuleInit(); + PyNetRoutingState_postModuleInit(); PyInstance_postModuleInit(); PyQuery_postModuleInit(); diff --git a/hurricane/src/isobar/PyNet.cpp b/hurricane/src/isobar/PyNet.cpp index f08981c3..db7765af 100644 --- a/hurricane/src/isobar/PyNet.cpp +++ b/hurricane/src/isobar/PyNet.cpp @@ -46,20 +46,12 @@ extern "C" { Py_DECREF ( constant ); -// x=================================================================x +// +=================================================================+ // | "PyNet" Python Module Code Part | -// x=================================================================x +// +=================================================================+ #if defined(__PYTHON_MODULE__) - - // x-------------------------------------------------------------x - // | "PyNet" Local Functions | - // x-------------------------------------------------------------x - - - // --------------------------------------------------------------- - // Local Function : "PyInt_AsType ()" static Net::Type PyInt_AsType ( PyObject* object ) { switch ( PyAny_AsLong(object) ) { @@ -75,10 +67,6 @@ extern "C" { } - - // --------------------------------------------------------------- - // Local Function : "PyInt_AsDirection ()" - static Net::Direction PyInt_AsDirection ( PyObject* object ) { switch ( PyAny_AsLong(object) ) { @@ -93,9 +81,9 @@ extern "C" { } - // x-------------------------------------------------------------x + // +-------------------------------------------------------------+ // | "PyNet" Attribute Methods | - // x-------------------------------------------------------------x + // +-------------------------------------------------------------+ // Standart Accessors (Attributes). @@ -112,20 +100,15 @@ extern "C" { DirectGetBoolAttribute(PyNet_isSupply ,isSupply ,PyNet,Net) GetBoundStateAttribute(PyNet_IsPyBound ,PyNet,Net) + GetNameMethod(Net, net) + + // Standart modificators. + DirectSetUInt32Attribute(PyNet_setRoutingState,setRoutingState,PyNet,Net) // Standart destroy (Attribute). DBoDestroyAttribute(PyNet_destroy, PyNet) - // --------------------------------------------------------------- - // Attribute Method : "PyNet_getName ()" - - GetNameMethod(Net, net) - - - // --------------------------------------------------------------- - // Attribute Method : "PyNet_create ()" - static PyObject* PyNet_create ( PyObject*, PyObject *args ) { cdebug_log(20,0) << "PyNet_create()" << endl; @@ -146,9 +129,6 @@ extern "C" { } - // --------------------------------------------------------------- - // Attribute Method : "PyNet_getType ()" - static PyObject* PyNet_getType ( PyNet *self ) { cdebug_log(20,0) << "PyNet_getType ()" << endl; @@ -159,10 +139,6 @@ extern "C" { } - - // --------------------------------------------------------------- - // Attribute Method : "PyNet_getDirection ()" - static PyObject* PyNet_getDirection ( PyNet *self ) { cdebug_log(20,0) << "PyNet_getDirection ()" << endl; @@ -173,9 +149,6 @@ extern "C" { } - // --------------------------------------------------------------- - // Attribute Method : "PyNet_getPlugs()" - static PyObject* PyNet_getPlugs(PyNet *self) { cdebug_log(20,0) << "PyNet_getPlugs()" << endl; @@ -198,9 +171,6 @@ extern "C" { } - // --------------------------------------------------------------- - // Attribute Method : "PyNet_getSegments()" - static PyObject* PyNet_getSegments(PyNet *self) { cdebug_log(20,0) << "PyNet_getSegments()" << endl; @@ -223,9 +193,6 @@ extern "C" { } - // --------------------------------------------------------------- - // Attribute Method : "PyNet_getPins()" - static PyObject* PyNet_getPins(PyNet *self) { cdebug_log(20,0) << "PyNet_getPins()" << endl; @@ -248,9 +215,6 @@ extern "C" { } - // --------------------------------------------------------------- - // Attribute Method : "PyNet_getComponents()" - static PyObject* PyNet_getComponents(PyNet *self) { cdebug_log(20,0) << "PyNet_getComponents()" << endl; @@ -271,9 +235,6 @@ extern "C" { } - // --------------------------------------------------------------- - // Attribute Method : "PyNet_getExternalComponents()" - static PyObject* PyNet_getExternalComponents(PyNet *self) { cdebug_log(20,0) << "PyNet_getExternalComponents()" << endl; @@ -294,15 +255,9 @@ extern "C" { } - // --------------------------------------------------------------- - // Attribute Method : "PyNet_setName ()" - SetNameMethod(Net, net) - // --------------------------------------------------------------- - // Attribute Method : "PyNet_setGlobal ()" - static PyObject* PyNet_setGlobal ( PyNet *self, PyObject* args ) { cdebug_log(20,0) << "PyNet_setGlobal()" << endl; @@ -321,10 +276,6 @@ extern "C" { } - - // --------------------------------------------------------------- - // Attribute Method : "PyNet_setExternal ()" - static PyObject* PyNet_setExternal ( PyNet *self, PyObject* args ) { cdebug_log(20,0) << "PyNet_setExternal()" << endl; @@ -343,10 +294,6 @@ extern "C" { } - - // --------------------------------------------------------------- - // Attribute Method : "PyNet_setType ()" - static PyObject* PyNet_setType ( PyNet *self, PyObject* args ) { cdebug_log(20,0) << "PyNet_setType()" << endl; @@ -369,10 +316,6 @@ extern "C" { } - - // --------------------------------------------------------------- - // Attribute Method : "PyNet_setDirection ()" - static PyObject* PyNet_setDirection ( PyNet *self, PyObject* args ) { cdebug_log(20,0) << "PyNet_setDirection()" << endl; @@ -392,9 +335,6 @@ extern "C" { } - // --------------------------------------------------------------- - // Attribute Method : "PyNet_addAlias ()" - static PyObject* PyNet_addAlias ( PyNet *self, PyObject* args ) { cdebug_log(20,0) << "PyNet_addAlias()" << endl; @@ -416,9 +356,6 @@ extern "C" { } - // --------------------------------------------------------------- - // Attribute Method : "PyNet_removeAlias ()" - static PyObject* PyNet_removeAlias ( PyNet *self, PyObject* args ) { cdebug_log(20,0) << "PyNet_removeAlias()" << endl; @@ -440,9 +377,6 @@ extern "C" { } - // --------------------------------------------------------------- - // Attribute Method : "PyNet_setPosition ()" - static PyObject* PyNet_setPosition ( PyNet *self, PyObject* args ) { cdebug_log(20,0) << "PyNet_setPosition()" << endl; @@ -462,9 +396,6 @@ extern "C" { } - // --------------------------------------------------------------- - // Attribute Method : "PyNet_merge ()" - static PyObject* PyNet_merge ( PyNet *self, PyObject* args ) { cdebug_log(20,0) << "PyNet_merge()" << endl; @@ -482,9 +413,6 @@ extern "C" { } - // --------------------------------------------------------------- - // Attribute Method : "PyNet_merge ()" - static PyObject* PyNet_getClone ( PyNet *self, PyObject* args ) { cdebug_log(20,0) << "PyNet_getClone()" << endl; @@ -534,6 +462,7 @@ extern "C" { , { "setType" , (PyCFunction)PyNet_setType , METH_VARARGS, "set the type of the net." } , { "setDirection" , (PyCFunction)PyNet_setDirection , METH_VARARGS, "set the direction of the net." } , { "setPosition" , (PyCFunction)PyNet_setPosition , METH_VARARGS, "set the X,Y location of the net." } + , { "setRoutingState" , (PyCFunction)PyNet_setRoutingState , METH_VARARGS, "set the NetRoutingstate flag (proxy method)." } , { "addAlias" , (PyCFunction)PyNet_addAlias , METH_VARARGS, "Add an alias name to the net." } , { "removeAlias" , (PyCFunction)PyNet_removeAlias , METH_VARARGS, "Remove an alias name from the net." } , { "merge" , (PyCFunction)PyNet_merge , METH_VARARGS, "Merges the net to the net which keeps its characteristics (arity, global, external and direction)." } diff --git a/hurricane/src/isobar/PyNetRoutingProperty.cpp b/hurricane/src/isobar/PyNetRoutingProperty.cpp new file mode 100644 index 00000000..11d179ce --- /dev/null +++ b/hurricane/src/isobar/PyNetRoutingProperty.cpp @@ -0,0 +1,240 @@ +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC 2017-2017, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | I s o b a r - Hurricane / Python Interface | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./PyNetRoutingProperty.cpp" | +// +-----------------------------------------------------------------+ + + +#include "hurricane/isobar/PyNetRoutingProperty.h" +#include "hurricane/isobar/PyNetRoutingState.h" +#include "hurricane/isobar/PyNet.h" + + +namespace Isobar { + + using std::cerr; + using std::endl; + using std::hex; + using std::ostringstream; + using Hurricane::tab; + using Hurricane::Error; + using Hurricane::Warning; + + +extern "C" { + + +#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(NetRoutingExtension,extension,function) + + +// +=================================================================+ +// | "PyNetRoutingExtension" Python Module Code Part | +// +=================================================================+ + +#if defined(__PYTHON_MODULE__) + +# define ExtensionGetBoolFunction(FUNC_NAME,SELF_TYPE) \ + static PyObject* Py##SELF_TYPE##_##FUNC_NAME ( PyObject*, PyObject* args ) \ + { \ + cdebug_log(20,0) << "Py"#FUNC_NAME"()" << endl; \ + bool flag = false; \ + HTRY \ + PyObject* arg0; \ + if (not ParseOneArg(#SELF_TYPE"."#FUNC_NAME"()", args, NET_ARG, &arg0)) return NULL; \ + flag = SELF_TYPE::FUNC_NAME( PYNET_O(arg0) ); \ + HCATCH \ + if (flag) Py_RETURN_TRUE; \ + Py_RETURN_FALSE; \ + } + +# define ExtensionGetUIntFunction(FUNC_NAME,SELF_TYPE) \ + static PyObject* Py##SELF_TYPE##_##FUNC_NAME ( PyObject*, PyObject* args ) \ + { \ + cdebug_log(20,0) << "Py"#FUNC_NAME"()" << endl; \ + uint32_t value = 0; \ + HTRY \ + PyObject* arg0; \ + if (not ParseOneArg(#SELF_TYPE"."#FUNC_NAME"()", args, NET_ARG, &arg0)) return NULL; \ + value = SELF_TYPE::FUNC_NAME( PYNET_O(arg0) ); \ + HCATCH \ + return Py_BuildValue( "I", value ); \ + } + +# define ExtensionGetLongFunction(FUNC_NAME,SELF_TYPE) \ + static PyObject* Py##SELF_TYPE##_##FUNC_NAME ( PyObject*, PyObject* args ) \ + { \ + cdebug_log(20,0) << "Py"#FUNC_NAME"()" << endl; \ + long value = 0; \ + HTRY \ + PyObject* arg0; \ + if (not ParseOneArg(#SELF_TYPE"."#FUNC_NAME"()", args, NET_ARG, &arg0)) return NULL; \ + value = SELF_TYPE::FUNC_NAME( PYNET_O(arg0) ); \ + HCATCH \ + return Py_BuildValue("L",value); \ + } + +# define ExtensionSetUIntFunction(FUNC_NAME,SELF_TYPE) \ + static PyObject* Py##SELF_TYPE##_##FUNC_NAME ( PyObject*, PyObject* args ) \ + { \ + cdebug_log(20,0) << "Py"#FUNC_NAME"()" << endl; \ + HTRY \ + PyObject* arg0 = NULL; \ + PyObject* pyNet = NULL; \ + if (not PyArg_ParseTuple(args,"OO:"#SELF_TYPE"."#FUNC_NAME"()", &pyNet, &arg0)) return NULL; \ + if (not IsPyNet(pyNet)) return NULL; \ + SELF_TYPE::FUNC_NAME( PYNET_O(pyNet), Isobar::PyAny_AsUInt32(arg0) ); \ + HCATCH \ + Py_RETURN_NONE; \ + } + +# define ExtensionSetLongFunction(FUNC_NAME,SELF_TYPE) \ + static PyObject* Py##SELF_TYPE##_##FUNC_NAME ( PyObject*, PyObject* args ) \ + { \ + cdebug_log(20,0) << "Py"#FUNC_NAME"()" << endl; \ + HTRY \ + PyObject* arg0 = NULL; \ + PyObject* pyNet = NULL; \ + if (not PyArg_ParseTuple(args,"OO:"#SELF_TYPE"."#FUNC_NAME"()", &pyNet, &arg0)) return NULL; \ + if (not IsPyNet(pyNet)) return NULL; \ + SELF_TYPE::FUNC_NAME( PYNET_O(pyNet), Isobar::PyAny_AsLong(arg0) ); \ + HCATCH \ + Py_RETURN_NONE; \ + } + + + static void PyNetRoutingExtension_DeAlloc ( PyNetRoutingExtension* self ) + { + cdebug_log(20,0) << "PySingletonObject_DeAlloc(" << hex << self << ")" << endl; + } + + +//ExtensionGetBoolFunction(isExcluded ,NetRoutingExtension) + ExtensionGetBoolFunction(isFixed ,NetRoutingExtension) + ExtensionGetBoolFunction(isUnconnected ,NetRoutingExtension) + ExtensionGetBoolFunction(isManualGlobalRoute ,NetRoutingExtension) + ExtensionGetBoolFunction(isAutomaticGlobalRoute,NetRoutingExtension) + ExtensionGetBoolFunction(isMixedPreRoute ,NetRoutingExtension) + ExtensionGetBoolFunction(isSymmetric ,NetRoutingExtension) + ExtensionGetBoolFunction(isSymHorizontal ,NetRoutingExtension) + ExtensionGetBoolFunction(isSymVertical ,NetRoutingExtension) + ExtensionGetBoolFunction(isSymMaster ,NetRoutingExtension) +//ExtensionGetBoolFunction(isSymSlave ,NetRoutingExtension) +//ExtensionGetBoolFunction(isSelfSym ,NetRoutingExtension) + ExtensionGetBoolFunction(isAnalog ,NetRoutingExtension) + ExtensionGetUIntFunction(getFlags ,NetRoutingExtension) + ExtensionGetLongFunction(getSymAxis ,NetRoutingExtension) + + ExtensionSetUIntFunction(setFlags ,NetRoutingExtension) + ExtensionSetUIntFunction(unsetFlags ,NetRoutingExtension) + ExtensionSetLongFunction(setSymAxis ,NetRoutingExtension) + + + static PyObject* PyNetRoutingExtension_getSymNet ( PyObject*, PyObject* args ) + { + cdebug_log(20,0) << "PyNetRoutingExtension_getSymNet()" << endl; + Net* symNet = NULL; + HTRY + PyObject* arg0; + if (not ParseOneArg("NetRoutingExtension.getSymNet()", args, NET_ARG, &arg0)) return NULL; + symNet = NetRoutingExtension::getSymNet( PYNET_O(arg0) ); + HCATCH + return PyNet_Link(symNet); + } + + + static PyObject* PyNetRoutingExtension_get ( PyObject*, PyObject* args ) + { + cdebug_log(20,0) << "PyNetRoutingExtension_get()" << endl; + + NetRoutingState* state = NULL; + PyObject* arg0 = NULL; + HTRY + if (not ParseOneArg("NetRoutingExtension.get", args, ":ent", &arg0)) return NULL; + state = NetRoutingExtension::get( PYNET_O(arg0) ); + HCATCH + return PyNetRoutingState_Link( state ); + } + + + static PyObject* PyNetRoutingExtension_create ( PyObject*, PyObject* args ) + { + cdebug_log(20,0) << "PyNetRoutingExtension_create()" << endl; + + NetRoutingState* state = NULL; + HTRY + PyObject* pyNet = NULL; + PyObject* pyFlags = NULL; + __cs.init( "NetRoutingExtension.create" ); + + if (not PyArg_ParseTuple(args,"O&|O&:NetRoutingExtension.create", + Converter, &pyNet, + Converter, &pyFlags)) + return NULL; + + if (__cs.getObjectIds() == ":ent" ) { state = NetRoutingExtension::create( PYNET_O(pyNet) ); } + else if (__cs.getObjectIds() == ":ent:int") { state = NetRoutingExtension::create( PYNET_O(pyNet), PyAny_AsLong(pyFlags) ); } + else { + PyErr_SetString( ConstructorError, "invalid/bad number of parameters for NetRoutingExtension.create()." ); + return NULL; + } + HCATCH + return PyNetRoutingState_Link( state ); + } + + + PyMethodDef PyNetRoutingExtension_Methods[] = + { { "isFixed" , (PyCFunction)PyNetRoutingExtension_isFixed , METH_NOARGS |METH_CLASS , "To be documented." } + , { "isUnconnected" , (PyCFunction)PyNetRoutingExtension_isUnconnected , METH_NOARGS |METH_CLASS , "To be documented." } + , { "isManualGlobalRoute" , (PyCFunction)PyNetRoutingExtension_isManualGlobalRoute , METH_NOARGS |METH_CLASS , "To be documented." } + , { "isAutomaticGlobalRoute", (PyCFunction)PyNetRoutingExtension_isAutomaticGlobalRoute, METH_NOARGS |METH_CLASS , "To be documented." } + , { "isMixedPreRoute" , (PyCFunction)PyNetRoutingExtension_isMixedPreRoute , METH_NOARGS |METH_CLASS , "To be documented." } + , { "isSymmetric" , (PyCFunction)PyNetRoutingExtension_isSymmetric , METH_NOARGS |METH_CLASS , "To be documented." } + , { "isSymHorizontal" , (PyCFunction)PyNetRoutingExtension_isSymHorizontal , METH_NOARGS |METH_CLASS , "To be documented." } + , { "isSymVertical" , (PyCFunction)PyNetRoutingExtension_isSymVertical , METH_NOARGS |METH_CLASS , "To be documented." } + , { "isSymMaster" , (PyCFunction)PyNetRoutingExtension_isSymMaster , METH_NOARGS |METH_CLASS , "To be documented." } + //, { "isSymSlave" , (PyCFunction)PyNetRoutingExtension_isSymSlave , METH_NOARGS |METH_CLASS , "To be documented." } + //, { "isSelfSym" , (PyCFunction)PyNetRoutingExtension_isSelfSym , METH_NOARGS |METH_CLASS , "To be documented." } + , { "isAnalog" , (PyCFunction)PyNetRoutingExtension_isAnalog , METH_NOARGS |METH_CLASS , "To be documented." } + , { "getFlags" , (PyCFunction)PyNetRoutingExtension_getFlags , METH_NOARGS |METH_CLASS , "To be documented." } + , { "getSymAxis" , (PyCFunction)PyNetRoutingExtension_getSymAxis , METH_NOARGS |METH_CLASS , "To be documented." } + , { "setFlags" , (PyCFunction)PyNetRoutingExtension_setFlags , METH_VARARGS|METH_CLASS , "To be documented." } + , { "unsetFlags" , (PyCFunction)PyNetRoutingExtension_unsetFlags , METH_VARARGS|METH_CLASS , "To be documented." } + , { "setSymAxis" , (PyCFunction)PyNetRoutingExtension_setSymAxis , METH_VARARGS|METH_CLASS , "To be documented." } + , { "getSymNet" , (PyCFunction)PyNetRoutingExtension_getSymNet , METH_VARARGS|METH_CLASS , "To be documented." } + , { "get" , (PyCFunction)PyNetRoutingExtension_get , METH_VARARGS|METH_CLASS + , "Returns the NetRoutingState, or None has not been created yet." } + , { "create" , (PyCFunction)PyNetRoutingExtension_create , METH_VARARGS|METH_CLASS + , "Returns the NetRoutingState, create it if needs be." } + , {NULL, NULL, 0, NULL} /* sentinel */ + }; + + + PyTypeObjectLinkPyTypeWithoutObject(NetRoutingExtension,NetRoutingExtension) + + +#else // End of Python Module Code Part. + + +// +=================================================================+ +// | "PyNetRoutingExtension" Shared Library Code Part | +// +=================================================================+ + + // Link/Creation Method. + PyTypeObjectDefinitions(NetRoutingExtension) + + +#endif // Shared Library Code Part. + +} // extern "C". + +} // Isobar namespace. + diff --git a/hurricane/src/isobar/PyNetRoutingState.cpp b/hurricane/src/isobar/PyNetRoutingState.cpp new file mode 100644 index 00000000..5cda5a74 --- /dev/null +++ b/hurricane/src/isobar/PyNetRoutingState.cpp @@ -0,0 +1,159 @@ +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC 2017-2017, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | I s o b a r - Hurricane / Python Interface | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./PyNetRoutingState.cpp" | +// +-----------------------------------------------------------------+ + + +#include "hurricane/isobar/PyNetRoutingState.h" +#include "hurricane/isobar/PyNet.h" + + +namespace Isobar { + + using std::cerr; + using std::endl; + using std::hex; + using std::ostringstream; + using Hurricane::tab; + using Hurricane::Error; + using Hurricane::Warning; + + +extern "C" { + + +#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(NetRoutingState,state,function) + + +// +=================================================================+ +// | "PyNetRoutingState" Python Module Code Part | +// +=================================================================+ + +#if defined(__PYTHON_MODULE__) + + + static PyObject* PyNetRoutingState_getNet ( PyNetRoutingState *self ) + { + cdebug_log(20,0) << "PyNetRoutingState_getNet()" << endl; + Net* net = NULL; + HTRY + METHOD_HEAD( "NetRoutingState.getNet()" ) + net = state->getNet(); + HCATCH + return PyNet_Link( net ); + } + + + static PyObject* PyNetRoutingState_getSymNet ( PyNetRoutingState *self ) + { + cdebug_log(20,0) << "PyNetRoutingState_getSymNet()" << endl; + Net* net = NULL; + HTRY + METHOD_HEAD( "NetRoutingState.getSymNet()" ) + net = state->getSymNet(); + HCATCH + return PyNet_Link( net ); + } + + + + // Standart Accessors (Attributes). + DirectGetBoolAttribute(PyNetRoutingState_isExcluded ,isExcluded ,PyNetRoutingState,NetRoutingState) + DirectGetBoolAttribute(PyNetRoutingState_isFixed ,isFixed ,PyNetRoutingState,NetRoutingState) + DirectGetBoolAttribute(PyNetRoutingState_isUnconnected ,isUnconnected ,PyNetRoutingState,NetRoutingState) + DirectGetBoolAttribute(PyNetRoutingState_isManualGlobalRoute ,isManualGlobalRoute ,PyNetRoutingState,NetRoutingState) + DirectGetBoolAttribute(PyNetRoutingState_isAutomaticGlobalRoute,isAutomaticGlobalRoute,PyNetRoutingState,NetRoutingState) + DirectGetBoolAttribute(PyNetRoutingState_isMixedPreRoute ,isMixedPreRoute ,PyNetRoutingState,NetRoutingState) + DirectGetBoolAttribute(PyNetRoutingState_isSymmetric ,isSymmetric ,PyNetRoutingState,NetRoutingState) + DirectGetBoolAttribute(PyNetRoutingState_isSymHorizontal ,isSymHorizontal ,PyNetRoutingState,NetRoutingState) + DirectGetBoolAttribute(PyNetRoutingState_isSymVertical ,isSymVertical ,PyNetRoutingState,NetRoutingState) + DirectGetBoolAttribute(PyNetRoutingState_isSymMaster ,isSymMaster ,PyNetRoutingState,NetRoutingState) + DirectGetBoolAttribute(PyNetRoutingState_isSymSlave ,isSymSlave ,PyNetRoutingState,NetRoutingState) + DirectGetBoolAttribute(PyNetRoutingState_isSelfSym ,isSelfSym ,PyNetRoutingState,NetRoutingState) + DirectGetBoolAttribute(PyNetRoutingState_isAnalog ,isAnalog ,PyNetRoutingState,NetRoutingState) + DirectGetUIntAttribute(PyNetRoutingState_getFlags ,getFlags ,PyNetRoutingState,NetRoutingState) + DirectGetLongAttribute(PyNetRoutingState_getSymAxis ,getSymAxis ,PyNetRoutingState,NetRoutingState) + + // Standart Mutators (Attributes). + DirectSetUInt32Attribute(PyNetRoutingState_setFlags ,setFlags ,PyNetRoutingState,NetRoutingState) + DirectSetUInt32Attribute(PyNetRoutingState_unsetFlags,unsetFlags,PyNetRoutingState,NetRoutingState) + DirectSetLongAttribute (PyNetRoutingState_setSymAxis,setSymAxis,PyNetRoutingState,NetRoutingState) + + + PyMethodDef PyNetRoutingState_Methods[] = + { { "isExcluded" , (PyCFunction)PyNetRoutingState_isExcluded , METH_NOARGS , "To be documented." } + , { "isFixed" , (PyCFunction)PyNetRoutingState_isFixed , METH_NOARGS , "To be documented." } + , { "isUnconnected" , (PyCFunction)PyNetRoutingState_isUnconnected , METH_NOARGS , "To be documented." } + , { "isManualGlobalRoute" , (PyCFunction)PyNetRoutingState_isManualGlobalRoute , METH_NOARGS , "To be documented." } + , { "isAutomaticGlobalRoute", (PyCFunction)PyNetRoutingState_isAutomaticGlobalRoute, METH_NOARGS , "To be documented." } + , { "isMixedPreRoute" , (PyCFunction)PyNetRoutingState_isMixedPreRoute , METH_NOARGS , "To be documented." } + , { "isSymmetric" , (PyCFunction)PyNetRoutingState_isSymmetric , METH_NOARGS , "To be documented." } + , { "isSymHorizontal" , (PyCFunction)PyNetRoutingState_isSymHorizontal , METH_NOARGS , "To be documented." } + , { "isSymVertical" , (PyCFunction)PyNetRoutingState_isSymVertical , METH_NOARGS , "To be documented." } + , { "isSymMaster" , (PyCFunction)PyNetRoutingState_isSymMaster , METH_NOARGS , "To be documented." } + , { "isSymSlave" , (PyCFunction)PyNetRoutingState_isSymSlave , METH_NOARGS , "To be documented." } + , { "isSelfSym" , (PyCFunction)PyNetRoutingState_isSelfSym , METH_NOARGS , "To be documented." } + , { "isAnalog" , (PyCFunction)PyNetRoutingState_isAnalog , METH_NOARGS , "To be documented." } + , { "getFlags" , (PyCFunction)PyNetRoutingState_getFlags , METH_NOARGS , "To be documented." } + , { "getSymAxis" , (PyCFunction)PyNetRoutingState_getSymAxis , METH_NOARGS , "To be documented." } + , { "setFlags" , (PyCFunction)PyNetRoutingState_setFlags , METH_VARARGS , "To be documented." } + , { "unsetFlags" , (PyCFunction)PyNetRoutingState_unsetFlags , METH_VARARGS , "To be documented." } + , { "setSymAxis" , (PyCFunction)PyNetRoutingState_setSymAxis , METH_VARARGS , "To be documented." } + , { "getNet" , (PyCFunction)PyNetRoutingState_getNet , METH_VARARGS , "To be documented." } + , { "getSymNet" , (PyCFunction)PyNetRoutingState_getSymNet , METH_VARARGS , "To be documented." } + , {NULL, NULL, 0, NULL} /* sentinel */ + }; + + PythonOnlyDeleteMethod(NetRoutingState) + PyTypeObjectLinkPyType(NetRoutingState) + + +#else // End of Python Module Code Part. + + +// +=================================================================+ +// | "PyNetRoutingState" Shared Library Code Part | +// +=================================================================+ + + // Link/Creation Method. + PyTypeObjectDefinitions(NetRoutingState) + + + // Link/Creation Method. + LinkCreateMethod(NetRoutingState) + + + extern void PyNetRoutingState_postModuleInit () + { + PyObject* constant; + + LoadObjectConstant(PyTypeNetRoutingState.tp_dict,NetRoutingState::Excluded ,"Excluded" ); + LoadObjectConstant(PyTypeNetRoutingState.tp_dict,NetRoutingState::Fixed ,"Fixed" ); + LoadObjectConstant(PyTypeNetRoutingState.tp_dict,NetRoutingState::Unconnected ,"Unconnected" ); + LoadObjectConstant(PyTypeNetRoutingState.tp_dict,NetRoutingState::ManualGlobalRoute ,"ManualGlobalRoute" ); + LoadObjectConstant(PyTypeNetRoutingState.tp_dict,NetRoutingState::AutomaticGlobalRoute,"AutomaticGlobalRoute"); + LoadObjectConstant(PyTypeNetRoutingState.tp_dict,NetRoutingState::MixedPreRoute ,"MixedPreRoute" ); + LoadObjectConstant(PyTypeNetRoutingState.tp_dict,NetRoutingState::Horizontal ,"Horizontal" ); + LoadObjectConstant(PyTypeNetRoutingState.tp_dict,NetRoutingState::Vertical ,"Vertical" ); + LoadObjectConstant(PyTypeNetRoutingState.tp_dict,NetRoutingState::Symmetric ,"Symmetric" ); + LoadObjectConstant(PyTypeNetRoutingState.tp_dict,NetRoutingState::SymmetricMaster ,"SymmetricMaster" ); + LoadObjectConstant(PyTypeNetRoutingState.tp_dict,NetRoutingState::Analog ,"Analog" ); + } + + +#endif // Shared Library Code Part. + +} // extern "C". + +} // Isobar namespace. + diff --git a/hurricane/src/isobar/hurricane/isobar/PyHurricane.h b/hurricane/src/isobar/hurricane/isobar/PyHurricane.h index aa1e266c..10ac47b4 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyHurricane.h +++ b/hurricane/src/isobar/hurricane/isobar/PyHurricane.h @@ -119,6 +119,15 @@ namespace Isobar { } + inline uint32_t PyAny_AsUInt32 ( PyObject* object ) + { + int64_t value = 0; + if (PyObject_IsInstance(object,(PyObject*)&PyInt_Type )) value = PyInt_AsLong ( object ); + else if (PyObject_IsInstance(object,(PyObject*)&PyLong_Type)) value = PyLong_AsLong( object ); + return (uint32_t)value; + } + + template< typename T = DbU::Unit, typename enable_if< is_same::value, T >::type = 0 > inline T PyAny_AsLong ( PyObject* object ) { @@ -609,15 +618,33 @@ extern "C" { \ HTRY \ PyObject* arg0; \ - if ( ! PyArg_ParseTuple ( args, "O:" #SELF_TYPE"."#FUNC_NAME"()", &arg0 ) ) \ + if (not PyArg_ParseTuple ( args, "O:" #SELF_TYPE"."#FUNC_NAME"()", &arg0 ) ) \ return ( NULL ); \ - cobject->FUNC_NAME ( Isobar::PyAny_AsInt(arg0) ); \ + cobject->FUNC_NAME ( Isobar::PyAny_AsInt(arg0) ); \ HCATCH \ \ Py_RETURN_NONE; \ } +// ------------------------------------------------------------------- +// Attribute Method Macro For uint32_t. + +#define DirectSetUInt32Attribute(PY_FUNC_NAME,FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ + static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* args ) \ + { \ + GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#FUNC_NAME"()") \ + \ + HTRY \ + PyObject* arg0; \ + if (not PyArg_ParseTuple ( args, "O:" #SELF_TYPE"."#FUNC_NAME"()", &arg0 ) ) \ + return ( NULL ); \ + cobject->FUNC_NAME ( Isobar::PyAny_AsUInt32(arg0) ); \ + HCATCH \ + \ + Py_RETURN_NONE; \ + } + // ------------------------------------------------------------------- // Attribute Method Macro For Long. diff --git a/hurricane/src/isobar/hurricane/isobar/PyNetRoutingProperty.h b/hurricane/src/isobar/hurricane/isobar/PyNetRoutingProperty.h new file mode 100644 index 00000000..9950f814 --- /dev/null +++ b/hurricane/src/isobar/hurricane/isobar/PyNetRoutingProperty.h @@ -0,0 +1,59 @@ +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC 2017-2017, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | I s o b a r - Hurricane / Python Interface | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./hurricane/isobar/PyNetRoutingProperty.h" | +// +-----------------------------------------------------------------+ + + +#ifndef PY_NET_ROUTING_PROPERTY_H +#define PY_NET_ROUTING_PROPERTY_H + + +#include "hurricane/isobar/PyHurricane.h" +#include "hurricane/NetRoutingProperty.h" + + +namespace Isobar { + + extern "C" { + + +// ------------------------------------------------------------------- +// Python Object : "PyNetRoutingExtension". + + typedef struct { + PyObject_HEAD + Hurricane::NetRoutingExtension* _object; + } PyNetRoutingExtension; + + +// ------------------------------------------------------------------- +// Functions & Types exported to "PyHurricane.ccp". + + extern PyTypeObject PyTypeNetRoutingExtension; + extern PyMethodDef PyNetRoutingExtension_Methods[]; + + extern PyObject* PyNetRoutingExtension_Link ( Hurricane::NetRoutingExtension* ); + extern void PyNetRoutingExtension_LinkPyType (); + extern void PyNetRoutingExtension_postModuleInit (); + + +# define IsPyNetRoutingExtension(v) ( (v)->ob_type == &PyTypeNetRoutingExtension ) +# define PYNETROUTINGEXTENSION(v) ( (PyNetRoutingExtension*)(v) ) +# define PYNETROUTINGEXTENSION_O(v) ( PYNETROUTINGEXTENSION(v)->_object ) + + + } // extern "C". + +} // Isobar namespace. + +#endif // PY_NET_ROUTING_PROPERTY_H diff --git a/hurricane/src/isobar/hurricane/isobar/PyNetRoutingState.h b/hurricane/src/isobar/hurricane/isobar/PyNetRoutingState.h new file mode 100644 index 00000000..2ce43b34 --- /dev/null +++ b/hurricane/src/isobar/hurricane/isobar/PyNetRoutingState.h @@ -0,0 +1,59 @@ +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC 2017-2017, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | I s o b a r - Hurricane / Python Interface | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./hurricane/isobar/PyNetRoutingState.h" | +// +-----------------------------------------------------------------+ + + +#ifndef PY_NET_ROUTING_STATE_H +#define PY_NET_ROUTING_STATE_H + + +#include "hurricane/isobar/PyHurricane.h" +#include "hurricane/NetRoutingProperty.h" + + +namespace Isobar { + + extern "C" { + + +// ------------------------------------------------------------------- +// Python Object : "PyNetRoutingState". + + typedef struct { + PyObject_HEAD + Hurricane::NetRoutingState* _object; + } PyNetRoutingState; + + +// ------------------------------------------------------------------- +// Functions & Types exported to "PyHurricane.ccp". + + extern PyTypeObject PyTypeNetRoutingState; + extern PyMethodDef PyNetRoutingState_Methods[]; + + extern PyObject* PyNetRoutingState_Link ( Hurricane::NetRoutingState* ); + extern void PyNetRoutingState_LinkPyType (); + extern void PyNetRoutingState_postModuleInit (); + + +# define IsPyNetRoutingState(v) ( (v)->ob_type == &PyTypeNetRoutingState ) +# define PYNETROUTINGSTATE(v) ( (PyNetRoutingState*)(v) ) +# define PYNETROUTINGSTATE_O(v) ( PYNETROUTINGSTATE(v)->_object ) + + + } // extern "C". + +} // Isobar namespace. + +#endif // PY_NET_ROUTING_STATE_H diff --git a/katana/src/Constants.cpp b/katana/src/Constants.cpp index 13e8e283..f968d204 100644 --- a/katana/src/Constants.cpp +++ b/katana/src/Constants.cpp @@ -21,18 +21,18 @@ namespace Katana { - const uint64_t Flags::AllowDoglegReuse = (1 << 20); - const uint64_t Flags::DataSelf = (1 << 21); - const uint64_t Flags::Nearest = (1 << 22); - const uint64_t Flags::Force = (1 << 23); - const uint64_t Flags::ResetCount = (1 << 24); - const uint64_t Flags::WithConstraints = (1 << 25); - const uint64_t Flags::MoveToLeft = (1 << 26); - const uint64_t Flags::MoveToRight = (1 << 27); - const uint64_t Flags::LoadingStage = (1 << 28); - const uint64_t Flags::SlowMotion = (1 << 29); - const uint64_t Flags::PreRoutedStage = (1 << 30); - const uint64_t Flags::SymmetricStage = (1 << 31); + const Hurricane::BaseFlags Flags::AllowDoglegReuse = (1 << 20); + const Hurricane::BaseFlags Flags::DataSelf = (1 << 21); + const Hurricane::BaseFlags Flags::Nearest = (1 << 22); + const Hurricane::BaseFlags Flags::Force = (1 << 23); + const Hurricane::BaseFlags Flags::ResetCount = (1 << 24); + const Hurricane::BaseFlags Flags::WithConstraints = (1 << 25); + const Hurricane::BaseFlags Flags::MoveToLeft = (1 << 26); + const Hurricane::BaseFlags Flags::MoveToRight = (1 << 27); + const Hurricane::BaseFlags Flags::LoadingStage = (1 << 28); + const Hurricane::BaseFlags Flags::SlowMotion = (1 << 29); + const Hurricane::BaseFlags Flags::PreRoutedStage = (1 << 30); + const Hurricane::BaseFlags Flags::SymmetricStage = (1 << 31); } // Anabatic namespace. diff --git a/katana/src/KatanaEngine.cpp b/katana/src/KatanaEngine.cpp index b835a74a..1bf2ed0e 100644 --- a/katana/src/KatanaEngine.cpp +++ b/katana/src/KatanaEngine.cpp @@ -212,7 +212,7 @@ namespace Katana { Super::chipPrep(); - setupGlobalGraph( Flags::NoFlags ); + setupGlobalGraph( 0 ); setupRoutingPlanes(); setupSpecialNets(); setupPreRouteds(); diff --git a/katana/src/Manipulator.cpp b/katana/src/Manipulator.cpp index ade9adf7..3db1b0a2 100644 --- a/katana/src/Manipulator.cpp +++ b/katana/src/Manipulator.cpp @@ -1087,8 +1087,8 @@ namespace Katana { Flags kflags = Flags::WithNeighbors; //kflags |= (flags & AllowLocalMoveUp ) ? Flags::AutoSegment::AllowLocal : 0; - kflags |= (flags & AllowTerminalMoveUp) ? Flags::AllowTerminal : 0; - kflags |= (flags & IgnoreContacts ) ? Flags::IgnoreContacts : 0; + kflags |= (flags & AllowTerminalMoveUp) ? Flags::AllowTerminal : Flags::NoFlags; + kflags |= (flags & IgnoreContacts ) ? Flags::IgnoreContacts : Flags::NoFlags; if (_segment->isFixed()) return false; if (not (flags & AllowLocalMoveUp)) { diff --git a/katana/src/PyKatanaFlags.cpp b/katana/src/PyKatanaFlags.cpp index 0de7f5a7..658472da 100644 --- a/katana/src/PyKatanaFlags.cpp +++ b/katana/src/PyKatanaFlags.cpp @@ -92,10 +92,10 @@ extern "C" { { PyObject* constant; - LoadObjectConstant(PyTypeKatanaFlags.tp_dict,Katana::Flags::NoFlags ,"NoFlags" ); - LoadObjectConstant(PyTypeKatanaFlags.tp_dict,Katana::Flags::SlowMotion ,"SlowMotion" ); - LoadObjectConstant(PyTypeKatanaFlags.tp_dict,Katana::Flags::PreRoutedStage,"PreRoutedStage"); - LoadObjectConstant(PyTypeKatanaFlags.tp_dict,Katana::Flags::SymmetricStage,"SymmetricStage"); + LoadObjectConstant(PyTypeKatanaFlags.tp_dict,(uint64_t)Katana::Flags::NoFlags ,"NoFlags" ); + LoadObjectConstant(PyTypeKatanaFlags.tp_dict,(uint64_t)Katana::Flags::SlowMotion ,"SlowMotion" ); + LoadObjectConstant(PyTypeKatanaFlags.tp_dict,(uint64_t)Katana::Flags::PreRoutedStage,"PreRoutedStage"); + LoadObjectConstant(PyTypeKatanaFlags.tp_dict,(uint64_t)Katana::Flags::SymmetricStage,"SymmetricStage"); } diff --git a/katana/src/RoutingEvent.cpp b/katana/src/RoutingEvent.cpp index fb3a9efe..2df4a67a 100644 --- a/katana/src/RoutingEvent.cpp +++ b/katana/src/RoutingEvent.cpp @@ -53,6 +53,7 @@ namespace Katana { using Hurricane::DebugSession; using Hurricane::Bug; using Hurricane::Error; + using Hurricane::BaseFlags; using Hurricane::ForEachIterator; using Hurricane::Net; using Hurricane::Layer; @@ -91,8 +92,8 @@ namespace Katana { if (lhs._length > rhs._length) return false; if (lhs._length < rhs._length) return true; - if ((lhs._segFlags & Flags::Horizontal) xor (rhs._segFlags & Flags::Horizontal)) - return (rhs._segFlags & Flags::Horizontal); + if ((lhs._segFlags & Anabatic::SegHorizontal) xor (rhs._segFlags & Anabatic::SegHorizontal)) + return (rhs._segFlags & Anabatic::SegHorizontal); if (lhs._axis > rhs._axis) return true; if (lhs._axis < rhs._axis) return false; diff --git a/katana/src/katana/Constants.h b/katana/src/katana/Constants.h index b28e5cd2..016699aa 100644 --- a/katana/src/katana/Constants.h +++ b/katana/src/katana/Constants.h @@ -26,18 +26,18 @@ namespace Katana { public: typedef Anabatic::Flags Super; public: - static const uint64_t AllowDoglegReuse; - static const uint64_t DataSelf; - static const uint64_t Nearest; - static const uint64_t Force; - static const uint64_t ResetCount; - static const uint64_t WithConstraints; - static const uint64_t MoveToLeft; - static const uint64_t MoveToRight; - static const uint64_t LoadingStage; - static const uint64_t SlowMotion; - static const uint64_t PreRoutedStage; - static const uint64_t SymmetricStage; + static const Hurricane::BaseFlags AllowDoglegReuse; + static const Hurricane::BaseFlags DataSelf; + static const Hurricane::BaseFlags Nearest; + static const Hurricane::BaseFlags Force; + static const Hurricane::BaseFlags ResetCount; + static const Hurricane::BaseFlags WithConstraints; + static const Hurricane::BaseFlags MoveToLeft; + static const Hurricane::BaseFlags MoveToRight; + static const Hurricane::BaseFlags LoadingStage; + static const Hurricane::BaseFlags SlowMotion; + static const Hurricane::BaseFlags PreRoutedStage; + static const Hurricane::BaseFlags SymmetricStage; public: inline Flags ( uint64_t ); inline Flags ( const Super& );