Allow to enable/disable minimal size checking in Contact CTOR.
This commit is contained in:
parent
1bff74a56e
commit
39231d5191
|
@ -103,6 +103,9 @@ class Contact_Hooks : public Collection<Hook*> {
|
||||||
// Contact implementation
|
// 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)
|
Contact::Contact(Net* net, const Layer* layer, DbU::Unit x, DbU::Unit y, DbU::Unit width, DbU::Unit height)
|
||||||
// ********************************************************************************************************
|
// ********************************************************************************************************
|
||||||
: Inherit(net),
|
: Inherit(net),
|
||||||
|
@ -169,12 +172,13 @@ Contact* Contact::create(Component* anchor, const Layer* layer, DbU::Unit dx, Db
|
||||||
bool Contact::_postCheck ()
|
bool Contact::_postCheck ()
|
||||||
// *************************
|
// *************************
|
||||||
{
|
{
|
||||||
|
DbU::Unit twoGrid = DbU::fromGrid( 2 );
|
||||||
bool rvalue = true;
|
bool rvalue = true;
|
||||||
if (_layer->isSymbolic()) {
|
if (_layer->isSymbolic()) {
|
||||||
if (not _width ) _width = _layer->getMinimalSize();
|
if (not _width ) _width = _layer->getMinimalSize();
|
||||||
if (not _height) _height = _layer->getMinimalSize();
|
if (not _height) _height = _layer->getMinimalSize();
|
||||||
} else {
|
} 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"
|
cerr << Warning( "Contact::_postCheck(): Width %s is inferior to layer minimal size %s, bumping.\n"
|
||||||
" (on %s)"
|
" (on %s)"
|
||||||
, DbU::getValueString(_width).c_str()
|
, DbU::getValueString(_width).c_str()
|
||||||
|
@ -184,7 +188,7 @@ Contact* Contact::create(Component* anchor, const Layer* layer, DbU::Unit dx, Db
|
||||||
_width = _layer->getMinimalSize();
|
_width = _layer->getMinimalSize();
|
||||||
rvalue = false;
|
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"
|
cerr << Warning( "Contact::_postCheck(): Height %s is inferior to layer minimal size %s, bumping.\n"
|
||||||
" (on %s)"
|
" (on %s)"
|
||||||
, DbU::getValueString(_height).c_str()
|
, DbU::getValueString(_height).c_str()
|
||||||
|
@ -194,6 +198,24 @@ Contact* Contact::create(Component* anchor, const Layer* layer, DbU::Unit dx, Db
|
||||||
_height = _layer->getMinimalSize();
|
_height = _layer->getMinimalSize();
|
||||||
rvalue = false;
|
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;
|
return rvalue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,20 +75,22 @@ namespace Hurricane {
|
||||||
, DbU::Unit height
|
, DbU::Unit height
|
||||||
);
|
);
|
||||||
public:
|
public:
|
||||||
static Contact* create ( Net* net
|
static inline void enableCheckMinSize ();
|
||||||
, const Layer* layer
|
static inline void disableCheckMinSize ();
|
||||||
, DbU::Unit x
|
static Contact* create ( Net* net
|
||||||
, DbU::Unit y
|
, const Layer* layer
|
||||||
, DbU::Unit width =0
|
, DbU::Unit x
|
||||||
, DbU::Unit height=0
|
, DbU::Unit y
|
||||||
);
|
, DbU::Unit width =0
|
||||||
static Contact* create ( Component* anchor
|
, DbU::Unit height=0
|
||||||
, const Layer* layer
|
);
|
||||||
, DbU::Unit dx
|
static Contact* create ( Component* anchor
|
||||||
, DbU::Unit dy
|
, const Layer* layer
|
||||||
, DbU::Unit width =0
|
, DbU::Unit dx
|
||||||
, DbU::Unit height=0
|
, DbU::Unit dy
|
||||||
);
|
, DbU::Unit width =0
|
||||||
|
, DbU::Unit height=0
|
||||||
|
);
|
||||||
public:
|
public:
|
||||||
virtual Hooks getHooks () const;
|
virtual Hooks getHooks () const;
|
||||||
virtual DbU::Unit getX () const;
|
virtual DbU::Unit getX () const;
|
||||||
|
@ -128,18 +130,23 @@ namespace Hurricane {
|
||||||
virtual std::string _getString () const;
|
virtual std::string _getString () const;
|
||||||
virtual Record* _getRecord () const;
|
virtual Record* _getRecord () const;
|
||||||
private:
|
private:
|
||||||
AnchorHook _anchorHook;
|
static bool _checkMinSize;
|
||||||
const Layer* _layer;
|
AnchorHook _anchorHook;
|
||||||
DbU::Unit _dx;
|
const Layer* _layer;
|
||||||
DbU::Unit _dy;
|
DbU::Unit _dx;
|
||||||
|
DbU::Unit _dy;
|
||||||
protected:
|
protected:
|
||||||
DbU::Unit _width;
|
DbU::Unit _width;
|
||||||
DbU::Unit _height;
|
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 {
|
class JsonContact : public JsonComponent {
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in New Issue