From 0b5ce309eb2a60fd3a257e095a9e574660499f05 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Thu, 27 Aug 2020 19:14:44 +0200 Subject: [PATCH] Implement QuadTree pruning to speedup the display of huge designs. When displaying big designs, the drawing was very slow because all the graphical objects were browsed *before* deciding if they were big enough for display. So we introduce a new mode of working of the QuadTree to that the ones with areas *below* a certain thresold just get skipped. Of course, the previous behavior must be preserved (when the threhsold is zero or negative) as most of the time, we *want* *all* the objects under an area, not only the biggest ones. For now, in CellWidget, the visibility threshold is set to 20 pixels. With this, we can display the Libre-SOC "test_issuer" of 100Kgates in between 20 to 30s. * New: In Hurricane::QuadTree_GosUnder collection & locator, add a "threshold" argument so that QuadTree which both area sides are below that lenght will be ignored (no walkthrough at all). Zero (or negative) threshold means that no QuadTree will be pruned, we get back to the previous behavior. * New: In Hurricane::Slice::getComponentsUnder(), add the threshold argument (with a default to 0). * New: In Hurricane::Cell::getInstancesUnder(), add the threshold argument (with a default to 0). * New: In Hurricane::Query, added support for the threshold parameter. In doQuery(), instances that have *both* side under the threshold are pruned (slightly different from QuadTree areas). * New: In Hurricane::CellWidget::_redraw(), set the visibility threshold to 20 pixels (arbitrary, must be parametrized). * New: In Hurricane::Cell, added destroyPhysical() method. Remove *all* physical components and the DeepNets (so make a virtual *unflatten*) in the correct dependency order. In particular, RoutingPads, that relies on Occurrence over physical components must be destroyeds *before* the entity they are based on is destroyed. --- hurricane/src/hurricane/Cell.cpp | 44 +++++++++ hurricane/src/hurricane/CellCollections.cpp | 10 +- hurricane/src/hurricane/QuadTree.cpp | 89 ++++++++++++----- hurricane/src/hurricane/Query.cpp | 98 +++++++++++-------- hurricane/src/hurricane/Slice.cpp | 6 +- hurricane/src/hurricane/hurricane/Cell.h | 6 +- .../src/hurricane/hurricane/ExtensionSlice.h | 10 +- hurricane/src/hurricane/hurricane/QuadTree.h | 9 +- hurricane/src/hurricane/hurricane/Query.h | 22 +++-- hurricane/src/hurricane/hurricane/Slice.h | 11 +-- hurricane/src/isobar/PyCell.cpp | 18 +++- hurricane/src/viewer/CellWidget.cpp | 4 + .../src/viewer/hurricane/viewer/CellWidget.h | 7 +- 13 files changed, 218 insertions(+), 116 deletions(-) diff --git a/hurricane/src/hurricane/Cell.cpp b/hurricane/src/hurricane/Cell.cpp index 970c2512..076091a7 100644 --- a/hurricane/src/hurricane/Cell.cpp +++ b/hurricane/src/hurricane/Cell.cpp @@ -955,6 +955,50 @@ void Cell::createRoutingPadRings(uint64_t flags) } +void Cell::destroyPhysical() +// ************************* +{ + cdebug_log(18,0) << "Cell::destroyPhysical()" << endl; + + UpdateSession::open(); + for ( Net* net : getNets() ) { + vector removeds; + for ( Component* component : net->getComponents() ) { + if (dynamic_cast(component)) removeds.push_back( component ); + } + for ( Component* component : removeds ) component->destroy(); + } + + vector deepNets; + for ( Net* net : getNets() ) { + DeepNet* deepNet = dynamic_cast( net ); + if (deepNet) deepNets.push_back( deepNet ); + } + for ( DeepNet* deepNet : deepNets ) { + cerr << "Removing DeepNet:" << deepNet << endl; + deepNet->destroy(); + } + + for ( Net* net : getNets() ) { + vector removeds; + for ( Component* component : net->getComponents() ) { + if (dynamic_cast(component)) continue; + if (dynamic_cast(component)) removeds.push_back( component ); + } + for ( Component* component : removeds ) component->destroy(); + } + + for ( Net* net : getNets() ) { + vector removeds; + for ( Component* component : net->getComponents() ) { + if (dynamic_cast(component)) continue; + removeds.push_back( component ); + } + for ( Component* component : removeds ) component->destroy(); + } + UpdateSession::close(); +} + Cell* Cell::getCloneMaster() const // ******************************* { diff --git a/hurricane/src/hurricane/CellCollections.cpp b/hurricane/src/hurricane/CellCollections.cpp index d503ccb3..9fc43fdb 100644 --- a/hurricane/src/hurricane/CellCollections.cpp +++ b/hurricane/src/hurricane/CellCollections.cpp @@ -1722,11 +1722,13 @@ class Cell_SubCells : public Collection { // Cell further definition // **************************************************************************************************** -Instances Cell::getInstancesUnder(const Box& area) const -// ***************************************************** +Instances Cell::getInstancesUnder(const Box& area, DbU::Unit threshold) const +// ************************************************************************** { - // return _quadTree.getGosUnder(area).getSubSet(); - return SubTypeCollection(_quadTree->getGosUnder(area)); +// return _quadTree.getGosUnder(area).getSubSet(); +//cerr << "Cell::getInstancesUnder(): t:" << DbU::getValueString(threshold) +// << " " << this << endl; + return SubTypeCollection(_quadTree->getGosUnder(area,threshold)); } Instances Cell::getSlaveInstances() const diff --git a/hurricane/src/hurricane/QuadTree.cpp b/hurricane/src/hurricane/QuadTree.cpp index 91deea56..a0dd2991 100644 --- a/hurricane/src/hurricane/QuadTree.cpp +++ b/hurricane/src/hurricane/QuadTree.cpp @@ -122,12 +122,13 @@ class QuadTree_GosUnder : public Collection { private: const QuadTree* _quadTree; private: Box _area; + private: DbU::Unit _threshold; private: QuadTree* _currentQuadTree; private: GoLocator _goLocator; //private: static size_t _allocateds; public: Locator(); - public: Locator(const QuadTree* quadTree, const Box& area); + public: Locator(const QuadTree* quadTree, const Box& area, DbU::Unit threshold); public: Locator(const Locator& locator); //public: ~Locator() { _allocateds--; } @@ -150,12 +151,13 @@ class QuadTree_GosUnder : public Collection { private: const QuadTree* _quadTree; private: Box _area; + private: DbU::Unit _threshold; // Constructors // ************ public: QuadTree_GosUnder(); - public: QuadTree_GosUnder(const QuadTree* quadTree, const Box& area); + public: QuadTree_GosUnder(const QuadTree* quadTree, const Box& area, DbU::Unit threshold); public: QuadTree_GosUnder(const QuadTree_GosUnder& gos); // Operators @@ -251,10 +253,10 @@ Gos QuadTree::getGos() const return QuadTree_Gos(this); } -Gos QuadTree::getGosUnder(const Box& area) const -// ********************************************* +Gos QuadTree::getGosUnder(const Box& area, DbU::Unit threshold) const +// ****************************************************************** { - return QuadTree_GosUnder(this, area); + return QuadTree_GosUnder(this, area, threshold); } void QuadTree::insert(Go* go) @@ -687,25 +689,28 @@ string QuadTree_Gos::Locator::_getString() const QuadTree_GosUnder::QuadTree_GosUnder() // *********************************** -: Inherit(), +: Inherit(), _quadTree(NULL), - _area() + _area(), + _threshold(0) { } -QuadTree_GosUnder::QuadTree_GosUnder(const QuadTree* quadTree, const Box& area) -// **************************************************************************** -: Inherit(), +QuadTree_GosUnder::QuadTree_GosUnder(const QuadTree* quadTree, const Box& area, DbU::Unit threshold) +// ************************************************************************************************* +: Inherit(), _quadTree(quadTree), - _area(area) + _area(area), + _threshold(threshold) { } QuadTree_GosUnder::QuadTree_GosUnder(const QuadTree_GosUnder& gos) // *************************************************************** -: Inherit(), +: Inherit(), _quadTree(gos._quadTree), - _area(gos._area) + _area(gos._area), + _threshold(gos._threshold) { } @@ -714,6 +719,7 @@ QuadTree_GosUnder& QuadTree_GosUnder::operator=(const QuadTree_GosUnder& gos) { _quadTree = gos._quadTree; _area = gos._area; + _threshold = gos._threshold; return *this; } @@ -726,7 +732,7 @@ Collection* QuadTree_GosUnder::getClone() const Locator* QuadTree_GosUnder::getLocator() const // ************************************************ { - return new Locator(_quadTree, _area); + return new Locator(_quadTree, _area, _threshold); } string QuadTree_GosUnder::_getString() const @@ -736,6 +742,7 @@ string QuadTree_GosUnder::_getString() const if (_quadTree) { s += " " + getString(_quadTree); s += " " + getString(_area); + s += " t:" + DbU::getValueString(_threshold); } s += ">"; return s; @@ -752,23 +759,38 @@ QuadTree_GosUnder::Locator::Locator() : Inherit(), _quadTree(NULL), _area(), + _threshold(0), _currentQuadTree(NULL), _goLocator() { //_allocateds++; } -QuadTree_GosUnder::Locator::Locator(const QuadTree* quadTree, const Box& area) -// *************************************************************************** +QuadTree_GosUnder::Locator::Locator(const QuadTree* quadTree, const Box& area, DbU::Unit threshold) +// ************************************************************************************************ : Inherit(), _quadTree(quadTree), _area(area), + _threshold(threshold), _currentQuadTree(NULL), _goLocator() { //_allocateds++; - if (_quadTree && !_area.isEmpty()) { + if (_quadTree and not _area.isEmpty()) { _currentQuadTree = _quadTree->_getFirstQuadTree(_area); + while ( true ) { + if (not _currentQuadTree) break; + if ( (_threshold <= 0) + or ( (_currentQuadTree->getBoundingBox().getWidth () > _threshold) + and (_currentQuadTree->getBoundingBox().getHeight() > _threshold)) ) + break; + // cerr << "Pruning QuadTree:" << _currentQuadTree + // << " _threshold:" << DbU::getValueString(_threshold) + // << "(" << _threshold << ")" << endl; + _currentQuadTree = _currentQuadTree->_getNextQuadTree(_area); + } + + //_currentQuadTree = _quadTree->_getFirstQuadTree(_area); if (_currentQuadTree) { _goLocator = _currentQuadTree->_getGoSet().getElements().getLocator(); if (!getElement()->getBoundingBox().intersect(_area)) progress(); @@ -781,6 +803,7 @@ QuadTree_GosUnder::Locator::Locator(const Locator& locator) : Inherit(), _quadTree(locator._quadTree), _area(locator._area), + _threshold(locator._threshold), _currentQuadTree(locator._currentQuadTree), _goLocator(locator._goLocator) { @@ -792,6 +815,7 @@ QuadTree_GosUnder::Locator& QuadTree_GosUnder::Locator::operator=(const Locator& { _quadTree = locator._quadTree; _area = locator._area; + _threshold = locator._threshold; _currentQuadTree = locator._currentQuadTree; _goLocator = locator._goLocator; return *this; @@ -818,16 +842,27 @@ bool QuadTree_GosUnder::Locator::isValid() const void QuadTree_GosUnder::Locator::progress() // **************************************** { - if (isValid()) { - do { - _goLocator.progress(); - if (!_goLocator.isValid()) { - _currentQuadTree = _currentQuadTree->_getNextQuadTree(_area); - if (_currentQuadTree) - _goLocator = _currentQuadTree->_getGoSet().getElements().getLocator(); - } - } while (isValid() && !getElement()->getBoundingBox().intersect(_area)); - } + if (isValid()) { + do { + _goLocator.progress(); + if (not _goLocator.isValid()) { + while ( true ) { + _currentQuadTree = _currentQuadTree->_getNextQuadTree(_area); + if (not _currentQuadTree) break; + if ( (_threshold <= 0) + or ( (_currentQuadTree->getBoundingBox().getWidth () > _threshold) + and (_currentQuadTree->getBoundingBox().getHeight() > _threshold)) ) + break; + // cerr << "Pruning QuadTree:" << _currentQuadTree + // << " _threshold:" << DbU::getValueString(_threshold) + // << "(" << _threshold << ")" << endl; + } + + if (_currentQuadTree) + _goLocator = _currentQuadTree->_getGoSet().getElements().getLocator(); + } + } while (isValid() and not getElement()->getBoundingBox().intersect(_area)); + } } string QuadTree_GosUnder::Locator::_getString() const diff --git a/hurricane/src/hurricane/Query.cpp b/hurricane/src/hurricane/Query.cpp index 4ea7f0e2..015aed9c 100644 --- a/hurricane/src/hurricane/Query.cpp +++ b/hurricane/src/hurricane/Query.cpp @@ -47,6 +47,7 @@ namespace Hurricane { //, _tab (" ") , _topCell (NULL) , _topArea () + , _threshold (0) , _topTransformation () , _startLevel (0) , _stopLevel (std::numeric_limits::max()) @@ -84,6 +85,7 @@ namespace Hurricane { , const BasicLayer* basicLayer , ExtensionSlice::Mask mask , Mask filter + , DbU::Unit threshold ) { _basicLayer = basicLayer; @@ -93,62 +95,72 @@ namespace Hurricane { _stack.setTopCell ( cell ); _stack.setTopArea ( area ); _stack.setTopTransformation ( transformation ); + _stack.setThreshold ( threshold ); } void Query::doQuery () { - if ( _stack.getTopArea().isEmpty() or not _stack.getTopCell() ) return; + if (_stack.getTopArea().isEmpty() or not _stack.getTopCell()) return; - //cerr << "Query::doQuery() - " << _stack.getTopCell() << " " << _stack.getTopArea() << " " << _basicLayer << endl; + // cerr << "Query::doQuery() - " << _stack.getTopCell() + // << " " << _stack.getTopArea() + // << " " << _basicLayer + // << " threshold:" << DbU::getValueString(_stack.getThreshold()) + // << endl; - _stack.init (); + _stack.init(); - while ( !_stack.empty() ) { + while ( not _stack.empty() ) { // Process the Components of the current instance. - if ( hasGoCallback() and _basicLayer and (_filter.isSet(DoComponents)) ) { - //if ( getInstance() ) - // cerr << getTab() << getInstance() << " " << getTransformation() << endl; - //else - // cerr << " TopCell: " << getMasterCell() << " " << getTransformation() << endl; - - if ( not getMasterCell()->isTerminal() or (_filter.isSet(DoTerminalCells)) ) { - forEach ( Slice*, islice, getMasterCell()->getSlices() ) { - if ( not (*islice)->getLayer()->contains(getBasicLayer()) ) continue; - if ( not (*islice)->getBoundingBox().intersect(getArea()) ) continue; - - forEach ( Go*, igo, (*islice)->getGosUnder(_stack.getArea()) ) - goCallback ( *igo ); - } - } - } - - if ( (not getMasterCell()->isTerminal() or (_filter.isSet(DoTerminalCells))) - and _filter.isSet(DoMarkers) ) { - forEach ( Marker*, marker, getMasterCell()->getMarkersUnder(_stack.getArea()) ) - markerCallback ( *marker ); - } - - if ( not getMasterCell()->isTerminal() and (_filter.isSet(DoRubbers)) ) { - forEach ( Rubber*, rubber, getMasterCell()->getRubbersUnder(_stack.getArea()) ) - rubberCallback ( *rubber ); - } - - if ( hasExtensionGoCallback() and (_filter.isSet(DoExtensionGos)) ) { - if ( (not getMasterCell()->isTerminal()) or (_filter.isSet(DoTerminalCells)) ) { - forEach ( ExtensionSlice*, islice, getMasterCell()->getExtensionSlices() ) { - if ( not ( (*islice)->getMask() & _extensionMask ) ) continue; - if ( not (*islice)->getBoundingBox().intersect(getArea()) ) continue; - - for ( Go* go : (*islice)->getGosUnder(_stack.getArea()) ) { - extensionGoCallback ( go ); + Box ab = getMasterCell()->getAbutmentBox(); + if ( (_stack.getThreshold() <= 0) + or (ab.getWidth () > _stack.getThreshold()) + or (ab.getHeight() > _stack.getThreshold()) ) { + if (hasGoCallback() and _basicLayer and (_filter.isSet(DoComponents))) { + //if ( getInstance() ) + // cerr << getTab() << getInstance() << " " << getTransformation() << endl; + //else + // cerr << " TopCell: " << getMasterCell() << " " << getTransformation() << endl; + + if (not getMasterCell()->isTerminal() or (_filter.isSet(DoTerminalCells))) { + for ( Slice* slice : getMasterCell()->getSlices() ) { + if (not slice->getLayer()->contains(getBasicLayer())) continue; + if (not slice->getBoundingBox().intersect(getArea())) continue; + + for ( Go* go : slice->getGosUnder(_stack.getArea(),_stack.getThreshold()) ) + goCallback( go ); + } + } + } + + if ( (not getMasterCell()->isTerminal() or (_filter.isSet(DoTerminalCells))) + and _filter.isSet(DoMarkers) ) { + for ( Marker* marker : getMasterCell()->getMarkersUnder(_stack.getArea()) ) + markerCallback( marker ); + } + + if ( not getMasterCell()->isTerminal() and (_filter.isSet(DoRubbers)) ) { + for ( Rubber* rubber : getMasterCell()->getRubbersUnder(_stack.getArea()) ) + rubberCallback( rubber ); + } + + if ( hasExtensionGoCallback() and (_filter.isSet(DoExtensionGos)) ) { + if ( (not getMasterCell()->isTerminal()) or (_filter.isSet(DoTerminalCells)) ) { + for ( ExtensionSlice* slice : getMasterCell()->getExtensionSlices() ) { + if ( not ( slice->getMask() & _extensionMask ) ) continue; + if ( not slice->getBoundingBox().intersect(getArea()) ) continue; + + for ( Go* go : slice->getGosUnder(_stack.getArea(),_stack.getThreshold()) ) { + extensionGoCallback( go ); + } } } } - } - if ( (_filter.isSet(DoMasterCells)) and hasMasterCellCallback() ) - masterCellCallback (); + if ( (_filter.isSet(DoMasterCells)) and hasMasterCellCallback() ) + masterCellCallback (); + } _stack.progress (); } // End of while. diff --git a/hurricane/src/hurricane/Slice.cpp b/hurricane/src/hurricane/Slice.cpp index f9056295..a8ff6bb5 100644 --- a/hurricane/src/hurricane/Slice.cpp +++ b/hurricane/src/hurricane/Slice.cpp @@ -64,11 +64,11 @@ Components Slice::getComponents() const return SubTypeCollection(_quadTree.getGos()); } -Components Slice::getComponentsUnder(const Box& area) const -// ******************************************************** +Components Slice::getComponentsUnder(const Box& area, DbU::Unit threshold) const +// ***************************************************************************** { // return _quadTree.getGosUnder(area).getSubSet(); - return SubTypeCollection(_quadTree.getGosUnder(area)); + return SubTypeCollection(_quadTree.getGosUnder(area,threshold)); } Markers Slice::getMarkers() const diff --git a/hurricane/src/hurricane/hurricane/Cell.h b/hurricane/src/hurricane/hurricane/Cell.h index 9b808f8f..4e3d9d2f 100644 --- a/hurricane/src/hurricane/hurricane/Cell.h +++ b/hurricane/src/hurricane/hurricane/Cell.h @@ -420,7 +420,7 @@ class Cell : public Entity { public: Instances getFixedInstances() const; public: Instances getUnplacedInstances() const; public: Instances getNotUnplacedInstances() const; - public: Instances getInstancesUnder(const Box& area) const; + public: Instances getInstancesUnder(const Box& area, DbU::Unit threshold=0) const; public: Instances getPlacedInstancesUnder(const Box& area) const; public: Instances getFixedInstancesUnder(const Box& area) const; public: Instances getUnplacedInstancesUnder(const Box& area) const; @@ -518,8 +518,8 @@ class Cell : public Entity { public: void uniquify(unsigned int depth=std::numeric_limits::max()); public: void addObserver(BaseObserver*); public: void removeObserver(BaseObserver*); - public: void notify(unsigned flags); - + public: void notify(unsigned flags); + public: void destroyPhysical(); }; diff --git a/hurricane/src/hurricane/hurricane/ExtensionSlice.h b/hurricane/src/hurricane/hurricane/ExtensionSlice.h index 9fa48070..97c8089f 100644 --- a/hurricane/src/hurricane/hurricane/ExtensionSlice.h +++ b/hurricane/src/hurricane/hurricane/ExtensionSlice.h @@ -30,9 +30,7 @@ // +-----------------------------------------------------------------+ -#ifndef HURRICANE_EXTENSION_SLICE_H -#define HURRICANE_EXTENSION_SLICE_H - +#pragma once #include "hurricane/Mask.h" #include "hurricane/Name.h" #include "hurricane/ExtensionSlices.h" @@ -60,7 +58,7 @@ namespace Hurricane { inline Mask getMask () const; inline const Box& getBoundingBox () const; inline Gos getGos () const; - inline Gos getGosUnder ( const Box& area ) const; + inline Gos getGosUnder ( const Box& area, DbU::Unit threshold=0 ) const; inline QuadTree* _getQuadTree (); // Hurricane Managment. string _getTypeName () const; @@ -93,12 +91,10 @@ namespace Hurricane { inline ExtensionSlice::Mask ExtensionSlice::getMask () const { return _mask; } inline const Box& ExtensionSlice::getBoundingBox () const { return _quadTree.getBoundingBox(); } inline Gos ExtensionSlice::getGos () const { return _quadTree.getGos(); } - inline Gos ExtensionSlice::getGosUnder ( const Box& area ) const {return _quadTree.getGosUnder(area); } + inline Gos ExtensionSlice::getGosUnder ( const Box& area, DbU::Unit threshold ) const {return _quadTree.getGosUnder(area,threshold); } inline QuadTree* ExtensionSlice::_getQuadTree () { return &_quadTree; } } // End of Hurricane namespace. INSPECTOR_P_SUPPORT(Hurricane::ExtensionSlice); - -# endif // HURRICANE_EXTENSION_SLICE_H diff --git a/hurricane/src/hurricane/hurricane/QuadTree.h b/hurricane/src/hurricane/hurricane/QuadTree.h index 621ccd38..322694ad 100644 --- a/hurricane/src/hurricane/hurricane/QuadTree.h +++ b/hurricane/src/hurricane/hurricane/QuadTree.h @@ -17,9 +17,7 @@ // not, see . // **************************************************************************************************** -#ifndef HURRICANE_QUAD_TREE -#define HURRICANE_QUAD_TREE - +#pragma once #include "hurricane/Box.h" #include "hurricane/Gos.h" #include "hurricane/IntrusiveSet.h" @@ -88,7 +86,7 @@ class QuadTree { //public: static size_t getLocatorAllocateds (); public: const Box& getBoundingBox() const; public: Gos getGos() const; - public: Gos getGosUnder(const Box& area) const; + public: Gos getGosUnder(const Box& area, DbU::Unit threshold=0) const; // Predicates // ********** @@ -130,9 +128,6 @@ INSPECTOR_P_SUPPORT(Hurricane::QuadTree); INSPECTOR_P_SUPPORT(Hurricane::QuadTree::GoSet); -#endif // HURRICANE_QUAD_TREE - - // **************************************************************************************************** // Copyright (c) BULL S.A. 2000-2018, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Query.h b/hurricane/src/hurricane/hurricane/Query.h index 19563d25..d78de5dd 100644 --- a/hurricane/src/hurricane/hurricane/Query.h +++ b/hurricane/src/hurricane/hurricane/Query.h @@ -29,9 +29,7 @@ // +-----------------------------------------------------------------+ -#ifndef HURRICANE_QUERY_H -#define HURRICANE_QUERY_H - +#pragma once #include #include "hurricane/Commons.h" #include "hurricane/Box.h" @@ -118,6 +116,7 @@ namespace Hurricane { inline Cell* getMasterCell (); inline Instance* getInstance (); inline const Box& getArea () const; + inline DbU::Unit getThreshold () const; inline const Transformation& getTransformation () const; inline const Path& getPath () const; //inline const Tabulation& getTab () const; @@ -125,6 +124,7 @@ namespace Hurricane { inline void setTopCell ( Cell* cell ); inline void setTopArea ( const Box& area ); inline void setTopTransformation ( const Transformation& transformation ); + inline void setThreshold ( DbU::Unit threshold ); inline void setStartLevel ( unsigned int level ); inline void setStopLevel ( unsigned int level ); inline void init (); @@ -140,6 +140,7 @@ namespace Hurricane { // Tabulation _tab; Cell* _topCell; Box _topArea; + DbU::Unit _threshold; Transformation _topTransformation; unsigned int _startLevel; unsigned int _stopLevel; @@ -157,6 +158,7 @@ namespace Hurricane { inline Cell* QueryStack::getTopCell () { return _topCell; } inline const Box& QueryStack::getTopArea () const { return _topArea; } inline const Transformation& QueryStack::getTopTransformation () const { return _topTransformation; } + inline DbU::Unit QueryStack::getThreshold () const { return _threshold; } inline unsigned int QueryStack::getStartLevel () const { return _startLevel; } inline unsigned int QueryStack::getStopLevel () const { return _stopLevel; } inline const Box& QueryStack::getArea () const { return back()->_area; } @@ -183,6 +185,7 @@ namespace Hurricane { inline void QueryStack::setTopCell ( Cell* cell ) { _topCell = cell; } inline void QueryStack::setTopArea ( const Box& area ) { _topArea = area; } inline void QueryStack::setTopTransformation ( const Transformation& transformation ) { _topTransformation = transformation; } + inline void QueryStack::setThreshold ( DbU::Unit threshold ) { _threshold = threshold; } inline void QueryStack::setStartLevel ( unsigned int level ) { _startLevel = level; } inline void QueryStack::setStopLevel ( unsigned int level ) { _stopLevel = level; } @@ -204,6 +207,8 @@ namespace Hurricane { QueryState* parent = *(rbegin()+1); Instance* instance = child->_locator->getElement(); + //cerr << "Processing " << instance << endl; + child->_area = parent->_area; child->_transformation = instance->getTransformation (); @@ -219,7 +224,9 @@ namespace Hurricane { { if ( size() > _stopLevel ) return false; - Locator* locator = getMasterCell()->getInstancesUnder(getArea()).getLocator(); + //cerr << "QueryStack::levelDown(): t:" << DbU::getValueString(getThreshold()) << endl; + Locator* locator = + getMasterCell()->getInstancesUnder(getArea(),getThreshold()).getLocator(); if ( locator->isValid() ) { push_back ( new QueryState ( locator ) ); @@ -231,6 +238,7 @@ namespace Hurricane { } else delete locator; + //cerr << " Aborting level down" << endl; return false; } @@ -314,6 +322,7 @@ namespace Hurricane { inline size_t getDepth () const; inline const Transformation& getTransformation () const; inline const Box& getArea () const; + inline DbU::Unit getThreshold () const; inline const BasicLayer* getBasicLayer () const; inline Cell* getMasterCell (); inline Instance* getInstance (); @@ -336,9 +345,11 @@ namespace Hurricane { , const BasicLayer* basicLayer , ExtensionSlice::Mask extensionMask , Mask filter + , DbU::Unit threshold=0 ); inline void setCell ( Cell* cell ); inline void setArea ( const Box& area ); + inline void setThreshold ( DbU::Unit threshold ); inline void setTransformation ( const Transformation& transformation ); virtual void setBasicLayer ( const BasicLayer* basicLayer ); inline void setExtensionMask ( ExtensionSlice::Mask mode ); @@ -360,6 +371,7 @@ namespace Hurricane { inline void Query::setCell ( Cell* cell ) { _stack.setTopCell(cell); } inline void Query::setArea ( const Box& area ) { _stack.setTopArea(area); } + inline void Query::setThreshold ( DbU::Unit threshold ) { _stack.setThreshold(threshold); } inline void Query::setTransformation ( const Transformation& transformation ) { _stack.setTopTransformation(transformation); } inline void Query::setFilter ( Mask filter ) { _filter = filter; } inline void Query::setExtensionMask ( ExtensionSlice::Mask mask ) { _extensionMask = mask; } @@ -379,5 +391,3 @@ namespace Hurricane { } // Hurricane namespace. - -#endif // HURRICANE_QUERY_H diff --git a/hurricane/src/hurricane/hurricane/Slice.h b/hurricane/src/hurricane/hurricane/Slice.h index 363451bc..60437876 100644 --- a/hurricane/src/hurricane/hurricane/Slice.h +++ b/hurricane/src/hurricane/hurricane/Slice.h @@ -17,9 +17,7 @@ // not, see . // **************************************************************************************************** -#ifndef HURRICANE_SLICE -#define HURRICANE_SLICE - +#pragma once #include "hurricane/QuadTree.h" #include "hurricane/Components.h" #include "hurricane/Markers.h" @@ -72,9 +70,9 @@ class Slice { public: const Layer* getLayer() const {return _layer;}; public: const Box& getBoundingBox() const {return _quadTree.getBoundingBox();}; public: Gos getGos() const {return _quadTree.getGos();}; - public: Gos getGosUnder(const Box& area) const {return _quadTree.getGosUnder(area);}; + public: Gos getGosUnder(const Box& area, DbU::Unit threshold=0) const {return _quadTree.getGosUnder(area,threshold);}; public: Components getComponents() const; - public: Components getComponentsUnder(const Box& area) const; + public: Components getComponentsUnder(const Box& area, DbU::Unit threshold=0) const; public: Markers getMarkers() const; public: Markers getMarkersUnder(const Box& area) const; @@ -107,9 +105,6 @@ class Slice { INSPECTOR_P_SUPPORT(Hurricane::Slice); -#endif // HURRICANE_SLICE - - // **************************************************************************************************** // Copyright (c) BULL S.A. 2000-2018, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/isobar/PyCell.cpp b/hurricane/src/isobar/PyCell.cpp index b84927e9..aac63430 100644 --- a/hurricane/src/isobar/PyCell.cpp +++ b/hurricane/src/isobar/PyCell.cpp @@ -710,6 +710,20 @@ extern "C" { } + // --------------------------------------------------------------- + // Attribute Method : "PyCell_destroyPhysical ()" + + static PyObject* PyCell_destroyPhysical ( PyCell *self ) + { + cdebug_log(20,0) << "PyCell_destroyPhysical ()" << endl; + HTRY + METHOD_HEAD( "Cell.destroyPhysical()" ) + cell->destroyPhysical(); + HCATCH + Py_RETURN_NONE; + } + + // Standart Predicates (Attributes). DirectGetBoolAttribute(PyCell_isTerminal , isTerminal ,PyCell,Cell) DirectGetBoolAttribute(PyCell_isTerminalNetlist, isTerminalNetlist,PyCell,Cell) @@ -766,8 +780,8 @@ extern "C" { , { "setRouted" , (PyCFunction)PyCell_setRouted , METH_VARARGS, "Sets the cell routed status." } , { "uniquify" , (PyCFunction)PyCell_uniquify , METH_VARARGS, "Uniquify the Cell and it's instances up to ." } , { "getClone" , (PyCFunction)PyCell_getClone , METH_NOARGS , "Return a copy of the Cell (placement only)." } - , { "destroy" , (PyCFunction)PyCell_destroy , METH_NOARGS - , "Destroy associated hurricane object The python object remains." } + , { "destroyPhysical" , (PyCFunction)PyCell_destroyPhysical , METH_NOARGS , "Destroy all physical components, including DeepNets (vflatten)." } + , { "destroy" , (PyCFunction)PyCell_destroy , METH_NOARGS , "Destroy associated hurricane object The python object remains." } , {NULL, NULL, 0, NULL} /* sentinel */ }; diff --git a/hurricane/src/viewer/CellWidget.cpp b/hurricane/src/viewer/CellWidget.cpp index 8ab46913..5e5e30d3 100644 --- a/hurricane/src/viewer/CellWidget.cpp +++ b/hurricane/src/viewer/CellWidget.cpp @@ -1348,12 +1348,16 @@ namespace Hurricane { if (getCell()) { Box redrawBox = screenToDbuBox( redrawArea ); + //cerr << "redrawBox:" << redrawBox << endl; + //cerr << "Threshold:" << DbU::getValueString(screenToDbuLength(20)) << endl; + _drawingQuery.resetGoCount (); _drawingQuery.resetExtensionGoCount(); _drawingQuery.resetInstanceCount (); _drawingQuery.setExtensionMask ( 0 ); _drawingQuery.setArea ( redrawBox ); _drawingQuery.setTransformation ( Transformation() ); + _drawingQuery.setThreshold ( screenToDbuLength(20) ); for ( BasicLayer* layer : _technology->getBasicLayers() ) { _drawingPlanes.setPen ( Graphics::getPen (layer->getName(),getDarkening()) ); diff --git a/hurricane/src/viewer/hurricane/viewer/CellWidget.h b/hurricane/src/viewer/hurricane/viewer/CellWidget.h index 6d26f7be..338a0f95 100644 --- a/hurricane/src/viewer/hurricane/viewer/CellWidget.h +++ b/hurricane/src/viewer/hurricane/viewer/CellWidget.h @@ -14,9 +14,7 @@ // +-----------------------------------------------------------------+ -#ifndef HURRICANE_CELL_WIDGET_H -#define HURRICANE_CELL_WIDGET_H - +#pragma once #include #include #include @@ -1470,6 +1468,3 @@ namespace Hurricane { GETSTRING_POINTER_SUPPORT(Hurricane::CellWidget); IOSTREAM_POINTER_SUPPORT(Hurricane::CellWidget); - - -#endif // HURRICANE_CELL_WIDGET