From 07935d2872a0f01502866c2e54c61d38766b197c Mon Sep 17 00:00:00 2001 From: EricLaoGitHub Date: Wed, 13 Jul 2016 14:53:07 +0200 Subject: [PATCH] GCell.h: - Add: set new xmin and ymin, update contact position accordingly. --- anabatic/src/GCell.cpp | 33 +++++++++++++++++++++++++++++++++ anabatic/src/anabatic/GCell.h | 12 ++++++++++++ 2 files changed, 45 insertions(+) diff --git a/anabatic/src/GCell.cpp b/anabatic/src/GCell.cpp index 33c00627..d02479e1 100644 --- a/anabatic/src/GCell.cpp +++ b/anabatic/src/GCell.cpp @@ -604,6 +604,39 @@ namespace Anabatic { } + void GCell::setXY ( DbU::Unit x, DbU::Unit y ) + { + UpdateSession::open(); + _xmin = x; + _ymin = y; + UpdateSession::close(); + } + + + void GCell::updateContactsPosition () + { + UpdateSession::open(); + DbU::Unit xc = (getXMax() + getXMin())/2; + DbU::Unit yc = (getYMax() + getYMin())/2; + for (vector::iterator it = _contacts.begin(); it != _contacts.end(); it++){ + for ( Component* c : (*it)->getSlaveComponents() ){ + Horizontal* h = dynamic_cast(c); + Vertical* v = dynamic_cast (c); + if (h){ + //if (h->getY() == (*it)->getY()) h->setY(yc); + h->setY(yc); + } else if (v) { + //if (v->getX() == (*it)->getX()) v->setX(xc); + v->setX(xc); + } + } + (*it)->setX(xc); + (*it)->setY(yc); + } + UpdateSession::close(); + } + + const Name& GCell::getName () const { return _extensionName; } diff --git a/anabatic/src/anabatic/GCell.h b/anabatic/src/anabatic/GCell.h index eb91fcc2..c5766f8d 100644 --- a/anabatic/src/anabatic/GCell.h +++ b/anabatic/src/anabatic/GCell.h @@ -23,9 +23,15 @@ #include "hurricane/Name.h" #include "hurricane/Box.h" #include "hurricane/Cell.h" +#include "hurricane/Component.h" +#include "hurricane/Horizontal.h" +#include "hurricane/Vertical.h" #include "hurricane/ExtensionGo.h" namespace Hurricane { class Contact; + class Component; + class Horizontal; + class Vertical; } #include "anabatic/Edge.h" @@ -46,6 +52,9 @@ namespace Anabatic { using Hurricane::Entity; using Hurricane::Contact; using Hurricane::Cell; + using Hurricane::Component; + using Hurricane::Horizontal; + using Hurricane::Vertical; class AnabaticEngine; @@ -113,6 +122,9 @@ namespace Anabatic { Contact* getGContact ( Net* ); inline const vector& getGContacts () const; bool unrefContact ( Contact* ); + void setXY ( DbU::Unit x, DbU::Unit y ); + void updateContactsPosition (); + // Misc. functions. inline const Flags& flags () const; inline Flags& flags ();