diff --git a/hurricane/doc/hurricane/Contact.dox b/hurricane/doc/hurricane/Contact.dox index b0766c2c..2a016e6a 100644 --- a/hurricane/doc/hurricane/Contact.dox +++ b/hurricane/doc/hurricane/Contact.dox @@ -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 * \c \, on the layer \c \, of size \c \ * and \c \ and located at the absolute coordinates @@ -48,7 +48,7 @@ * \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 \, * of size \c \ and \c \ attached upon the * component \c \ through an offset defined by @@ -76,21 +76,21 @@ * transitory)). */ - /*! \function const DbU::Unit& Contact::getDx() const; + /*! \function DbU::Unit Contact::getDx() const; * \Return the relative abscissa of the contact. * * \remark If you want to get the absolute one use the member function * 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. * * \remark If you want to get the absolute one use the member function * getY() defined at the Component level. */ - /*! \function const DbU::Unit& Contact::getWidth() const; + /*! \function DbU::Unit Contact::getWidth() const; * \Return the contact width. */ @@ -98,7 +98,7 @@ * \Return the contact half width. */ - /*! \function const DbU::Unit& Contact::getHeight() const; + /*! \function DbU::Unit Contact::getHeight() const; * \Return the contact height. */ @@ -111,31 +111,31 @@ * sets the contact layer. */ - /*! \function void Contact::setWidth(const DbU::Unit& width); + /*! \function void Contact::setWidth(DbU::Unit width); * sets the contact width. */ - /*! \function void Contact::setHeight(const DbU::Unit& height); + /*! \function void Contact::setHeight(DbU::Unit 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. */ - /*! \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 * has a location relative to an other component, only relative * 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 * has a location relative to an other component, only relative * 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. */ @@ -145,21 +145,21 @@ * 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. * * \remark If the contact is absolute, this amounts to change its * 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. * * \remark If the contact is absolute, this amounts to change its * 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. * * \remark If the contact is absolute, this amounts to change its diff --git a/hurricane/src/hurricane/Contact.cpp b/hurricane/src/hurricane/Contact.cpp index 8285d0d7..44195a6b 100644 --- a/hurricane/src/hurricane/Contact.cpp +++ b/hurricane/src/hurricane/Contact.cpp @@ -103,8 +103,8 @@ class Contact_Hooks : public Collection { // 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), _anchorHook(this), _layer(layer), @@ -113,31 +113,12 @@ Contact::Contact(Net* net, const Layer* layer, const DbU::Unit& x, const DbU::Un _width(width), _height(height) { - if (not _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(); - } + if (not _layer) + throw Error("Contact::Contact(): Can't create " + _TName("Contact") + ", NULL layer."); } -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), _anchorHook(this), _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(); } -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->_postCreate(); - + contact->_postCheck(); 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) - throw Error("Can't create " + _TName("Contact") + " : null anchor"); + if (!anchor) + throw Error("Can't create " + _TName("Contact") + " : null anchor"); - Contact* contact = new Contact(anchor->getNet(), anchor, layer, dx, dy, width, height); - - contact->_postCreate(); - - return contact; + Contact* contact = new Contact(anchor->getNet(), anchor, layer, dx, dy, width, height); + contact->_postCreate(); + contact->_postCheck(); + 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 // **************************** { @@ -194,14 +205,14 @@ Hooks Contact::getHooks() const } DbU::Unit Contact::getX() const -// *********************** +// **************************** { Component* anchor = getAnchor(); return (!anchor) ? _dx : anchor->getX() + _dx; } DbU::Unit Contact::getY() const -// *********************** +// **************************** { Component* anchor = getAnchor(); 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) -// **************************************************** +// ************************************************************** { if ((dx != 0) || (dy != 0)) { invalidate(true); @@ -252,7 +263,7 @@ void Contact::translate(const DbU::Unit& dx, const DbU::Unit& dy) } void Contact::setLayer(const Layer* layer) -// ********************************* +// *************************************** { if (!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) { 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) { 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)) { 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()); } -void Contact::setY(const DbU::Unit& y) -// ****************************** +void Contact::setY(DbU::Unit 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(); if (!anchor) @@ -319,20 +330,20 @@ void Contact::setPosition(const Point& position) setPosition(position.getX(), position.getY()); } -void Contact::setDx(const DbU::Unit& dx) -// ******************************** +void Contact::setDx(DbU::Unit dx) +// ****************************** { setOffset(dx, _dy); } -void Contact::setDy(const DbU::Unit& dy) -// ******************************** +void Contact::setDy(DbU::Unit 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)) { invalidate(true); @@ -380,7 +391,7 @@ string Contact::_getString() const } Record* Contact::_getRecord() const -// ************************** +// ******************************** { Record* record = Inherit::_getRecord(); if (record) { @@ -427,7 +438,7 @@ string Contact::AnchorHook::_getString() const } Hook* Contact::AnchorHook::_compToHook(Component* component) -// *************************************************************** +// ********************************************************* { Contact* contact = dynamic_cast(component); if (not contact) { diff --git a/hurricane/src/hurricane/Pin.cpp b/hurricane/src/hurricane/Pin.cpp index 5de59b96..0d37a27c 100644 --- a/hurricane/src/hurricane/Pin.cpp +++ b/hurricane/src/hurricane/Pin.cpp @@ -17,6 +17,7 @@ // not, see . // **************************************************************************************************** +#include "hurricane/Warning.h" #include "hurricane/Cell.h" #include "hurricane/Pin.h" @@ -28,8 +29,8 @@ namespace Hurricane { // 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), _name(name), _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) 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"); Pin* pin = new Pin(net, name, accessDirection, placementStatus, layer, x, y, width, height); - pin->_postCreate(); - + pin->_postCheck(); 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) -// ********************************************************************** +// ***************************************************************** { if (placementstatus != _placementStatus) { invalidate(true); @@ -66,7 +99,7 @@ void Pin::setPlacementStatus(const PlacementStatus& placementstatus) } void Pin::_postCreate() -// ********************** +// ******************** { getCell()->_getPinMap()._insert(this); @@ -74,14 +107,14 @@ void Pin::_postCreate() } void Pin::_preDestroy() -// ********************* +// ******************** { Inherit::_preDestroy(); getCell()->_getPinMap()._remove(this); } string Pin::_getString() const -// ***************************** +// *************************** { string s = Inherit::_getString(); s.insert(s.length() - 1, " " + getString(_name)); @@ -90,7 +123,7 @@ string Pin::_getString() const } Record* Pin::_getRecord() const -// ************************ +// **************************** { Record* record = Inherit::_getRecord(); if (record) { @@ -101,89 +134,31 @@ Record* Pin::_getRecord() const 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::AccessDirection(const Code& code) -// ****************************************************** +Pin::AccessDirection::AccessDirection(Code code) +// ********************************************* : _code(code) { } Pin::AccessDirection::AccessDirection(const AccessDirection& accessDirection) -// **************************************************************************** +// ************************************************************************** : _code(accessDirection._code) { } Pin::AccessDirection& Pin::AccessDirection::operator=(const AccessDirection& accessDirection) -// ********************************************************************************************** +// ****************************************************************************************** { _code = accessDirection._code; return *this; } string Pin::AccessDirection::_getString() const -// ********************************************** +// ******************************************** { switch (_code) { case UNDEFINED : return "UNDEFINED"; @@ -196,7 +171,7 @@ string Pin::AccessDirection::_getString() const } Record* Pin::AccessDirection::_getRecord() const -// ***************************************** +// ********************************************* { Record* record = new Record(getString(this)); record->add(getSlot("Code", (int)_code)); @@ -209,8 +184,8 @@ Record* Pin::AccessDirection::_getRecord() const // Pin::PlacementStatus implementation // **************************************************************************************************** -Pin::PlacementStatus::PlacementStatus(const Code& code) -// **************************************************** +Pin::PlacementStatus::PlacementStatus(Code code) +// ********************************************* : _code(code) { } @@ -240,7 +215,7 @@ string Pin::PlacementStatus::_getString() const } Record* Pin::PlacementStatus::_getRecord() const -// *************************************** +// ********************************************* { Record* record = new Record(getString(this)); record->add(getSlot("Code", (int)_code)); diff --git a/hurricane/src/hurricane/hurricane/Contact.h b/hurricane/src/hurricane/hurricane/Contact.h index 2713c64b..b3c2fe6b 100644 --- a/hurricane/src/hurricane/hurricane/Contact.h +++ b/hurricane/src/hurricane/hurricane/Contact.h @@ -1,174 +1,158 @@ -// **************************************************************************************************** -// File: ./hurricane/Contact.h -// Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2018, All Rights Reserved +// -*- C++ -*- +// +// Copyright (c) BULL S.A. 2000-2020, All Rights Reserved // // This file is part of Hurricane. // -// Hurricane is free software: you can redistribute it and/or modify it under the terms of the GNU -// Lesser General Public License as published by the Free Software Foundation, either version 3 of the +// Hurricane is free software: you can redistribute it and/or modify +// 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. // -// Hurricane is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even -// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU +// Hurricane is distributed in the hope that it will be useful, but +// 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. // -// You should have received a copy of the Lesser GNU General Public License along with Hurricane. If -// not, see . -// **************************************************************************************************** +// You should have received a copy of the Lesser GNU General Public +// License along with Hurricane. If not, see +// . +// +// +-----------------------------------------------------------------+ +// | 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/Contacts.h" + namespace Hurricane { + +// ------------------------------------------------------------------- +// Class : "Hurricane::Contact". -// **************************************************************************************************** -// Contact declaration -// **************************************************************************************************** - -class Contact : public Component { -// ***************************** - -// Types -// ***** - - public: typedef Component Inherit; - - public: class AnchorHook : public Hook { - // *********************************** - + class Contact : public Component { + public: + typedef Component Inherit; + public: + class AnchorHook : public Hook { friend class Contact; - - public: typedef Hook Inherit; - - private: AnchorHook(Contact* contact); - - public: virtual Component* getComponent() const; - - public: virtual bool isMaster() const {return false;}; - - public: virtual string _getTypeName() const { return "Contact::AnchorHook"; }; - public: virtual string _getString() const; - public: static Hook* _compToHook(Component*); + public: + typedef Hook Inherit; + private: + AnchorHook ( Contact* ); + public: + virtual Component* getComponent () const; + virtual bool isMaster () const { return false; }; + virtual std::string _getTypeName () const { return "Contact::AnchorHook"; }; + virtual std::string _getString () const; + static Hook* _compToHook ( Component* ); }; -// Attributes -// ********** - - private: AnchorHook _anchorHook; - private: const Layer* _layer; - private: DbU::Unit _dx; - private: DbU::Unit _dy; - protected: DbU::Unit _width; - protected: DbU::Unit _height; - -// Constructors -// ************ - - protected: Contact( Net* net - , const Layer* layer - , const DbU::Unit& x - , const DbU::Unit& y - , const DbU::Unit& width = 0 - , const DbU::Unit& height = 0 - ); - protected: Contact( Net* net - , Component* anchor - , const Layer* layer - , const DbU::Unit& dx - , const DbU::Unit& dy - , const DbU::Unit& width = 0 - , const DbU::Unit& height = 0 - ); - - public: static 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 - ); - public: static 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 - ); - -// Accessors -// ********* - - public: virtual Hooks getHooks() const; - public: virtual DbU::Unit getX() const; - public: virtual DbU::Unit getY() const; - public: virtual Point getPosition() const; - public: virtual Box getBoundingBox() const; - public: virtual const Layer* getLayer() const {return _layer;}; - public: virtual Box getBoundingBox(const BasicLayer* basicLayer) const; - public: Hook* getAnchorHook() {return &_anchorHook;}; - public: Component* getAnchor() const; - public: const DbU::Unit& getDx() const {return _dx;}; - public: const DbU::Unit& getDy() const {return _dy;}; - public: const DbU::Unit& getWidth() const {return _width;}; - public: DbU::Unit getHalfWidth() const {return (_width / 2);}; - public: const DbU::Unit& getHeight() const {return _height;}; - public: DbU::Unit getHalfHeight() const {return (_height / 2);}; - -// Updators -// ******** - - public: virtual void translate(const DbU::Unit& dx, const DbU::Unit& dy); - - public: void setLayer(const Layer* layer); - public: void setWidth(const DbU::Unit& width); - public: void setHeight(const DbU::Unit& height); - public: void setSizes(const DbU::Unit& width, const DbU::Unit& height); - public: void setX(const DbU::Unit& x); - public: void setY(const DbU::Unit& y); - public: void setPosition(const DbU::Unit& x, const DbU::Unit& y); - public: void setPosition(const Point& position); - public: void setDx(const DbU::Unit& dx); - 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; - -}; + protected: + Contact ( Net* net + , const Layer* layer + , DbU::Unit x + , DbU::Unit y + , DbU::Unit width + , DbU::Unit height + ); + Contact ( Net* net + , Component* anchor + , const Layer* layer + , DbU::Unit dx + , DbU::Unit dy + , DbU::Unit width + , 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 + ); + public: + virtual Hooks getHooks () const; + virtual DbU::Unit getX () const; + virtual DbU::Unit getY () const; + virtual Point getPosition () const; + virtual Box getBoundingBox () const; + virtual const Layer* getLayer () const {return _layer;}; + virtual Box getBoundingBox ( const BasicLayer* ) const; + Hook* getAnchorHook () { return &_anchorHook; }; + Component* getAnchor () const; + DbU::Unit getDx () const { return _dx; }; + DbU::Unit getDy () const { return _dy; }; + DbU::Unit getWidth () const { return _width; }; + DbU::Unit getHalfWidth () const { return (_width / 2); }; + DbU::Unit getHeight () const { return _height; }; + DbU::Unit getHalfHeight () const { return (_height / 2); }; + public: + virtual void translate ( const DbU::Unit& dx, const DbU::Unit& dy ); + void setLayer ( const Layer* ); + void setWidth ( DbU::Unit ); + void setHeight ( DbU::Unit ); + void setSizes ( DbU::Unit width, DbU::Unit height); + void setX ( DbU::Unit ); + void setY ( DbU::Unit ); + void setPosition ( DbU::Unit x, DbU::Unit y); + void setPosition ( const Point& ); + void setDx ( DbU::Unit ); + void setDy ( DbU::Unit ); + void setOffset ( DbU::Unit dx, DbU::Unit dy); + private: + bool _postCheck (); + protected: + virtual void _preDestroy (); + public: + virtual void _toJson ( JsonWriter* ) const; + virtual std::string _getTypeName () const { return _TName("Contact"); }; + virtual std::string _getString () const; + virtual Record* _getRecord () const; + private: + AnchorHook _anchorHook; + const Layer* _layer; + DbU::Unit _dx; + DbU::Unit _dy; + protected: + DbU::Unit _width; + DbU::Unit _height; + }; -class JsonContact : public JsonComponent { -// *************************************** +// ------------------------------------------------------------------- +// Class : "Hurricane::Contact". - public: static void initialize(); - public: JsonContact(unsigned long flags); - public: virtual string getTypeName() const; - public: virtual JsonContact* clone(unsigned long) const; - public: virtual void toData(JsonStack&); -}; + class JsonContact : public JsonComponent { + public: + static void initialize (); + JsonContact ( unsigned long flags ); + 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::AnchorHook); - - -#endif // HURRICANE_CONTACT - - -// **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2018, All Rights Reserved -// **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Pin.h b/hurricane/src/hurricane/hurricane/Pin.h index aa70fc7b..9270f71e 100644 --- a/hurricane/src/hurricane/hurricane/Pin.h +++ b/hurricane/src/hurricane/hurricane/Pin.h @@ -1,167 +1,133 @@ -// **************************************************************************************************** -// File: ./hurricane/Pin.h -// Authors: C. Alexandre -// Copyright (c) BULL S.A. 2000-2018, All Rights Reserved +// -*- C++ -*- +// +// Copyright (c) BULL S.A. 2000-2020, All Rights Reserved // // This file is part of Hurricane. // -// Hurricane is free software: you can redistribute it and/or modify it under the terms of the GNU -// Lesser General Public License as published by the Free Software Foundation, either version 3 of the +// Hurricane is free software: you can redistribute it and/or modify +// 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. // -// Hurricane is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even -// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU +// Hurricane is distributed in the hope that it will be useful, but +// 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. // -// You should have received a copy of the Lesser GNU General Public License along with Hurricane. If -// not, see . -// **************************************************************************************************** - -#ifndef HURRICANE_PIN -#define HURRICANE_PIN +// You should have received a copy of the Lesser GNU General Public +// License along with Hurricane. If not, see +// . +// +// +-----------------------------------------------------------------+ +// | 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/Pins.h" namespace Hurricane { +// ------------------------------------------------------------------- +// Class : "Hurricane::Pin". -// **************************************************************************************************** -// Pin declaration -// **************************************************************************************************** - -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; + class Pin : public Contact { + public: + typedef Contact Inherit; + 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}; - - private: Code _code; - - public: PlacementStatus(const Code& code = UNPLACED); - public: PlacementStatus(const PlacementStatus& placementstatus); - - public: PlacementStatus& operator=(const PlacementStatus& placementstatus); - - public: operator const Code&() const {return _code;}; - - public: const Code& getCode() const {return _code;}; - - public: string _getTypeName() const { return _TName("Pin::PlacementStatus"); }; - public: string _getString() const; - public: Record* _getRecord() const; - - }; - -// Attributes -// ********** - - private: Name _name; - private: AccessDirection _accessDirection; - private: PlacementStatus _placementStatus; - private: Pin* _nextOfCellPinMap; - -// Constructors -// ************ - - protected: 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 = 0 - , const DbU::Unit& height = 0 - ); - public: static 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 = 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;}; - -}; + protected: + Pin ( Net* + , const Name& + , const AccessDirection& + , const PlacementStatus& + , const Layer* + , DbU::Unit x + , DbU::Unit y + , DbU::Unit width + , DbU::Unit height + ); + public: + static Pin* create ( Net* + , const Name& + , const AccessDirection& + , const PlacementStatus& + , const Layer* + , DbU::Unit x + , DbU::Unit y + , DbU::Unit width =0 + , DbU::Unit height=0 + ); + public: + const Name& getName () const { return _name; }; + const AccessDirection& getAccessDirection () const { return _accessDirection; }; + const PlacementStatus& getPlacementStatus () const { return _placementStatus; }; + bool isUnplaced () const { return _placementStatus == PlacementStatus::UNPLACED; }; + bool isPlaced () const { return _placementStatus == PlacementStatus::PLACED; }; + bool isFixed () const { return _placementStatus == PlacementStatus::FIXED; }; + void setPlacementStatus ( const PlacementStatus& ); + protected: + virtual void _postCreate (); + virtual void _preDestroy (); + private: + bool _postCheck (); + public: + virtual std::string _getTypeName () const {return _TName("Pin");}; + virtual std::string _getString () const; + virtual Record* _getRecord () const; + Pin* _getNextOfCellPinMap () const { return _nextOfCellPinMap; }; + void _setNextOfCellPinMap ( Pin* pin ) { _nextOfCellPinMap = pin; }; + private: + Name _name; + AccessDirection _accessDirection; + PlacementStatus _placementStatus; + Pin* _nextOfCellPinMap; + }; -} // End of Hurricane namespace. +} // Hurricane namespace. INSPECTOR_P_SUPPORT(Hurricane::Pin); INSPECTOR_PR_SUPPORT(Hurricane::Pin::AccessDirection); INSPECTOR_PR_SUPPORT(Hurricane::Pin::PlacementStatus); - - -#endif // HURRICANE_PIN - -// **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2018, All Rights Reserved -// ****************************************************************************************************