Separate size check for Hurricane::Contact & Hurricane::Pin.

* Change: In Hurricane::Contact, as it is the base class of Pin, a
    width *or* height can rightfully be null (according to the
    Pin orientation).
      Put the check in a Contact::_postCheck() function.
* Change: In Hurricane::Contact, replace all the "const DbU::Unit&"
    parameters by simply "DbU::Unit".
* Change: In Hurricane::Pin, add a dedicated _postCheck() function.
This commit is contained in:
Jean-Paul Chaput 2020-12-02 19:12:27 +01:00
parent 6e0593e526
commit 7feb39d056
5 changed files with 380 additions and 444 deletions

View File

@ -39,7 +39,7 @@
*/ */
/*! \function Contact* Contact::create(Net* net, const Layer* layer, const DbU::Unit& x, const DbU::Unit& y,const DbU::Unit& width = 0, const DbU::Unit& height = 0); /*! \function Contact* Contact::create(Net* net, const Layer* layer, DbU::Unit x, DbU::Unit y, DbU::Unit width=0, DbU::Unit height=0);
* creates and returns a new contact belonging to the net * creates and returns a new contact belonging to the net
* \c \<net\>, on the layer \c \<layer\>, of size \c \<width\> * \c \<net\>, on the layer \c \<layer\>, of size \c \<width\>
* and \c \<height\> and located at the absolute coordinates * and \c \<height\> and located at the absolute coordinates
@ -48,7 +48,7 @@
* \caution Throws an exception if the layer or the net is null. * \caution Throws an exception if the layer or the net is null.
*/ */
/*! \function Contact* Contact::create(Component* anchor, const Layer* layer, const DbU::Unit& dx, const DbU::Unit& dy,const DbU::Unit& width = 0, const DbU::Unit& height = 0); /*! \function Contact* Contact::create(Component* anchor, const Layer* layer, DbU::Unit dx, DbU::Unit dy, DbU::Unit width=0, DbU::Unit height=0);
* creates and returns a new contact on the layer \c \<layer\>, * creates and returns a new contact on the layer \c \<layer\>,
* of size \c \<width\> and \c \<height\> attached upon the * of size \c \<width\> and \c \<height\> attached upon the
* component \c \<anchor\> through an offset defined by * component \c \<anchor\> through an offset defined by
@ -76,21 +76,21 @@
* transitory)). * transitory)).
*/ */
/*! \function const DbU::Unit& Contact::getDx() const; /*! \function DbU::Unit Contact::getDx() const;
* \Return the relative abscissa of the contact. * \Return the relative abscissa of the contact.
* *
* \remark If you want to get the absolute one use the member function * \remark If you want to get the absolute one use the member function
* getX() defined at the Component level. * getX() defined at the Component level.
*/ */
/*! \function const DbU::Unit& Contact::getDy() const; /*! \function DbU::Unit Contact::getDy() const;
* \Return the relative ordinate of the contact. * \Return the relative ordinate of the contact.
* *
* \remark If you want to get the absolute one use the member function * \remark If you want to get the absolute one use the member function
* getY() defined at the Component level. * getY() defined at the Component level.
*/ */
/*! \function const DbU::Unit& Contact::getWidth() const; /*! \function DbU::Unit Contact::getWidth() const;
* \Return the contact width. * \Return the contact width.
*/ */
@ -98,7 +98,7 @@
* \Return the contact half width. * \Return the contact half width.
*/ */
/*! \function const DbU::Unit& Contact::getHeight() const; /*! \function DbU::Unit Contact::getHeight() const;
* \Return the contact height. * \Return the contact height.
*/ */
@ -111,31 +111,31 @@
* sets the contact layer. * sets the contact layer.
*/ */
/*! \function void Contact::setWidth(const DbU::Unit& width); /*! \function void Contact::setWidth(DbU::Unit width);
* sets the contact width. * sets the contact width.
*/ */
/*! \function void Contact::setHeight(const DbU::Unit& height); /*! \function void Contact::setHeight(DbU::Unit height);
* sets the contact height. * sets the contact height.
*/ */
/*! \function void Contact::setSizes(const DbU::Unit& width, const DbU::Unit& height); /*! \function void Contact::setSizes(DbU::Unit width, DbU::Unit height);
* sets both contact width and height. * sets both contact width and height.
*/ */
/*! \function void Contact::setX(const DbU::Unit& x); /*! \function void Contact::setX(DbU::Unit x);
* Allows to change the absolute abscissa of the contact (if it * Allows to change the absolute abscissa of the contact (if it
* has a location relative to an other component, only relative * has a location relative to an other component, only relative
* position to this last is accordingly changed). * position to this last is accordingly changed).
*/ */
/*! \function void Contact::setY(const DbU::Unit& y); /*! \function void Contact::setY(DbU::Unit y);
* Allows to change the absolute ordinate of the contact (if it * Allows to change the absolute ordinate of the contact (if it
* has a location relative to an other component, only relative * has a location relative to an other component, only relative
* position to this last is accordingly changed). * position to this last is accordingly changed).
*/ */
/*! \function void Contact::setPosition(const DbU::Unit& x, const DbU::Unit& y); /*! \function void Contact::setPosition(DbU::Unit x, DbU::Unit y);
* No description. * No description.
*/ */
@ -145,21 +145,21 @@
* position to this last is accordingly changed). * position to this last is accordingly changed).
*/ */
/*! \function void Contact::setDx(const DbU::Unit& dx); /*! \function void Contact::setDx(DbU::Unit dx);
* Allows to change the horizontal offset of the contact. * Allows to change the horizontal offset of the contact.
* *
* \remark If the contact is absolute, this amounts to change its * \remark If the contact is absolute, this amounts to change its
* absolute abscissa. * absolute abscissa.
*/ */
/*! \function void Contact::setDy(const DbU::Unit& dy); /*! \function void Contact::setDy(DbU::Unit dy);
* Allows to change the vertical offset of the contact. * Allows to change the vertical offset of the contact.
* *
* \remark If the contact is absolute, this amounts to change its * \remark If the contact is absolute, this amounts to change its
* absolute ordinate. * absolute ordinate.
*/ */
/*! \function void Contact::setOffset(const DbU::Unit& dx, const DbU::Unit& dy); /*! \function void Contact::setOffset(DbU::Unit dx, DbU::Unit dy);
* Allows to change the offset of the contact. * Allows to change the offset of the contact.
* *
* \remark If the contact is absolute, this amounts to change its * \remark If the contact is absolute, this amounts to change its

View File

@ -103,8 +103,8 @@ class Contact_Hooks : public Collection<Hook*> {
// Contact implementation // Contact implementation
// **************************************************************************************************** // ****************************************************************************************************
Contact::Contact(Net* net, const Layer* layer, const DbU::Unit& x, const DbU::Unit& y, const DbU::Unit& width, const 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),
_anchorHook(this), _anchorHook(this),
_layer(layer), _layer(layer),
@ -113,31 +113,12 @@ Contact::Contact(Net* net, const Layer* layer, const DbU::Unit& x, const DbU::Un
_width(width), _width(width),
_height(height) _height(height)
{ {
if (not _layer) if (not _layer)
throw Error("Contact::Contact(): Can't create " + _TName("Contact") + ", NULL layer."); throw Error("Contact::Contact(): Can't create " + _TName("Contact") + ", NULL layer.");
if ( _width < _layer->getMinimalSize() ) {
cerr << Warning( "Contact::Contact(): Width %s is inferior to layer minimal size %s, bumping.\n"
" (on %s)"
, DbU::getValueString(_width).c_str()
, DbU::getValueString(_layer->getMinimalSize()).c_str()
, getString(this).c_str() )
<< endl;
_width = _layer->getMinimalSize();
}
if ( _height < _layer->getMinimalSize() ) {
cerr << Warning( "Contact::Contact(): Height %s is inferior to layer minimal size %s, bumping.\n"
" (on %s)"
, DbU::getValueString(_height).c_str()
, DbU::getValueString(_layer->getMinimalSize()).c_str()
, getString(this).c_str() )
<< endl;
_height = _layer->getMinimalSize();
}
} }
Contact::Contact(Net* net, Component* anchor, const Layer* layer, const DbU::Unit& dx, const DbU::Unit& dy, const DbU::Unit& width, const DbU::Unit& height) Contact::Contact(Net* net, Component* anchor, const Layer* layer, DbU::Unit dx, DbU::Unit dy, DbU::Unit width, DbU::Unit height)
// **************************************************************************************************** // *****************************************************************************************************************************
: Inherit(net), : Inherit(net),
_anchorHook(this), _anchorHook(this),
_layer(layer), _layer(layer),
@ -164,29 +145,59 @@ Contact::Contact(Net* net, Component* anchor, const Layer* layer, const DbU::Uni
if ( _height < _layer->getMinimalSize() ) _height = _layer->getMinimalSize(); if ( _height < _layer->getMinimalSize() ) _height = _layer->getMinimalSize();
} }
Contact* Contact::create(Net* net, const Layer* layer, const DbU::Unit& x, const DbU::Unit& y, const DbU::Unit& width, const DbU::Unit& height) Contact* Contact::create(Net* net, const Layer* layer, DbU::Unit x, DbU::Unit y, DbU::Unit width, DbU::Unit height)
// **************************************************************************************************** // ****************************************************************************************************************
{ {
Contact* contact = new Contact(net, layer, x, y, width, height); Contact* contact = new Contact(net, layer, x, y, width, height);
contact->_postCreate(); contact->_postCreate();
contact->_postCheck();
return contact; return contact;
} }
Contact* Contact::create(Component* anchor, const Layer* layer, const DbU::Unit& dx, const DbU::Unit& dy, const DbU::Unit& width, const DbU::Unit& height) Contact* Contact::create(Component* anchor, const Layer* layer, DbU::Unit dx, DbU::Unit dy, DbU::Unit width, DbU::Unit height)
// **************************************************************************************************** // ***************************************************************************************************************************
{ {
if (!anchor) if (!anchor)
throw Error("Can't create " + _TName("Contact") + " : null anchor"); throw Error("Can't create " + _TName("Contact") + " : null anchor");
Contact* contact = new Contact(anchor->getNet(), anchor, layer, dx, dy, width, height); Contact* contact = new Contact(anchor->getNet(), anchor, layer, dx, dy, width, height);
contact->_postCreate();
contact->_postCreate(); contact->_postCheck();
return contact;
return contact;
} }
bool Contact::_postCheck ()
// *************************
{
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())) {
cerr << Warning( "Contact::_postCheck(): Width %s is inferior to layer minimal size %s, bumping.\n"
" (on %s)"
, DbU::getValueString(_width).c_str()
, DbU::getValueString(_layer->getMinimalSize()).c_str()
, getString(this).c_str() )
<< endl;
_width = _layer->getMinimalSize();
rvalue = false;
}
if ((_height) 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()
, DbU::getValueString(_layer->getMinimalSize()).c_str()
, getString(this).c_str() )
<< endl;
_height = _layer->getMinimalSize();
rvalue = false;
}
}
return rvalue;
}
Hooks Contact::getHooks() const Hooks Contact::getHooks() const
// **************************** // ****************************
{ {
@ -194,14 +205,14 @@ Hooks Contact::getHooks() const
} }
DbU::Unit Contact::getX() const DbU::Unit Contact::getX() const
// *********************** // ****************************
{ {
Component* anchor = getAnchor(); Component* anchor = getAnchor();
return (!anchor) ? _dx : anchor->getX() + _dx; return (!anchor) ? _dx : anchor->getX() + _dx;
} }
DbU::Unit Contact::getY() const DbU::Unit Contact::getY() const
// *********************** // ****************************
{ {
Component* anchor = getAnchor(); Component* anchor = getAnchor();
return (!anchor) ? _dy : anchor->getY() + _dy; return (!anchor) ? _dy : anchor->getY() + _dy;
@ -242,7 +253,7 @@ Component* Contact::getAnchor() const
} }
void Contact::translate(const DbU::Unit& dx, const DbU::Unit& dy) void Contact::translate(const DbU::Unit& dx, const DbU::Unit& dy)
// **************************************************** // **************************************************************
{ {
if ((dx != 0) || (dy != 0)) { if ((dx != 0) || (dy != 0)) {
invalidate(true); invalidate(true);
@ -252,7 +263,7 @@ void Contact::translate(const DbU::Unit& dx, const DbU::Unit& dy)
} }
void Contact::setLayer(const Layer* layer) void Contact::setLayer(const Layer* layer)
// ********************************* // ***************************************
{ {
if (!layer) if (!layer)
throw Error("Can't set layer : null layer"); throw Error("Can't set layer : null layer");
@ -263,8 +274,8 @@ void Contact::setLayer(const Layer* layer)
} }
} }
void Contact::setWidth(const DbU::Unit& width) void Contact::setWidth(DbU::Unit width)
// ************************************** // ************************************
{ {
if (width != _width) { if (width != _width) {
invalidate(false); invalidate(false);
@ -272,8 +283,8 @@ void Contact::setWidth(const DbU::Unit& width)
} }
} }
void Contact::setHeight(const DbU::Unit& height) void Contact::setHeight(DbU::Unit height)
// **************************************** // **************************************
{ {
if (height != _height) { if (height != _height) {
invalidate(false); invalidate(false);
@ -281,8 +292,8 @@ void Contact::setHeight(const DbU::Unit& height)
} }
} }
void Contact::setSizes(const DbU::Unit& width, const DbU::Unit& height) void Contact::setSizes(DbU::Unit width, DbU::Unit height)
// ********************************************************** // ******************************************************
{ {
if ((width != _width) || (height != _height)) { if ((width != _width) || (height != _height)) {
invalidate(false); invalidate(false);
@ -291,20 +302,20 @@ void Contact::setSizes(const DbU::Unit& width, const DbU::Unit& height)
} }
} }
void Contact::setX(const DbU::Unit& x) void Contact::setX(DbU::Unit x)
// ****************************** // ****************************
{ {
setPosition(x, getY()); setPosition(x, getY());
} }
void Contact::setY(const DbU::Unit& y) void Contact::setY(DbU::Unit y)
// ****************************** // ****************************
{ {
setPosition(getX(), y); setPosition(getX(), y);
} }
void Contact::setPosition(const DbU::Unit& x, const DbU::Unit& y) void Contact::setPosition(DbU::Unit x, DbU::Unit y)
// **************************************************** // ************************************************
{ {
Component* anchor = getAnchor(); Component* anchor = getAnchor();
if (!anchor) if (!anchor)
@ -319,20 +330,20 @@ void Contact::setPosition(const Point& position)
setPosition(position.getX(), position.getY()); setPosition(position.getX(), position.getY());
} }
void Contact::setDx(const DbU::Unit& dx) void Contact::setDx(DbU::Unit dx)
// ******************************** // ******************************
{ {
setOffset(dx, _dy); setOffset(dx, _dy);
} }
void Contact::setDy(const DbU::Unit& dy) void Contact::setDy(DbU::Unit dy)
// ******************************** // ******************************
{ {
setOffset(_dx, dy); setOffset(_dx, dy);
} }
void Contact::setOffset(const DbU::Unit& dx, const DbU::Unit& dy) void Contact::setOffset(DbU::Unit dx, DbU::Unit dy)
// **************************************************** // ************************************************
{ {
if ((dx != _dx) || (dy != _dy)) { if ((dx != _dx) || (dy != _dy)) {
invalidate(true); invalidate(true);
@ -380,7 +391,7 @@ string Contact::_getString() const
} }
Record* Contact::_getRecord() const Record* Contact::_getRecord() const
// ************************** // ********************************
{ {
Record* record = Inherit::_getRecord(); Record* record = Inherit::_getRecord();
if (record) { if (record) {
@ -427,7 +438,7 @@ string Contact::AnchorHook::_getString() const
} }
Hook* Contact::AnchorHook::_compToHook(Component* component) Hook* Contact::AnchorHook::_compToHook(Component* component)
// *************************************************************** // *********************************************************
{ {
Contact* contact = dynamic_cast<Contact*>(component); Contact* contact = dynamic_cast<Contact*>(component);
if (not contact) { if (not contact) {

View File

@ -17,6 +17,7 @@
// not, see <http://www.gnu.org/licenses/>. // not, see <http://www.gnu.org/licenses/>.
// **************************************************************************************************** // ****************************************************************************************************
#include "hurricane/Warning.h"
#include "hurricane/Cell.h" #include "hurricane/Cell.h"
#include "hurricane/Pin.h" #include "hurricane/Pin.h"
@ -28,8 +29,8 @@ namespace Hurricane {
// Pin implementation // Pin implementation
// **************************************************************************************************** // ****************************************************************************************************
Pin::Pin(Net* net, const Name& name, const AccessDirection& accessDirection, const PlacementStatus& placementStatus, const Layer* layer, const DbU::Unit& x, const DbU::Unit& y, const DbU::Unit& width, const DbU::Unit& height) Pin::Pin(Net* net, const Name& name, const AccessDirection& accessDirection, const PlacementStatus& placementStatus, const Layer* layer, DbU::Unit x, DbU::Unit y, DbU::Unit width, DbU::Unit height)
// **************************************************************************************************** // **************************************************************************************************************************************************************************************************
: Inherit(net, layer, x, y, width, height), : Inherit(net, layer, x, y, width, height),
_name(name), _name(name),
_accessDirection(accessDirection), _accessDirection(accessDirection),
@ -41,8 +42,8 @@ Pin::Pin(Net* net, const Name& name, const AccessDirection& accessDirection, con
} }
Pin* Pin::create(Net* net, const Name& name, const AccessDirection& accessDirection, const PlacementStatus& placementStatus, const Layer* layer, const DbU::Unit& x, const DbU::Unit& y, const DbU::Unit& width, const DbU::Unit& height) Pin* Pin::create(Net* net, const Name& name, const AccessDirection& accessDirection, const PlacementStatus& placementStatus, const Layer* layer, DbU::Unit x, DbU::Unit y, DbU::Unit width, DbU::Unit height)
// **************************************************************************************************** // **********************************************************************************************************************************************************************************************************
{ {
if (!net) if (!net)
throw Error("Can't create " + _TName("Pin") + " : NULL net"); throw Error("Can't create " + _TName("Pin") + " : NULL net");
@ -50,14 +51,46 @@ Pin* Pin::create(Net* net, const Name& name, const AccessDirection& accessDirect
throw Error("Can't create " + _TName("Pin") + " : NULL layer"); throw Error("Can't create " + _TName("Pin") + " : NULL layer");
Pin* pin = new Pin(net, name, accessDirection, placementStatus, layer, x, y, width, height); Pin* pin = new Pin(net, name, accessDirection, placementStatus, layer, x, y, width, height);
pin->_postCreate(); pin->_postCreate();
pin->_postCheck();
return pin; return pin;
} }
bool Pin::_postCheck ()
// *********************
{
bool rvalue = true;
if ((not getLayer()->isSymbolic() or (getWidth()))
and ( (_accessDirection == AccessDirection::NORTH)
or (_accessDirection == AccessDirection::SOUTH) )
and (getWidth() < getLayer()->getMinimalSize())) {
cerr << Warning( "Pin::_postCheck(): Width %s is inferior to layer minimal size %s, bumping.\n"
" (on %s)"
, DbU::getValueString(getWidth()).c_str()
, DbU::getValueString(getLayer()->getMinimalSize()).c_str()
, getString(this).c_str() )
<< endl;
setWidth( getLayer()->getMinimalSize() );
rvalue = false;
}
if ((not getLayer()->isSymbolic() or (getHeight()))
and ( (_accessDirection == AccessDirection::WEST)
or (_accessDirection == AccessDirection::EAST) )
and getHeight() < getLayer()->getMinimalSize()) {
cerr << Warning( "Pin::_postCheck(): Height %s is inferior to layer minimal size %s, bumping.\n"
" (on %s)"
, DbU::getValueString(getHeight()).c_str()
, DbU::getValueString(getLayer()->getMinimalSize()).c_str()
, getString(this).c_str() )
<< endl;
setHeight( getLayer()->getMinimalSize() );
rvalue = false;
}
return rvalue;
}
void Pin::setPlacementStatus(const PlacementStatus& placementstatus) void Pin::setPlacementStatus(const PlacementStatus& placementstatus)
// ********************************************************************** // *****************************************************************
{ {
if (placementstatus != _placementStatus) { if (placementstatus != _placementStatus) {
invalidate(true); invalidate(true);
@ -66,7 +99,7 @@ void Pin::setPlacementStatus(const PlacementStatus& placementstatus)
} }
void Pin::_postCreate() void Pin::_postCreate()
// ********************** // ********************
{ {
getCell()->_getPinMap()._insert(this); getCell()->_getPinMap()._insert(this);
@ -74,14 +107,14 @@ void Pin::_postCreate()
} }
void Pin::_preDestroy() void Pin::_preDestroy()
// ********************* // ********************
{ {
Inherit::_preDestroy(); Inherit::_preDestroy();
getCell()->_getPinMap()._remove(this); getCell()->_getPinMap()._remove(this);
} }
string Pin::_getString() const string Pin::_getString() const
// ***************************** // ***************************
{ {
string s = Inherit::_getString(); string s = Inherit::_getString();
s.insert(s.length() - 1, " " + getString(_name)); s.insert(s.length() - 1, " " + getString(_name));
@ -90,7 +123,7 @@ string Pin::_getString() const
} }
Record* Pin::_getRecord() const Record* Pin::_getRecord() const
// ************************ // ****************************
{ {
Record* record = Inherit::_getRecord(); Record* record = Inherit::_getRecord();
if (record) { if (record) {
@ -101,89 +134,31 @@ Record* Pin::_getRecord() const
return record; return record;
} }
//void Pin::_Draw(View* view, BasicLayer* basicLayer, const Box& updateArea, const Transformation& transformation)
//// *************************************************************************************************************
//{
// view->FillRectangle(transformation.getBox(getBoundingBox(basicLayer)), true);
//}
//
//void Pin::_Highlight(View* view, const Box& updateArea, const Transformation& transformation)
//// ******************************************************************************************
//{
// if (_width && _height) {
// if (1 < view->getScreenSize(max(_width, _height))) {
// for_each_basic_layer(basicLayer, getLayer()->getBasicLayers()) {
// basicLayer->_Fill(view, transformation.getBox(getBoundingBox(basicLayer)));
// end_for;
// }
// }
// }
// if (view->getScale() <= 1)
// view->DrawPoint(transformation.getPoint(getPosition()), 1);
// else if (view->getScale() <= 3)
// {
// view->DrawPoint(transformation.getPoint(getPosition()), 2);
//
// if ( view->IsTextVisible() )
// {
// string text = "("
// + getString ( getValue ( getX() ) ) + ","
// + getString ( getValue ( getY() ) ) + ")";
// view->DrawString ( text,
// transformation.getBox ( getBoundingBox() ).getXMin(),
// transformation.getBox ( getBoundingBox() ).getYMax() );
// }
// }
// else {
// Point position = getPosition();
// view->DrawPoint(transformation.getPoint(position), 3);
// if (_width) {
// Box box = transformation.getBox(Box(position).Inflate(getHalfWidth(), 0));
// view->DrawLine(box.getXMin(), box.getYMin(), box.getXMax(), box.getYMax());
// }
// if (_height) {
// Box box = transformation.getBox(Box(position).Inflate(0, getHalfHeight()));
// view->DrawLine(box.getXMin(), box.getYMin(), box.getXMax(), box.getYMax());
// }
//
// if ( view->IsTextVisible() )
// {
// string text = getString ( _name ) + "("
// + getString ( getValue ( getX() ) ) + ","
// + getString ( getValue ( getY() ) ) + ")";
// view->DrawString ( text,
// transformation.getBox ( getBoundingBox() ).getXMin(),
// transformation.getBox ( getBoundingBox() ).getYMax() );
// }
// }
//}
//
// **************************************************************************************************** // ****************************************************************************************************
// Pin::AccessDirection implementation // Pin::AccessDirection implementation
// **************************************************************************************************** // ****************************************************************************************************
Pin::AccessDirection::AccessDirection(const Code& code) Pin::AccessDirection::AccessDirection(Code code)
// ****************************************************** // *********************************************
: _code(code) : _code(code)
{ {
} }
Pin::AccessDirection::AccessDirection(const AccessDirection& accessDirection) Pin::AccessDirection::AccessDirection(const AccessDirection& accessDirection)
// **************************************************************************** // **************************************************************************
: _code(accessDirection._code) : _code(accessDirection._code)
{ {
} }
Pin::AccessDirection& Pin::AccessDirection::operator=(const AccessDirection& accessDirection) Pin::AccessDirection& Pin::AccessDirection::operator=(const AccessDirection& accessDirection)
// ********************************************************************************************** // ******************************************************************************************
{ {
_code = accessDirection._code; _code = accessDirection._code;
return *this; return *this;
} }
string Pin::AccessDirection::_getString() const string Pin::AccessDirection::_getString() const
// ********************************************** // ********************************************
{ {
switch (_code) { switch (_code) {
case UNDEFINED : return "UNDEFINED"; case UNDEFINED : return "UNDEFINED";
@ -196,7 +171,7 @@ string Pin::AccessDirection::_getString() const
} }
Record* Pin::AccessDirection::_getRecord() const Record* Pin::AccessDirection::_getRecord() const
// ***************************************** // *********************************************
{ {
Record* record = new Record(getString(this)); Record* record = new Record(getString(this));
record->add(getSlot("Code", (int)_code)); record->add(getSlot("Code", (int)_code));
@ -209,8 +184,8 @@ Record* Pin::AccessDirection::_getRecord() const
// Pin::PlacementStatus implementation // Pin::PlacementStatus implementation
// **************************************************************************************************** // ****************************************************************************************************
Pin::PlacementStatus::PlacementStatus(const Code& code) Pin::PlacementStatus::PlacementStatus(Code code)
// **************************************************** // *********************************************
: _code(code) : _code(code)
{ {
} }
@ -240,7 +215,7 @@ string Pin::PlacementStatus::_getString() const
} }
Record* Pin::PlacementStatus::_getRecord() const Record* Pin::PlacementStatus::_getRecord() const
// *************************************** // *********************************************
{ {
Record* record = new Record(getString(this)); Record* record = new Record(getString(this));
record->add(getSlot("Code", (int)_code)); record->add(getSlot("Code", (int)_code));

View File

@ -1,174 +1,158 @@
// **************************************************************************************************** // -*- C++ -*-
// File: ./hurricane/Contact.h //
// Authors: R. Escassut // Copyright (c) BULL S.A. 2000-2020, All Rights Reserved
// Copyright (c) BULL S.A. 2000-2018, All Rights Reserved
// //
// This file is part of Hurricane. // This file is part of Hurricane.
// //
// Hurricane is free software: you can redistribute it and/or modify it under the terms of the GNU // Hurricane is free software: you can redistribute it and/or modify
// Lesser General Public License as published by the Free Software Foundation, either version 3 of the // it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// Hurricane is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even // Hurricane is distributed in the hope that it will be useful, but
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-
// TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU
// General Public License for more details. // General Public License for more details.
// //
// You should have received a copy of the Lesser GNU General Public License along with Hurricane. If // You should have received a copy of the Lesser GNU General Public
// not, see <http://www.gnu.org/licenses/>. // License along with Hurricane. If not, see
// **************************************************************************************************** // <http://www.gnu.org/licenses/>.
//
// +-----------------------------------------------------------------+
// | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | Author : Remy Escassut |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Header : "./hurricane/Commons.h" |
// +-----------------------------------------------------------------+
#ifndef HURRICANE_CONTACT
#define HURRICANE_CONTACT
#pragma once
#include "hurricane/Component.h" #include "hurricane/Component.h"
#include "hurricane/Contacts.h" #include "hurricane/Contacts.h"
namespace Hurricane { namespace Hurricane {
// -------------------------------------------------------------------
// Class : "Hurricane::Contact".
// **************************************************************************************************** class Contact : public Component {
// Contact declaration public:
// **************************************************************************************************** typedef Component Inherit;
public:
class Contact : public Component { class AnchorHook : public Hook {
// *****************************
// Types
// *****
public: typedef Component Inherit;
public: class AnchorHook : public Hook {
// ***********************************
friend class Contact; friend class Contact;
public:
public: typedef Hook Inherit; typedef Hook Inherit;
private:
private: AnchorHook(Contact* contact); AnchorHook ( Contact* );
public:
public: virtual Component* getComponent() const; virtual Component* getComponent () const;
virtual bool isMaster () const { return false; };
public: virtual bool isMaster() const {return false;}; virtual std::string _getTypeName () const { return "Contact::AnchorHook"; };
virtual std::string _getString () const;
public: virtual string _getTypeName() const { return "Contact::AnchorHook"; }; static Hook* _compToHook ( Component* );
public: virtual string _getString() const;
public: static Hook* _compToHook(Component*);
}; };
// Attributes protected:
// ********** Contact ( Net* net
, const Layer* layer
private: AnchorHook _anchorHook; , DbU::Unit x
private: const Layer* _layer; , DbU::Unit y
private: DbU::Unit _dx; , DbU::Unit width
private: DbU::Unit _dy; , DbU::Unit height
protected: DbU::Unit _width; );
protected: DbU::Unit _height; Contact ( Net* net
, Component* anchor
// Constructors , const Layer* layer
// ************ , DbU::Unit dx
, DbU::Unit dy
protected: Contact( Net* net , DbU::Unit width
, const Layer* layer , DbU::Unit height
, const DbU::Unit& x );
, const DbU::Unit& y public:
, const DbU::Unit& width = 0 static Contact* create ( Net* net
, const DbU::Unit& height = 0 , const Layer* layer
); , DbU::Unit x
protected: Contact( Net* net , DbU::Unit y
, Component* anchor , DbU::Unit width =0
, const Layer* layer , DbU::Unit height=0
, const DbU::Unit& dx );
, const DbU::Unit& dy static Contact* create ( Component* anchor
, const DbU::Unit& width = 0 , const Layer* layer
, const DbU::Unit& height = 0 , DbU::Unit dx
); , DbU::Unit dy
, DbU::Unit width =0
public: static Contact* create( Net* net , DbU::Unit height=0
, const Layer* layer );
, const DbU::Unit& x public:
, const DbU::Unit& y virtual Hooks getHooks () const;
, const DbU::Unit& width = 0 virtual DbU::Unit getX () const;
, const DbU::Unit& height = 0 virtual DbU::Unit getY () const;
); virtual Point getPosition () const;
public: static Contact* create( Component* anchor virtual Box getBoundingBox () const;
, const Layer* layer virtual const Layer* getLayer () const {return _layer;};
, const DbU::Unit& dx virtual Box getBoundingBox ( const BasicLayer* ) const;
, const DbU::Unit& dy Hook* getAnchorHook () { return &_anchorHook; };
, const DbU::Unit& width = 0 Component* getAnchor () const;
, const DbU::Unit& height = 0 DbU::Unit getDx () const { return _dx; };
); DbU::Unit getDy () const { return _dy; };
DbU::Unit getWidth () const { return _width; };
// Accessors DbU::Unit getHalfWidth () const { return (_width / 2); };
// ********* DbU::Unit getHeight () const { return _height; };
DbU::Unit getHalfHeight () const { return (_height / 2); };
public: virtual Hooks getHooks() const; public:
public: virtual DbU::Unit getX() const; virtual void translate ( const DbU::Unit& dx, const DbU::Unit& dy );
public: virtual DbU::Unit getY() const; void setLayer ( const Layer* );
public: virtual Point getPosition() const; void setWidth ( DbU::Unit );
public: virtual Box getBoundingBox() const; void setHeight ( DbU::Unit );
public: virtual const Layer* getLayer() const {return _layer;}; void setSizes ( DbU::Unit width, DbU::Unit height);
public: virtual Box getBoundingBox(const BasicLayer* basicLayer) const; void setX ( DbU::Unit );
public: Hook* getAnchorHook() {return &_anchorHook;}; void setY ( DbU::Unit );
public: Component* getAnchor() const; void setPosition ( DbU::Unit x, DbU::Unit y);
public: const DbU::Unit& getDx() const {return _dx;}; void setPosition ( const Point& );
public: const DbU::Unit& getDy() const {return _dy;}; void setDx ( DbU::Unit );
public: const DbU::Unit& getWidth() const {return _width;}; void setDy ( DbU::Unit );
public: DbU::Unit getHalfWidth() const {return (_width / 2);}; void setOffset ( DbU::Unit dx, DbU::Unit dy);
public: const DbU::Unit& getHeight() const {return _height;}; private:
public: DbU::Unit getHalfHeight() const {return (_height / 2);}; bool _postCheck ();
protected:
// Updators virtual void _preDestroy ();
// ******** public:
virtual void _toJson ( JsonWriter* ) const;
public: virtual void translate(const DbU::Unit& dx, const DbU::Unit& dy); virtual std::string _getTypeName () const { return _TName("Contact"); };
virtual std::string _getString () const;
public: void setLayer(const Layer* layer); virtual Record* _getRecord () const;
public: void setWidth(const DbU::Unit& width); private:
public: void setHeight(const DbU::Unit& height); AnchorHook _anchorHook;
public: void setSizes(const DbU::Unit& width, const DbU::Unit& height); const Layer* _layer;
public: void setX(const DbU::Unit& x); DbU::Unit _dx;
public: void setY(const DbU::Unit& y); DbU::Unit _dy;
public: void setPosition(const DbU::Unit& x, const DbU::Unit& y); protected:
public: void setPosition(const Point& position); DbU::Unit _width;
public: void setDx(const DbU::Unit& dx); DbU::Unit _height;
public: void setDy(const DbU::Unit& dy); };
public: void setOffset(const DbU::Unit& dx, const DbU::Unit& dy);
// Others
// ******
protected: virtual void _preDestroy();
public: virtual void _toJson(JsonWriter*) const;
public: virtual string _getTypeName() const {return _TName("Contact");};
public: virtual string _getString() const;
public: virtual Record* _getRecord() const;
};
class JsonContact : public JsonComponent { // -------------------------------------------------------------------
// *************************************** // Class : "Hurricane::Contact".
public: static void initialize(); class JsonContact : public JsonComponent {
public: JsonContact(unsigned long flags); public:
public: virtual string getTypeName() const; static void initialize ();
public: virtual JsonContact* clone(unsigned long) const; JsonContact ( unsigned long flags );
public: virtual void toData(JsonStack&); virtual std::string getTypeName () const;
}; virtual JsonContact* clone ( unsigned long ) const;
virtual void toData ( JsonStack& );
};
} // End of Hurricane namespace.
} // Hurricane namespace.
INSPECTOR_P_SUPPORT(Hurricane::Contact); INSPECTOR_P_SUPPORT(Hurricane::Contact);
INSPECTOR_P_SUPPORT(Hurricane::Contact::AnchorHook); INSPECTOR_P_SUPPORT(Hurricane::Contact::AnchorHook);
#endif // HURRICANE_CONTACT
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2018, All Rights Reserved
// ****************************************************************************************************

View File

@ -1,167 +1,133 @@
// **************************************************************************************************** // -*- C++ -*-
// File: ./hurricane/Pin.h //
// Authors: C. Alexandre // Copyright (c) BULL S.A. 2000-2020, All Rights Reserved
// Copyright (c) BULL S.A. 2000-2018, All Rights Reserved
// //
// This file is part of Hurricane. // This file is part of Hurricane.
// //
// Hurricane is free software: you can redistribute it and/or modify it under the terms of the GNU // Hurricane is free software: you can redistribute it and/or modify
// Lesser General Public License as published by the Free Software Foundation, either version 3 of the // it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// Hurricane is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even // Hurricane is distributed in the hope that it will be useful, but
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-
// TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU
// General Public License for more details. // General Public License for more details.
// //
// You should have received a copy of the Lesser GNU General Public License along with Hurricane. If // You should have received a copy of the Lesser GNU General Public
// not, see <http://www.gnu.org/licenses/>. // License along with Hurricane. If not, see
// **************************************************************************************************** // <http://www.gnu.org/licenses/>.
//
#ifndef HURRICANE_PIN // +-----------------------------------------------------------------+
#define HURRICANE_PIN // | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | Author : Christophe Alexandre |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Header : "./hurricane/Commons.h" |
// +-----------------------------------------------------------------+
#pragma once
#include "hurricane/Contact.h" #include "hurricane/Contact.h"
#include "hurricane/Pins.h" #include "hurricane/Pins.h"
namespace Hurricane { namespace Hurricane {
// -------------------------------------------------------------------
// Class : "Hurricane::Pin".
// **************************************************************************************************** class Pin : public Contact {
// Pin declaration public:
// **************************************************************************************************** typedef Contact Inherit;
class Pin : public Contact {
// ***********************
// Types
// *****
public: typedef Contact Inherit;
public: class AccessDirection {
// **************************
public: enum Code {UNDEFINED=0, NORTH=1, SOUTH=2, EAST=3, WEST=4};
private: Code _code;
public: AccessDirection(const Code& code = UNDEFINED);
public: AccessDirection(const AccessDirection& accessDirection);
public: AccessDirection& operator=(const AccessDirection& accessDirection);
public: operator const Code&() const {return _code;};
public: const Code& getCode() const {return _code;};
public: string _getTypeName() const { return _TName("Pin::AccessDirection"); };
public: string _getString() const;
public: Record* _getRecord() const;
public:
class AccessDirection {
public:
enum Code { UNDEFINED=0, NORTH=1, SOUTH=2, EAST=3, WEST=4 };
public:
AccessDirection ( Code code=UNDEFINED );
AccessDirection ( const AccessDirection& accessDirection );
AccessDirection& operator= ( const AccessDirection& accessDirection );
operator Code () const { return _code; };
Code getCode () const { return _code; };
std::string _getTypeName () const { return _TName("Pin::AccessDirection"); };
std::string _getString () const;
Record* _getRecord () const;
private:
Code _code;
}; };
public: class PlacementStatus { public:
// ************************** class PlacementStatus {
public:
enum Code { UNPLACED=0, PLACED=1, FIXED=2 };
public:
PlacementStatus ( Code code=UNPLACED);
PlacementStatus ( const PlacementStatus& placementstatus );
PlacementStatus& operator= ( const PlacementStatus& placementstatus );
operator Code () const { return _code; };
Code getCode () const { return _code; };
std::string _getTypeName () const { return _TName("Pin::PlacementStatus"); };
std::string _getString () const;
Record* _getRecord () const;
private:
Code _code;
};
public: enum Code {UNPLACED=0, PLACED=1, FIXED=2}; protected:
Pin ( Net*
private: Code _code; , const Name&
, const AccessDirection&
public: PlacementStatus(const Code& code = UNPLACED); , const PlacementStatus&
public: PlacementStatus(const PlacementStatus& placementstatus); , const Layer*
, DbU::Unit x
public: PlacementStatus& operator=(const PlacementStatus& placementstatus); , DbU::Unit y
, DbU::Unit width
public: operator const Code&() const {return _code;}; , DbU::Unit height
);
public: const Code& getCode() const {return _code;}; public:
static Pin* create ( Net*
public: string _getTypeName() const { return _TName("Pin::PlacementStatus"); }; , const Name&
public: string _getString() const; , const AccessDirection&
public: Record* _getRecord() const; , const PlacementStatus&
, const Layer*
}; , DbU::Unit x
, DbU::Unit y
// Attributes , DbU::Unit width =0
// ********** , DbU::Unit height=0
);
private: Name _name; public:
private: AccessDirection _accessDirection; const Name& getName () const { return _name; };
private: PlacementStatus _placementStatus; const AccessDirection& getAccessDirection () const { return _accessDirection; };
private: Pin* _nextOfCellPinMap; const PlacementStatus& getPlacementStatus () const { return _placementStatus; };
bool isUnplaced () const { return _placementStatus == PlacementStatus::UNPLACED; };
// Constructors bool isPlaced () const { return _placementStatus == PlacementStatus::PLACED; };
// ************ bool isFixed () const { return _placementStatus == PlacementStatus::FIXED; };
void setPlacementStatus ( const PlacementStatus& );
protected: Pin( Net* net protected:
, const Name& name virtual void _postCreate ();
, const AccessDirection& accessDirection virtual void _preDestroy ();
, const PlacementStatus& placementStatus private:
, const Layer* layer bool _postCheck ();
, const DbU::Unit& x public:
, const DbU::Unit& y virtual std::string _getTypeName () const {return _TName("Pin");};
, const DbU::Unit& width = 0 virtual std::string _getString () const;
, const DbU::Unit& height = 0 virtual Record* _getRecord () const;
); Pin* _getNextOfCellPinMap () const { return _nextOfCellPinMap; };
public: static Pin* create( Net* net void _setNextOfCellPinMap ( Pin* pin ) { _nextOfCellPinMap = pin; };
, const Name& name private:
, const AccessDirection& accessDirection Name _name;
, const PlacementStatus& placementStatus AccessDirection _accessDirection;
, const Layer* layer PlacementStatus _placementStatus;
, const DbU::Unit& x Pin* _nextOfCellPinMap;
, const DbU::Unit& y };
, const DbU::Unit& width = 0
, const DbU::Unit& height = 0
);
// Accessors
// *********
public: const Name& getName() const {return _name;};
public: const AccessDirection& getAccessDirection() const {return _accessDirection;};
public: const PlacementStatus& getPlacementStatus() const {return _placementStatus;};
// Predicates
// **********
public: bool isUnplaced() const {return _placementStatus == PlacementStatus::UNPLACED;};
public: bool isPlaced() const {return _placementStatus == PlacementStatus::PLACED;};
public: bool isFixed() const {return _placementStatus == PlacementStatus::FIXED;};
// Updators
// ********
public: void setPlacementStatus(const PlacementStatus& placementstatus);
// Others
// ******
protected: virtual void _postCreate();
protected: virtual void _preDestroy();
public: virtual string _getTypeName() const {return _TName("Pin");};
public: virtual string _getString() const;
public: virtual Record* _getRecord() const;
public: Pin* _getNextOfCellPinMap() const {return _nextOfCellPinMap;};
public: void _setNextOfCellPinMap(Pin* pin) {_nextOfCellPinMap = pin;};
};
} // End of Hurricane namespace. } // Hurricane namespace.
INSPECTOR_P_SUPPORT(Hurricane::Pin); INSPECTOR_P_SUPPORT(Hurricane::Pin);
INSPECTOR_PR_SUPPORT(Hurricane::Pin::AccessDirection); INSPECTOR_PR_SUPPORT(Hurricane::Pin::AccessDirection);
INSPECTOR_PR_SUPPORT(Hurricane::Pin::PlacementStatus); INSPECTOR_PR_SUPPORT(Hurricane::Pin::PlacementStatus);
#endif // HURRICANE_PIN
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2018, All Rights Reserved
// ****************************************************************************************************