diff --git a/crlcore/etc/common/misc.py b/crlcore/etc/common/misc.py index d225a8e6..5956c137 100644 --- a/crlcore/etc/common/misc.py +++ b/crlcore/etc/common/misc.py @@ -31,6 +31,9 @@ param = Cfg.getParamInt( 'misc.maxTraceLevel' ) param.setInt( 0 ) param.setMin( 0 ) +Cfg.getParamInt( 'viewer.minimumSize' ).setInt( 500 ) +Cfg.getParamInt( 'viewer.pixelThreshold').setInt( 20 ) + param = Cfg.getParamInt( 'viewer.printer.DPI' ) param.setInt( 150 ) param.setMin( 100 ) diff --git a/hurricane/src/hurricane/CellCollections.cpp b/hurricane/src/hurricane/CellCollections.cpp index 9fc43fdb..e59dec52 100644 --- a/hurricane/src/hurricane/CellCollections.cpp +++ b/hurricane/src/hurricane/CellCollections.cpp @@ -937,6 +937,7 @@ class Cell_OccurrencesUnder : public Collection { private: const Cell* _cell; private: Box _area; private: unsigned _searchDepth; + private: DbU::Unit _threshold; private: unsigned _state; private: ComponentLocator _componentLocator; private: RubberLocator _rubberLocator; @@ -946,7 +947,7 @@ class Cell_OccurrencesUnder : public Collection { private: OccurrenceLocator _occurrenceLocator; public: Locator(); - public: Locator(const Cell* cell, const Box& area, unsigned searchDepth = (unsigned)-1); + public: Locator(const Cell* cell, const Box& area, unsigned searchDepth = (unsigned)-1, DbU::Unit threshold=0); public: Locator(const Locator& locator); public: Locator& operator=(const Locator& locator); @@ -968,12 +969,13 @@ class Cell_OccurrencesUnder : public Collection { private: const Cell* _cell; private: Box _area; private: unsigned _searchDepth; + private: DbU::Unit _threshold; // Constructors // ************ public: Cell_OccurrencesUnder(); - public: Cell_OccurrencesUnder(const Cell* cell, const Box& area, unsigned searchDepth = (unsigned)-1); + public: Cell_OccurrencesUnder(const Cell* cell, const Box& area, unsigned searchDepth = (unsigned)-1, DbU::Unit threshold=0); public: Cell_OccurrencesUnder(const Cell_OccurrencesUnder& occurrences); // Operators @@ -1957,10 +1959,10 @@ Occurrences Cell::getOccurrences(unsigned searchDepth) const return Cell_Occurrences(this, searchDepth); } -Occurrences Cell::getOccurrencesUnder(const Box& area, unsigned searchDepth) const -// ***************************************************************************** +Occurrences Cell::getOccurrencesUnder(const Box& area, unsigned searchDepth, DbU::Unit threshold) const +// **************************************************************************************************** { - return Cell_OccurrencesUnder(this, area, searchDepth); + return Cell_OccurrencesUnder(this, area, searchDepth, threshold); } Occurrences Cell::getTerminalInstanceOccurrences() const @@ -2840,38 +2842,42 @@ string Cell_Occurrences::Locator::_getString() const // **************************************************************************************************** Cell_OccurrencesUnder::Cell_OccurrencesUnder() -// ***************************************** +// ******************************************* : Inherit(), _cell(NULL), _area(), - _searchDepth(0) + _searchDepth(0), + _threshold(0) { } -Cell_OccurrencesUnder::Cell_OccurrencesUnder(const Cell* cell, const Box& area, unsigned searchDepth) -// ************************************************************************************************ +Cell_OccurrencesUnder::Cell_OccurrencesUnder(const Cell* cell, const Box& area, unsigned searchDepth, DbU::Unit threshold) +// *********************************************************************************************************************** : Inherit(), _cell(cell), _area(area), - _searchDepth(searchDepth) + _searchDepth(searchDepth), + _threshold(threshold) { } Cell_OccurrencesUnder::Cell_OccurrencesUnder(const Cell_OccurrencesUnder& occurrences) -// ******************************************************************************* +// *********************************************************************************** : Inherit(), _cell(occurrences._cell), _area(occurrences._area), - _searchDepth(occurrences._searchDepth) + _searchDepth(occurrences._searchDepth), + _threshold(occurrences._threshold) { } Cell_OccurrencesUnder& Cell_OccurrencesUnder::operator=(const Cell_OccurrencesUnder& occurrences) -// ****************************************************************************************** +// ********************************************************************************************** { _cell = occurrences._cell; _area = occurrences._area; _searchDepth = occurrences._searchDepth; + _threshold = occurrences._threshold; return *this; } @@ -2884,7 +2890,7 @@ Collection* Cell_OccurrencesUnder::getClone() const Locator* Cell_OccurrencesUnder::getLocator() const // ********************************************************* { - return new Locator(_cell, _area, _searchDepth); + return new Locator(_cell, _area, _searchDepth, _threshold); } string Cell_OccurrencesUnder::_getString() const @@ -2894,7 +2900,8 @@ string Cell_OccurrencesUnder::_getString() const if (_cell) { s += " " + getString(_cell); s += " " + getString(_area); - if (_searchDepth != ((unsigned)-1)) s += " " + getString(_searchDepth); + if (_searchDepth != ((unsigned)-1)) s += " depth:" + getString(_searchDepth); + if (_threshold > 0) s += " threshold:" + DbU::getValueString(_threshold); } s += ">"; return s; @@ -2912,6 +2919,7 @@ Cell_OccurrencesUnder::Locator::Locator() _cell(NULL), _area(), _searchDepth(0), + _threshold(0), _state(0), _componentLocator(), _rubberLocator(), @@ -2922,12 +2930,13 @@ Cell_OccurrencesUnder::Locator::Locator() { } -Cell_OccurrencesUnder::Locator::Locator(const Cell* cell, const Box& area, unsigned searchDepth) -// ******************************************************************************************** +Cell_OccurrencesUnder::Locator::Locator(const Cell* cell, const Box& area, unsigned searchDepth, DbU::Unit threshold) +// ****************************************************************************************************************** : Inherit(), _cell(cell), _area(area), _searchDepth(searchDepth), + _threshold(threshold), _state(0), _componentLocator(), _rubberLocator(), @@ -2969,6 +2978,7 @@ Cell_OccurrencesUnder::Locator::Locator(const Locator& locator) _cell(locator._cell), _area(locator._area), _searchDepth(locator._searchDepth), + _threshold(locator._threshold), _state(locator._state), _componentLocator(locator._componentLocator), _rubberLocator(locator._rubberLocator), @@ -2985,6 +2995,7 @@ Cell_OccurrencesUnder::Locator& Cell_OccurrencesUnder::Locator::operator=(const _cell = locator._cell; _area = locator._area; _searchDepth = locator._searchDepth; + _threshold = locator._threshold; _state = locator._state; _componentLocator = locator._componentLocator; _rubberLocator = locator._rubberLocator; @@ -3048,7 +3059,7 @@ void Cell_OccurrencesUnder::Locator::progress() if (_extensionGoLocator.isValid()) _state = 4; else { - _instanceLocator = _cell->getInstancesUnder(_area).getLocator(); + _instanceLocator = _cell->getInstancesUnder(_area,_threshold).getLocator(); if (_instanceLocator.isValid()) _state = 5; else @@ -3069,7 +3080,7 @@ void Cell_OccurrencesUnder::Locator::progress() if (_extensionGoLocator.isValid()) _state = 4; else { - _instanceLocator = _cell->getInstancesUnder(_area).getLocator(); + _instanceLocator = _cell->getInstancesUnder(_area,_threshold).getLocator(); if (_instanceLocator.isValid()) _state = 5; else @@ -3085,7 +3096,7 @@ void Cell_OccurrencesUnder::Locator::progress() if (_extensionGoLocator.isValid()) _state = 4; else { - _instanceLocator = _cell->getInstancesUnder(_area).getLocator(); + _instanceLocator = _cell->getInstancesUnder(_area,_threshold).getLocator(); if (_instanceLocator.isValid()) _state = 5; else @@ -3096,7 +3107,7 @@ void Cell_OccurrencesUnder::Locator::progress() case 4 : _extensionGoLocator.progress(); if (!_extensionGoLocator.isValid()) { - _instanceLocator = _cell->getInstancesUnder(_area).getLocator(); + _instanceLocator = _cell->getInstancesUnder(_area,_threshold).getLocator(); if (_instanceLocator.isValid()) _state = 5; else @@ -3119,7 +3130,7 @@ void Cell_OccurrencesUnder::Locator::progress() instance->getTransformation().getInvert().applyOn(masterArea); Cell* masterCell = instance->getMasterCell(); _occurrenceLocator = - masterCell->getOccurrencesUnder(masterArea, _searchDepth - 1).getLocator(); + masterCell->getOccurrencesUnder(masterArea, _searchDepth - 1,_threshold).getLocator(); if (_occurrenceLocator.isValid()) _state = 6; else { diff --git a/hurricane/src/hurricane/QuadTree.cpp b/hurricane/src/hurricane/QuadTree.cpp index a0dd2991..a1288499 100644 --- a/hurricane/src/hurricane/QuadTree.cpp +++ b/hurricane/src/hurricane/QuadTree.cpp @@ -19,6 +19,7 @@ #include "hurricane/QuadTree.h" #include "hurricane/Go.h" +#include "hurricane/Instance.h" #include "hurricane/Error.h" #include "hurricane/Warning.h" @@ -861,8 +862,21 @@ void QuadTree_GosUnder::Locator::progress() if (_currentQuadTree) _goLocator = _currentQuadTree->_getGoSet().getElements().getLocator(); } - } while (isValid() and not getElement()->getBoundingBox().intersect(_area)); + // if (isValid()) { + // if (( (getElement()->getBoundingBox().getWidth () < _threshold) + // and (getElement()->getBoundingBox().getHeight() < _threshold)) ) + // cerr << " goUnders: pruning " << getElement() << endl; + // else + // cerr << " goUnders: display " << getElement() << endl; + // } + } while ( isValid() + and ( not getElement()->getBoundingBox().intersect(_area) + or ( (getElement()->getBoundingBox().getWidth () < _threshold) + and (getElement()->getBoundingBox().getHeight() < _threshold))) ); } + // if (isValid()) { + // cerr << " goUnders: accept " << getElement() << endl; + // } } string QuadTree_GosUnder::Locator::_getString() const diff --git a/hurricane/src/hurricane/Query.cpp b/hurricane/src/hurricane/Query.cpp index 015aed9c..649025fa 100644 --- a/hurricane/src/hurricane/Query.cpp +++ b/hurricane/src/hurricane/Query.cpp @@ -51,6 +51,7 @@ namespace Hurricane { , _topTransformation () , _startLevel (0) , _stopLevel (std::numeric_limits::max()) + , _instanceCount (0) { } @@ -110,6 +111,7 @@ namespace Hurricane { // << endl; _stack.init(); + //cerr << "doQuery() start:" << _stack.getInstanceCount() << " " << _basicLayer << endl; while ( not _stack.empty() ) { // Process the Components of the current instance. @@ -164,6 +166,8 @@ namespace Hurricane { _stack.progress (); } // End of while. + + //cerr << "doQuery() count:" << _stack.getInstanceCount() << endl; } diff --git a/hurricane/src/hurricane/hurricane/Cell.h b/hurricane/src/hurricane/hurricane/Cell.h index 4e3d9d2f..fa9c18f7 100644 --- a/hurricane/src/hurricane/hurricane/Cell.h +++ b/hurricane/src/hurricane/hurricane/Cell.h @@ -459,7 +459,7 @@ class Cell : public Entity { public: Components getComponents(const Layer::Mask& mask = ~0) const; public: Components getComponentsUnder(const Box& area, const Layer::Mask& mask = ~0) const; public: Occurrences getOccurrences(unsigned searchDepth = std::numeric_limits::max()) const; - public: Occurrences getOccurrencesUnder(const Box& area, unsigned searchDepth = std::numeric_limits::max()) const; + public: Occurrences getOccurrencesUnder(const Box& area, unsigned searchDepth = std::numeric_limits::max(), DbU::Unit threshold=0) const; public: Occurrences getTerminalInstanceOccurrences() const; public: Occurrences getTerminalInstanceOccurrencesUnder(const Box& area) const; public: Occurrences getTerminalNetlistInstanceOccurrences( const Instance* topInstance=NULL ) const; diff --git a/hurricane/src/hurricane/hurricane/Query.h b/hurricane/src/hurricane/hurricane/Query.h index d78de5dd..365c2a13 100644 --- a/hurricane/src/hurricane/hurricane/Query.h +++ b/hurricane/src/hurricane/hurricane/Query.h @@ -31,6 +31,7 @@ #pragma once #include +#include #include "hurricane/Commons.h" #include "hurricane/Box.h" #include "hurricane/Transformation.h" @@ -134,6 +135,7 @@ namespace Hurricane { inline void levelProgress (); inline bool levelCompleted (); inline void progress ( bool init=false ); + inline size_t getInstanceCount () const; protected: // Internal: Attributes. @@ -144,6 +146,7 @@ namespace Hurricane { Transformation _topTransformation; unsigned int _startLevel; unsigned int _stopLevel; + size_t _instanceCount; private: // Internal: Constructors. @@ -165,6 +168,7 @@ namespace Hurricane { inline const Transformation& QueryStack::getTransformation () const { return back()->_transformation; } inline const Path& QueryStack::getPath () const { return back()->_path; } //inline const Tabulation& QueryStack::getTab () const { return _tab; } + inline size_t QueryStack::getInstanceCount () const { return _instanceCount; } inline Instance* QueryStack::getInstance () @@ -192,12 +196,13 @@ namespace Hurricane { inline void QueryStack::init () { - while ( !empty() ) levelUp(); + _instanceCount = 0; + while (not empty()) levelUp(); - push_back ( new QueryState(NULL,_topArea,_topTransformation,Path()) ); + push_back( new QueryState(NULL,_topArea,_topTransformation,Path()) ); //_tab++; - progress ( true ); + progress( true ); } @@ -260,33 +265,35 @@ namespace Hurricane { inline void QueryStack::levelProgress () { - if ( levelCompleted() ) return; + if (levelCompleted()) return; - back()->_locator->progress (); - if ( !back()->_locator->isValid() ) return; + back()->_locator->progress(); + if (not back()->_locator->isValid()) return; - updateTransformation (); + //cerr << " stack:" << std::setw(3) << _instanceCount << ":" << getPath() << endl; + ++_instanceCount; + updateTransformation(); } inline void QueryStack::progress ( bool init ) { - if ( !init ) levelProgress (); + if (not init) levelProgress (); else { - if ( !levelDown() && ( size() > _startLevel ) ) + if (not levelDown() and (size() > _startLevel)) return; } - while ( !empty() ) { - if ( levelCompleted() ) { + while (not empty()) { + if (levelCompleted()) { levelUp (); } else { - if ( levelDown() ) continue; + if (levelDown()) continue; } - if ( size() > _startLevel ) return; - if ( empty() ) break; - levelProgress (); + if (size() > _startLevel) return; + if (empty()) break; + levelProgress(); } } diff --git a/hurricane/src/viewer/CellWidget.cpp b/hurricane/src/viewer/CellWidget.cpp index 13b0d5bd..2a09127d 100644 --- a/hurricane/src/viewer/CellWidget.cpp +++ b/hurricane/src/viewer/CellWidget.cpp @@ -1,14 +1,14 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2018, All Rights Reserved +// Copyright (c) UPMC 2008-2020, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | // | V L S I B a c k e n d D a t a - B a s e | // | | // | Author : Jean-Paul CHAPUT | -// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Module : "./CellWidget.cpp" | // +-----------------------------------------------------------------+ @@ -27,6 +27,7 @@ #include #include +#include "vlsisapd/configuration/Configuration.h" #include "hurricane/SharedName.h" #include "hurricane/DataBase.h" #include "hurricane/Technology.h" @@ -869,9 +870,12 @@ namespace Hurricane { void CellWidget::TextDrawingQuery::masterCellCallback () { - Box bbox = getTransformation().getBox(getMasterCell()->getAbutmentBox()); - if ( getDepth() == 2 ) - _cellWidget->drawText ( Point(bbox.getXMin(),bbox.getYMin()) + Box bb = getTransformation().getBox( getMasterCell()->getAbutmentBox() ); + QRect rectangle = _cellWidget->dbuToScreenRect( bb ); + if ( (getDepth() == 2) + and (rectangle.width () > _cellWidget->getPixelThreshold()) + and (rectangle.height() > 15*_cellWidget->getPixelThreshold())) + _cellWidget->drawText ( Point(bb.getXMin(),bb.getYMin()) , getString(getInstance()->getName()).c_str() , Reverse|Top , -90 @@ -1079,16 +1083,16 @@ namespace Hurricane { // Class : "Hurricane::CellWidget". - int CellWidget::_initialSide = 350; - - CellWidget::CellWidget ( QWidget* parent ) : QWidget (parent) , _technology (NULL) , _palette (NULL) - , _screenArea (0,0,_initialSide,_initialSide) + , _screenArea ( 0, 0 + , Cfg::getParamInt("viewer.minimumSize",350)->asInt() + , Cfg::getParamInt("viewer.minimumSize",350)->asInt() ) , _redrawManager (this) - , _drawingPlanes (QSize(_initialSide,_initialSide),this) + , _drawingPlanes (QSize(Cfg::getParamInt("viewer.minimumSize",350)->asInt() + ,Cfg::getParamInt("viewer.minimumSize",350)->asInt()),this) , _drawingQuery (this) , _textDrawingQuery (this) , _darkening (DisplayStyle::HSVr()) @@ -1106,6 +1110,7 @@ namespace Hurricane { , _commands () , _redrawRectCount (0) , _textFontHeight (20) + , _pixelThreshold (Cfg::getParamInt("viewer.pixelThreshold",50)->asInt()) { //setBackgroundRole ( QPalette::Dark ); //setAutoFillBackground ( false ); @@ -1123,8 +1128,8 @@ namespace Hurricane { _textFontHeight = QFontMetrics(font).ascent(); if (Graphics::isHighDpi()) { - resize( Graphics::toHighDpi(_initialSide) - , Graphics::toHighDpi(_initialSide) ); + resize( Graphics::toHighDpi(Cfg::getParamInt("viewer.minimumSize",350)->asInt()) + , Graphics::toHighDpi(Cfg::getParamInt("viewer.minimumSize",350)->asInt()) ); } } @@ -1243,7 +1248,8 @@ namespace Hurricane { QSize CellWidget::minimumSizeHint () const { - return QSize(Graphics::toHighDpi(_initialSide),Graphics::toHighDpi(_initialSide)); + return QSize(Graphics::toHighDpi(Cfg::getParamInt("viewer.minimumSize",350)->asInt()) + ,Graphics::toHighDpi(Cfg::getParamInt("viewer.minimumSize",350)->asInt())); } @@ -1351,7 +1357,7 @@ namespace Hurricane { Box redrawBox = screenToDbuBox( redrawArea ); //cerr << "redrawBox:" << redrawBox << endl; - //cerr << "Threshold:" << DbU::getValueString(screenToDbuLength(20)) << endl; + //cerr << "Threshold:" << DbU::getValueString(screenToDbuLength(_pixelThreshold)) << endl; _drawingQuery.resetGoCount (); _drawingQuery.resetExtensionGoCount(); @@ -1359,7 +1365,7 @@ namespace Hurricane { _drawingQuery.setExtensionMask ( 0 ); _drawingQuery.setArea ( redrawBox ); _drawingQuery.setTransformation ( Transformation() ); - _drawingQuery.setThreshold ( screenToDbuLength(20) ); + _drawingQuery.setThreshold ( screenToDbuLength(_pixelThreshold) ); for ( BasicLayer* layer : _technology->getBasicLayers() ) { _drawingPlanes.setPen ( Graphics::getPen (layer->getName(),getDarkening()) ); @@ -1395,6 +1401,7 @@ namespace Hurricane { } } + _drawingQuery.setStopLevel( _state->getStartLevel() + 1 ); if ( /*not timeout("redraw [markers]",timer,10.0,timedout) and*/ (not _redrawManager.interrupted()) ) { if ( isDrawable("text.reference") ) { _drawingPlanes.setPen ( Graphics::getPen ("text.reference",getDarkening()) ); @@ -1452,6 +1459,7 @@ namespace Hurricane { _drawingQuery.doQuery (); } } + _drawingQuery.setStopLevel( _state->getStopLevel() ); } _drawingPlanes.end(); @@ -1610,7 +1618,7 @@ namespace Hurricane { DbU::Unit unity = DbU::lambda(1.0); if (not item) return false; - return item->isItemVisible() and (Graphics::getThreshold(name) < getScale()*unity); + return item->isItemVisible(); //and (Graphics::getThreshold(name) < getScale()*unity); } @@ -1629,7 +1637,7 @@ namespace Hurricane { DbU::Unit unity = DbU::lambda(1.0); if (not item) return false; - return item->isItemVisible() and (Graphics::getThreshold(extensionName) < getScale()*unity); + return item->isItemVisible(); // and (Graphics::getThreshold(extensionName) < getScale()*unity); } @@ -2597,7 +2605,8 @@ namespace Hurricane { Occurrences CellWidget::getOccurrencesUnder ( const Box& area ) const { - return getCell()->getOccurrencesUnder(area,3).getSubSet(Occurrences_IsSelectable(this)); + return getCell()->getOccurrencesUnder( area, 3, screenToDbuLength(_pixelThreshold) ) \ + .getSubSet( Occurrences_IsSelectable(this) ); } diff --git a/hurricane/src/viewer/hurricane/viewer/CellWidget.h b/hurricane/src/viewer/hurricane/viewer/CellWidget.h index 2536d3a9..bc975ac3 100644 --- a/hurricane/src/viewer/hurricane/viewer/CellWidget.h +++ b/hurricane/src/viewer/hurricane/viewer/CellWidget.h @@ -166,6 +166,7 @@ namespace Hurricane { inline const DisplayStyle::HSVr& getDarkening () const; inline void copyToPrinter ( int xpaper, int ypaper, QPrinter*, PainterCb_t& ); inline void copyToImage ( QImage*, PainterCb_t& ); + inline int getPixelThreshold () const; inline const float& getScale () const; inline const QPoint& getMousePosition () const; inline void updateMousePosition (); @@ -639,7 +640,6 @@ namespace Hurricane { protected: // Internal: Attributes. - static int _initialSide; vector _cursors; // MapView* _mapView; Technology* _technology; @@ -664,6 +664,7 @@ namespace Hurricane { vector _commands; size_t _redrawRectCount; int _textFontHeight; + int _pixelThreshold; friend class RedrawManager; }; @@ -1113,6 +1114,9 @@ namespace Hurricane { { return _scaleHistory[_ihistory]._scale; } + inline int CellWidget::getPixelThreshold () const + { return _pixelThreshold; } + inline CellWidget::FindStateName::FindStateName ( const Name& cellHierName ) : unary_function< const shared_ptr&, bool >() , _cellHierName(cellHierName)