diff --git a/hurricane/src/hurricane/Contact.cpp b/hurricane/src/hurricane/Contact.cpp index 44195a6b..e44eb6fb 100644 --- a/hurricane/src/hurricane/Contact.cpp +++ b/hurricane/src/hurricane/Contact.cpp @@ -103,6 +103,9 @@ class Contact_Hooks : public Collection { // Contact implementation // **************************************************************************************************** +bool Contact::_checkMinSize = true; + + Contact::Contact(Net* net, const Layer* layer, DbU::Unit x, DbU::Unit y, DbU::Unit width, DbU::Unit height) // ******************************************************************************************************** : Inherit(net), @@ -169,12 +172,13 @@ Contact* Contact::create(Component* anchor, const Layer* layer, DbU::Unit dx, Db bool Contact::_postCheck () // ************************* { + DbU::Unit twoGrid = DbU::fromGrid( 2 ); bool rvalue = true; if (_layer->isSymbolic()) { if (not _width ) _width = _layer->getMinimalSize(); if (not _height) _height = _layer->getMinimalSize(); } else { - if ((_width) and (_width < _layer->getMinimalSize())) { + if ((_width) and _checkMinSize and (_width < _layer->getMinimalSize())) { cerr << Warning( "Contact::_postCheck(): Width %s is inferior to layer minimal size %s, bumping.\n" " (on %s)" , DbU::getValueString(_width).c_str() @@ -184,7 +188,7 @@ Contact* Contact::create(Component* anchor, const Layer* layer, DbU::Unit dx, Db _width = _layer->getMinimalSize(); rvalue = false; } - if ((_height) and (_height < _layer->getMinimalSize())) { + if ((_height) and _checkMinSize and (_height < _layer->getMinimalSize())) { cerr << Warning( "Contact::_postCheck(): Height %s is inferior to layer minimal size %s, bumping.\n" " (on %s)" , DbU::getValueString(_height).c_str() @@ -194,6 +198,24 @@ Contact* Contact::create(Component* anchor, const Layer* layer, DbU::Unit dx, Db _height = _layer->getMinimalSize(); rvalue = false; } + if ((_width % twoGrid) and _checkMinSize) { + cerr << Warning( "Contact::_postCheck(): Width %s is not a multiple of 2*%s, shrinking.\n" + " (on %s)" + , DbU::getValueString(_width).c_str() + , DbU::getValueString(DbU::fromGrid(1)).c_str() + , getString(this).c_str() ) + << endl; + _width -= (_width % twoGrid); + } + if ((_height % twoGrid) and _checkMinSize) { + cerr << Warning( "Contact::_postCheck(): Height %s is not a multiple of 2*%s, shrinking.\n" + " (on %s)" + , DbU::getValueString(_height).c_str() + , DbU::getValueString(DbU::fromGrid(1)).c_str() + , getString(this).c_str() ) + << endl; + _height -= (_height % twoGrid); + } } return rvalue; } diff --git a/hurricane/src/hurricane/hurricane/Contact.h b/hurricane/src/hurricane/hurricane/Contact.h index b3c2fe6b..1fee11b5 100644 --- a/hurricane/src/hurricane/hurricane/Contact.h +++ b/hurricane/src/hurricane/hurricane/Contact.h @@ -75,20 +75,22 @@ namespace Hurricane { , DbU::Unit height ); public: - static Contact* create ( Net* net - , const Layer* layer - , DbU::Unit x - , DbU::Unit y - , DbU::Unit width =0 - , DbU::Unit height=0 - ); - static Contact* create ( Component* anchor - , const Layer* layer - , DbU::Unit dx - , DbU::Unit dy - , DbU::Unit width =0 - , DbU::Unit height=0 - ); + static inline void enableCheckMinSize (); + static inline void disableCheckMinSize (); + static Contact* create ( Net* net + , const Layer* layer + , DbU::Unit x + , DbU::Unit y + , DbU::Unit width =0 + , DbU::Unit height=0 + ); + static Contact* create ( Component* anchor + , const Layer* layer + , DbU::Unit dx + , DbU::Unit dy + , DbU::Unit width =0 + , DbU::Unit height=0 + ); public: virtual Hooks getHooks () const; virtual DbU::Unit getX () const; @@ -128,18 +130,23 @@ namespace Hurricane { virtual std::string _getString () const; virtual Record* _getRecord () const; private: - AnchorHook _anchorHook; - const Layer* _layer; - DbU::Unit _dx; - DbU::Unit _dy; + static bool _checkMinSize; + AnchorHook _anchorHook; + const Layer* _layer; + DbU::Unit _dx; + DbU::Unit _dy; protected: - DbU::Unit _width; - DbU::Unit _height; + DbU::Unit _width; + DbU::Unit _height; }; + + inline void Contact::enableCheckMinSize () { _checkMinSize=true; } + inline void Contact::disableCheckMinSize () { _checkMinSize=false; } + // ------------------------------------------------------------------- -// Class : "Hurricane::Contact". +// Class : "Hurricane::JsonContact". class JsonContact : public JsonComponent { public: