From e5533ad76fab99c140d42eaeab36d69dc9f91262 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Sun, 13 Jun 2010 21:02:20 +0000 Subject: [PATCH] * ./nimbus: - New: Now options are handleds by the standard "Configuration". Especially suppress the need to specify a Library when creating the tool. Now the Configuration directly supplies the CellGauge & RoutingGauge. --- nimbus/src/Configuration.cpp | 27 ++- nimbus/src/Fence.cpp | 25 --- nimbus/src/GCell.cpp | 3 +- nimbus/src/Grid.cpp | 49 +++--- nimbus/src/HFence.cpp | 10 +- nimbus/src/NimbusEngine.cpp | 59 ++++--- nimbus/src/VFence.cpp | 20 +-- nimbus/src/nimbus/Configuration.h | 75 ++++++--- nimbus/src/nimbus/Fence.h | 175 +++++++++++++++++++ nimbus/src/nimbus/GCell.h | 271 ++++++++++++++++++++++++++++++ nimbus/src/nimbus/Grid.h | 4 +- nimbus/src/nimbus/NimbusEngine.h | 37 ++-- 12 files changed, 611 insertions(+), 144 deletions(-) create mode 100644 nimbus/src/nimbus/Fence.h create mode 100644 nimbus/src/nimbus/GCell.h diff --git a/nimbus/src/Configuration.cpp b/nimbus/src/Configuration.cpp index 082b6455..73f2e22e 100644 --- a/nimbus/src/Configuration.cpp +++ b/nimbus/src/Configuration.cpp @@ -28,6 +28,7 @@ #include "hurricane/Cell.h" #include "crlcore/Utilities.h" +#include "crlcore/AllianceFramework.h" #include "nimbus/Configuration.h" @@ -43,6 +44,7 @@ namespace Nimbus { using std::string; using Hurricane::tab; using Hurricane::inltrace; + using CRL::AllianceFramework; // ------------------------------------------------------------------- @@ -55,22 +57,31 @@ namespace Nimbus { Configuration* Configuration::getDefault () { if ( _default == NULL ) { - _default = new Configuration (); + _default = new Configuration ( AllianceFramework::get()->getCellGauge() + , AllianceFramework::get()->getRoutingGauge() + ); } return _default; } - Configuration::Configuration () - : _pinsPlacement(false) + Configuration::Configuration ( CellGauge* cg, RoutingGauge* rg ) + : _cellGauge (NULL) + , _routingGauge (NULL) + , _pinsPlacement(false) , _aspectRatio (1.00) , _margin (0.40) , _workZone () - { } + { + _cellGauge = cg->getClone(); + _routingGauge = rg->getClone(); + } Configuration::Configuration ( const Configuration& other ) - : _pinsPlacement(other._pinsPlacement) + : _cellGauge (other._cellGauge->getClone()) + , _routingGauge (other._routingGauge->getClone()) + , _pinsPlacement(other._pinsPlacement) , _aspectRatio (other._aspectRatio) , _margin (other._margin) , _workZone (other._workZone) @@ -88,8 +99,10 @@ namespace Nimbus { void Configuration::print ( Cell* cell ) const { cout << " o Configuration of ToolEngine for Cell <" << cell->getName() << ">" << endl; - cout << Dots::asBool (" - Pins Placement" ,_pinsPlacement) << endl; - cout << Dots::asPercentage(" - Margin Ratio" ,_margin) << endl; + cout << Dots::asIdentifier(" - Cell Gauge" ,getString(_cellGauge->getName())) << endl; + cout << Dots::asIdentifier(" - Routing Gauge" ,getString(_routingGauge->getName())) << endl; + cout << Dots::asBool (" - Pins Placement",_pinsPlacement) << endl; + cout << Dots::asPercentage(" - Margin Ratio" ,_margin) << endl; } diff --git a/nimbus/src/Fence.cpp b/nimbus/src/Fence.cpp index 3d569bfe..9b79888e 100644 --- a/nimbus/src/Fence.cpp +++ b/nimbus/src/Fence.cpp @@ -111,9 +111,6 @@ class Fence_GCells : public Collection { }; -RoutingGauge* Fence::_routingGauge = NULL; - - /* * ******************************************************************** * Fence implementation @@ -208,28 +205,6 @@ void Fence::destroy() delete this; } -void Fence::computeCapacity() -{ - -#if 0 - unsigned pitch = static_cast(getValue (getCDataBase()->getPitch())); - unsigned nlayers = getGrid()->getNimbus()->getNumberOfRoutingLayers(); - - //Name alu1 ("alu1"); - double capa (0); - for_each_layergauge (routingLayerGauge, _routingGauge) - { - capa += routingLayerGauge->getTrackNumber(fence->getMin(), fence->getMax()); - end_for; - } - - - setCapacity(static_cast(capa/2)); - -#endif - return; -} - void Fence::_moveTo (DbU::Unit target) { for_each_fence (subfence, getSubFences()) diff --git a/nimbus/src/GCell.cpp b/nimbus/src/GCell.cpp index e9b0d3df..4ef347c3 100644 --- a/nimbus/src/GCell.cpp +++ b/nimbus/src/GCell.cpp @@ -9,7 +9,6 @@ #include "hurricane/Cell.h" #include "hurricane/Instance.h" #include "crlcore/CellGauge.h" -#include "crlcore/AllianceFramework.h" #include "nimbus/VFence.h" #include "nimbus/HFence.h" #include "nimbus/GCell.h" @@ -458,7 +457,7 @@ void GCell::recFlushSubRoutingLeaves(GCell* gcell) double GCell::testMargin() //* ********************** { - DbU::Unit sliceHeight = AllianceFramework::get()->getCellGauge()->getSliceHeight(); + DbU::Unit sliceHeight = _nimbus->getConfiguration()->getSliceHeight(); if ( isEmpty() || _box.isPonctual() || _box.isFlat() ) throw Error ( "Very very strange GCell" ); if ( getHeight() % sliceHeight ) diff --git a/nimbus/src/Grid.cpp b/nimbus/src/Grid.cpp index df80c8aa..01b20e46 100644 --- a/nimbus/src/Grid.cpp +++ b/nimbus/src/Grid.cpp @@ -16,7 +16,6 @@ #include "crlcore/ToolBox.h" #include "crlcore/CellGauge.h" #include "crlcore/LefDefExtension.h" -#include "crlcore/AllianceFramework.h" #include "nimbus/GCell.h" #include "nimbus/Fence.h" #include "nimbus/VFence.h" @@ -161,15 +160,14 @@ Grid::Grid (NimbusEngine* nimbus) } else if ( _cell->getAbutmentBox().isEmpty() ) { if ( isNoInstancePlacedOrFixed(_cell) ) { DbU::Unit minWidth = DbU::Max; - DbU::Unit sumWidth = 0; + double sumWidth = 0.0; forEach ( Instance*, iinstance, _cell->getInstances() ) { Cell* model = iinstance->getMasterCell(); DbU::Unit width = model->getAbutmentBox().getWidth(); if ( width < minWidth ) minWidth = width; - sumWidth += width; + sumWidth += DbU::getLambda(width); } - //rectangularShape(_margin, sumWidth, minWidth, nrows); rectangularShape(_nimbus->getMargin(), nimbus->getAspectRatio(), sumWidth, minWidth ); UpdateSession::open(); @@ -229,38 +227,47 @@ void Grid::Clear() } #endif - void Grid::rectangularShape(double margin, double aspectRatio, DbU::Unit sumWidth, DbU::Unit minWidth) - // *************************************************************************************************** + void Grid::rectangularShape(double margin, double aspectRatio, double sumWidth, DbU::Unit minWidth) + // ************************************************************************************************ { cmess1 << " o Creating abutment box: (margin: " << margin << ", aspect ratio:" << aspectRatio << ")" << endl; - CellGauge* cg = AllianceFramework::get()->getCellGauge(); - DbU::Unit rowHeight = cg->getSliceHeight(); - DbU::Unit pitch = cg->getPitch(); - DbU::Unit marginWidth = (DbU::Unit)( (1.0+margin) * (double)sumWidth ); + double dMinWidth = DbU::getLambda(minWidth); + double rowHeight = DbU::getLambda(_nimbus->getSliceHeight()); + DbU::Unit pitch = _nimbus->getPitch(); + double marginWidth = (1.0+margin) * sumWidth; + + // cerr << "sumWidth:" << sumWidth + // << " rowHeight:" << rowHeight + // << " pitch:" << DbU::getValueString(pitch) + // << " minWidth:" << minWidth + // << endl; // AR = x/y S = x*y = marginWidth*SH x=S/y AR = S/y^2 // y = sqrt(S/AR) - DbU::Unit y = (DbU::Unit)sqrt ( ((double)marginWidth*(double)rowHeight) / aspectRatio ); - unsigned int rows = y / rowHeight; + double y = sqrt ( marginWidth*rowHeight ) / aspectRatio; + unsigned int rows = (unsigned int)(y / rowHeight); - if ( (rows == 0) or (rows % rowHeight) ) ++rows; - DbU::Unit rowWidth = marginWidth / rows; + if ( rows == 0 ) ++rows; + double rowWidth = marginWidth / rows; - if ( rowWidth < minWidth ) { - rowWidth = minWidth; - rows = marginWidth / rowWidth; + //cerr << "y:" << y << " rows:" << rows << endl; + + if ( rowWidth < dMinWidth ) { + rowWidth = dMinWidth; + rows = (unsigned int)(marginWidth / rowWidth); if ( rows == 0 ) ++rows; } - DbU::Unit adjustWidth = rowWidth % pitch; + DbU::Unit unitRowWidth = DbU::lambda(rowWidth); + DbU::Unit adjustWidth = unitRowWidth % pitch; if ( adjustWidth != 0 ) - rowWidth += pitch - adjustWidth; + unitRowWidth += pitch - adjustWidth; - Box ab = Box ( 0, 0, rowWidth, rows * rowHeight ); + Box ab = Box ( 0, 0, unitRowWidth, rows * _nimbus->getSliceHeight() ); #if DEPRECATED if ( nrows == 0 ) { @@ -279,7 +286,7 @@ void Grid::Clear() cmess1 << " - Abutment box: " << ab << endl; - _rootGCell = GCell::create(_nimbus, (unsigned) 0, ab); + _rootGCell = GCell::create ( _nimbus, (unsigned)0, ab ); } void Grid::horizontalLongSplit (unsigned step, DbU::Unit& Y) const diff --git a/nimbus/src/HFence.cpp b/nimbus/src/HFence.cpp index 13c378ff..32bdcc14 100644 --- a/nimbus/src/HFence.cpp +++ b/nimbus/src/HFence.cpp @@ -204,7 +204,7 @@ void HFence::_moveTo (DbU::Unit target) void HFence::computeCapacity() { unsigned capa(0); - const vector& gauges = Fence::_routingGauge->getLayerGauges(); + const vector& gauges = getNimbus()->getLayerGauges(); for ( size_t i=0 ; igetType() != Constant::Default) @@ -214,14 +214,6 @@ void HFence::computeCapacity() { capa += gauges[i]->getTrackNumber(getXMin(), getXMax()); } setCapacity(capa); -#if 0 - unsigned pitch = static_cast(getValue (getCDataBase()->getPitch())); - unsigned nlayers = getGrid()->getNimbus()->getNumberOfRoutingLayers(); - - setCapacity(static_cast((nlayers / 2) * getValue (_size) / pitch)); - -#endif - return; } } // namespace Nimbus diff --git a/nimbus/src/NimbusEngine.cpp b/nimbus/src/NimbusEngine.cpp index 23be9f70..29b328de 100644 --- a/nimbus/src/NimbusEngine.cpp +++ b/nimbus/src/NimbusEngine.cpp @@ -44,7 +44,6 @@ #include "crlcore/ToolBox.h" #include "crlcore/CellGauge.h" #include "crlcore/RoutingGauge.h" -#include "crlcore/AllianceFramework.h" #include "nimbus/Grid.h" #include "nimbus/Fence.h" #include "nimbus/GCell.h" @@ -283,10 +282,14 @@ class Nimbus_Layers : public Collection { public: virtual string _getString() const; }; -namespace { -void PreCreate(Cell* cell, const Library* library) +void NimbusEngine::_preCreate(Cell* cell) +// ************************************** { + if ( cell->isTerminal() ) + throw Error("Won't create Nimbus on a standard cell"); + +#if CORIOLIS_2_DEPRECATED if (cell->getLibrary() == library) throw Error("Won't create Nimbus on a standard cell"); string libname (getString(library->getName())); @@ -349,11 +352,11 @@ void PreCreate(Cell* cell, const Library* library) RoutingGauge* routingGauge = AllianceFramework::get()->getRoutingGauge(library->getName()); if (!routingGauge) throw Error ("Nimbus : unable to find RoutingGauge associated with library : " + getString(library->getName())); - Fence::setRoutingGauge(routingGauge); + Fence::setRoutingGauge(Configuration::getDefault()->getCellGauge()); +#endif // CORIOLIS_2_DEPRECATED } -} const Name NimbusEngine::_toolName = "Nimbus"; @@ -369,10 +372,10 @@ NimbusEngine::NimbusEngine (Cell* cell, const Box& workZone) if ( not workZone.isEmpty() ) _configuration->setWorkZone(workZone); } -NimbusEngine* NimbusEngine::create (Cell* cell, const Library* library, const Box& workZone) -// ***************************************************************************************** +NimbusEngine* NimbusEngine::create (Cell* cell, const Box& workZone) +// ***************************************************************** { - PreCreate(cell, library); + _preCreate(cell); NimbusEngine* nimbus = new NimbusEngine (cell,workZone); @@ -420,26 +423,39 @@ const Name& NimbusEngine::staticGetName() } void NimbusEngine::computeXSplit ( GCell* gcell, DbU::Unit* XSplit, unsigned nbSplits ) -// ************************************************************************* +// ************************************************************************************ { - DbU::Unit X = gcell->getXMin(); - DbU::Unit width = gcell->getWidth(); - unsigned numColsInf = (unsigned) rint((DbU::getLambda(width) / DbU::getLambda(AllianceFramework::get()->getCellGauge()->getPitch())) / nbSplits); - if (numColsInf == 0) throw Error ("no more split allowed", 1); - DbU::Unit splitWidth = DbU::lambda(numColsInf * DbU::getLambda(AllianceFramework::get()->getCellGauge()->getPitch())); + DbU::Unit X = gcell->getXMin(); + DbU::Unit width = gcell->getWidth(); + unsigned int numColsInf = (unsigned)rint( width / (getPitch() * nbSplits) ); + + // cerr << "computeXSplit(): width:" << DbU::getValueString(width) + // << " nbsplits:" << nbSplits + // << " " << (width / getPitch()) + // << " numColsInf:" << numColsInf << endl; + + if (numColsInf == 0) + throw Error ("NimbusEngine::computeXSplit(): %s too narrow to be splitted." + ,DbU::getValueString(width).c_str()); + + DbU::Unit splitWidth = numColsInf * getPitch(); for ( unsigned i = 0 ; i < (nbSplits - 1) ; i++ ) { XSplit[i] = X + (i+1) * splitWidth; } } void NimbusEngine::computeYSplit ( GCell* gcell, DbU::Unit* YSplit, unsigned nbSplits ) -// ************************************************************************* +// ************************************************************************************ { - DbU::Unit Y = gcell->getYMin(); - DbU::Unit height = gcell->getHeight(); - unsigned numRowsInf = (unsigned) rint((DbU::getLambda(height) / DbU::getLambda(AllianceFramework::get()->getCellGauge()->getSliceHeight())) / nbSplits); - if (numRowsInf == 0) throw Error ("no more split allowed", 1); - DbU::Unit splitHeight = DbU::lambda(numRowsInf * DbU::getLambda(AllianceFramework::get()->getCellGauge()->getSliceHeight())); + DbU::Unit Y = gcell->getYMin(); + DbU::Unit height = gcell->getHeight(); + unsigned int numRowsInf = (unsigned)rint( height / (getSliceHeight() * nbSplits) ); + + if (numRowsInf == 0) + throw Error ("NimbusEngine::computeYSplit(): %s too narrow to be splitted." + ,DbU::getValueString(height).c_str()); + + DbU::Unit splitHeight = numRowsInf * getSliceHeight(); for ( unsigned i = 0 ; i < (nbSplits - 1) ; i++ ) { YSplit[i] = Y + (i+1) * splitHeight; } @@ -590,7 +606,7 @@ void NimbusEngine::progress(int nbXSplits, int nbYSplits) if ( ! (nbXSplits > 1) ) throw Error ( "NimbusEngine.progress error must divide into at least 2 gcells on X coordinate" ); if ( ! (nbYSplits > 1) ) throw Error ( "NimbusEngine.progress error must divide into at least 2 gcells on Y coordinate" ); - DbU::Unit sliceHeight = AllianceFramework::get()->getCellGauge()->getSliceHeight(); + DbU::Unit sliceHeight = getConfiguration()->getSliceHeight(); for_each_gcell (nb, _grid->getGCells(_depth)) { if (nb->getHeight() == sliceHeight) @@ -660,7 +676,6 @@ void NimbusEngine::destroyLevel(unsigned depth) { recDestroy (depth, getGrid()->getRoot()); if (depth > 0) _depth = depth - 1; - //throw Error ("no more split allowed"); } #if 0 diff --git a/nimbus/src/VFence.cpp b/nimbus/src/VFence.cpp index 66d551b0..545dd00e 100644 --- a/nimbus/src/VFence.cpp +++ b/nimbus/src/VFence.cpp @@ -204,7 +204,7 @@ void VFence::_moveTo (DbU::Unit target) void VFence::computeCapacity() { unsigned capa(0); - const vector& gauges = Fence::_routingGauge->getLayerGauges(); + const vector& gauges = getNimbus()->getLayerGauges(); for ( size_t i=0 ; igetType() != Constant::Default) @@ -214,24 +214,6 @@ void VFence::computeCapacity() { capa += gauges[i]->getTrackNumber(getYMin(), getYMax()); } setCapacity(capa); - -#if 0 - unsigned pitch = static_cast(getValue (getCDataBase()->getPitch())); - unsigned nlayers = getGrid()->getNimbus()->getNumberOfRoutingLayers(); - double capa (0); - double powerrail (0); - for_each_layer (layer, _grid->getNimbus()->getRoutingLayers()) - { - double pitch = getValue(layer->getPitch()); - if (pitch == 0) pitch = 5; - capa += getValue(_size) / pitch / 2; - powerrail += ( (12 * (getValue(_size) / pitch) /50) ); - end_for; - } - - setCapacity(static_cast ((capa - powerrail)/2)); -#endif - return; } } // namespace Nimbus diff --git a/nimbus/src/nimbus/Configuration.h b/nimbus/src/nimbus/Configuration.h index 4979a507..4b37fe9f 100644 --- a/nimbus/src/nimbus/Configuration.h +++ b/nimbus/src/nimbus/Configuration.h @@ -27,19 +27,30 @@ #define __NIMBUS_CONFIGURATION__ #include -#include +#include +#include "hurricane/Box.h" +#include "crlcore/CellGauge.h" +#include "crlcore/RoutingGauge.h" namespace Hurricane { class Record; class Cell; } +namespace CRL { + class RoutingLayerGauge; +} + namespace Nimbus { + using Hurricane::DbU; using Hurricane::Box; using Hurricane::Cell; using Hurricane::Record; + using CRL::CellGauge; + using CRL::RoutingGauge; + using CRL::RoutingLayerGauge; // ------------------------------------------------------------------- @@ -48,40 +59,54 @@ namespace Nimbus { class Configuration { public: - static Configuration* getDefault (); - public: - // Constructor & Destructor. - Configuration (); - ~Configuration (); - Configuration* clone () const; + static Configuration* getDefault (); + public: + // Constructor & Destruct or. + Configuration ( CellGauge*, RoutingGauge* ); + ~Configuration (); + Configuration* clone () const; // Methods. - inline bool doPinsPlacement () const; - inline double getAspectRatio () const; - inline double getMargin () const; - inline const Box& getWorkZone () const; - void print ( Cell* ) const; - inline void setPinsPlacement ( bool ); - inline void setAspectRatio ( double ); - inline void setMargin ( double ); - inline void setWorkZone ( const Box& ); - inline static double _normPercentage ( double ratio, double min=0.0, double max=1.0 ); - Record* _getRecord () const; - std::string _getString () const; - std::string _getTypeName () const; - private: - // Attributes. + inline const CellGauge* getCellGauge () const; + inline const RoutingGauge* getRoutingGauge () const; + inline DbU::Unit getPitch () const; + inline DbU::Unit getSliceHeight () const; + inline DbU::Unit getSliceStep () const; + inline const std::vector& + getLayerGauges () const; + inline bool doPinsPlacement () const; + inline double getAspectRatio () const; + inline double getMargin () const; + inline const Box& getWorkZone () const; + void print ( Cell* ) const; + inline void setPinsPlacement ( bool ); + inline void setAspectRatio ( double ); + inline void setMargin ( double ); + inline void setWorkZone ( const Box& ); + inline static double _normPercentage ( double ratio, double min=0.0, double max=1.0 ); + Record* _getRecord () const; + std::string _getString () const; + std::string _getTypeName () const; + private: + // Attributes. static Configuration* _default; + CellGauge* _cellGauge; + RoutingGauge* _routingGauge; bool _pinsPlacement; double _aspectRatio; double _margin; Box _workZone; - private: - Configuration ( const Configuration& ); - Configuration& operator= ( const Configuration& ); + private: + Configuration ( const Configuration& ); + Configuration& operator= ( const Configuration& ); }; // Inline Methods. + inline DbU::Unit Configuration::getPitch () const { return _cellGauge->getPitch(); } + inline DbU::Unit Configuration::getSliceHeight () const { return _cellGauge->getSliceHeight(); } + inline DbU::Unit Configuration::getSliceStep () const { return _cellGauge->getSliceStep(); } + inline const std::vector& + Configuration::getLayerGauges () const { return _routingGauge->getLayerGauges(); } inline bool Configuration::doPinsPlacement () const { return _pinsPlacement; } inline double Configuration::getAspectRatio () const { return _aspectRatio; } inline double Configuration::getMargin () const { return _margin; } diff --git a/nimbus/src/nimbus/Fence.h b/nimbus/src/nimbus/Fence.h new file mode 100644 index 00000000..de040fb6 --- /dev/null +++ b/nimbus/src/nimbus/Fence.h @@ -0,0 +1,175 @@ +// +// This file is part of the Coriolis Project. +// Copyright (C) Laboratoire LIP6 - Departement ASIM +// Universite Pierre et Marie Curie +// +// Date : 29/01/2004 +// Author : Hugo Clément + + +#ifndef __NIMBUS_FENCE_H__ +#define __NIMBUS_FENCE_H__ + +#include "hurricane/IntrusiveSet.h" +#include "hurricane/ExtensionGo.h" +#include "crlcore/RoutingGauge.h" +#include "nimbus/Fences.h" +#include "nimbus/GCells.h" +#include "nimbus/Splitter.h" +#include "nimbus/Grid.h" + + +namespace Nimbus { + + using namespace CRL; + + class FrontLine; + +typedef set SplitterSet; +typedef set ComponentSet; + +class Fence : public ExtensionGo { + + public: + typedef ExtensionGo Inherit; + + class SubFenceSet : public IntrusiveSet { + public: + typedef IntrusiveSet Inherit; + SubFenceSet(); + virtual unsigned _getHashValue(Fence* fence) const; + virtual Fence* _getNextElement(Fence* fence) const; + virtual void _setNextElement(Fence* fence, Fence* nextFence) const; + }; + + protected: + static const Name _extensionName; + + private: + SplitterSet _splitters; + ComponentSet _components; + + unsigned _occupancy; + unsigned _capacity; + + FrontLine* _frontLine; + + Fence* _nextOfFenceSubFenceSet; + Fence* _nextOfGCellSubFenceSet; + Fence* _nextOfGridFenceSet; + + bool _isARoutingFence; + + bool _visible; + + protected: + unsigned _step; + DbU::Unit _size; + Grid* _grid; + SubFenceSet _subFences; + + Fence (Grid* grid, DbU::Unit size = 0, unsigned capacity = 0, unsigned occupancy = 0, bool visible = false); + ~Fence(); + + public: + void destroy(); + virtual void _preDestroy(); + virtual void _postCreate(); + + static const Name& staticGetName () { return _extensionName; }; + virtual const Name& getName () const { return _extensionName; }; + + void setStep(unsigned step) { _step = step; }; + unsigned getStep() { return _step; }; + unsigned getCapacity() { return _capacity; }; + unsigned getOccupancy() { return _occupancy; }; + DbU::Unit getSize() { return _size; }; + DbU::Unit getLength() { return _size; }; + DbU::Unit getDistance() const; + Grid* getGrid() { return _grid; }; + NimbusEngine* getNimbus () { return _grid->getNimbus(); } + Cell* getCell() const; + + virtual GCell* getGCell1() const { return NULL; }; + virtual GCell* getGCell2() const { return NULL; }; + virtual GCell* getRightGCell() const { return NULL; }; + virtual GCell* getLeftGCell() const { return NULL; }; + virtual GCell* getUpGCell() const { return NULL; }; + virtual GCell* getDownGCell() const { return NULL; }; + + Fence* getParentFence() const; + FrontLine* getFrontLine(); + void setFrontLine(FrontLine* frontLine); + + GCell* getOppositeGCell (GCell* gcell) const; + + GCells getGCells() const; + Fences getSubFences() const { return _subFences.getElements(); }; + void addSubFence (Fence* fence); + void removeSubFence (Fence* fence); + + Fence* _getNextOfFenceSubFenceSet() const {return _nextOfFenceSubFenceSet;}; + void _setNextOfFenceSubFenceSet(Fence* fence) {_nextOfFenceSubFenceSet = fence;}; + + Fence* _getNextOfGCellSubFenceSet() const {return _nextOfGCellSubFenceSet;}; + void _setNextOfGCellSubFenceSet(Fence* fence) {_nextOfGCellSubFenceSet = fence;}; + + Fence* _getNextOfGridFenceSet() const {return _nextOfGridFenceSet;}; + void _setNextOfGridFenceSet(Fence* fence) {_nextOfGridFenceSet = fence;}; + + void setAsRoutingFence(); + bool isARoutingFence() const { return _isARoutingFence; }; + void _NotRoutingFence() { _isARoutingFence = false; }; + + void setSize (DbU::Unit& size) { _size = size; }; + void setCapacity (unsigned capacity) { _capacity = capacity; }; + void setOccupancy (unsigned occupancy) { _occupancy = occupancy; }; + virtual void computeCapacity () = 0; + + void attachSplitter (Splitter* splitter); + void detachSplitter (Splitter* splitter); + void attachComponent (Component* component); + void detachComponent (Component* component); + Splitter* getOffendingSplitter() { return NULL; }; + Splitter* getNetSplitter(Net* net) const; + Splitters getSplitters() const; + + bool isOverloaded() { return _occupancy > _capacity; }; + + virtual DbU::Unit getX() const { return 0; }; + virtual DbU::Unit getY() const { return 0; }; + virtual DbU::Unit getXMin() const { return getX(); }; + virtual DbU::Unit getXMax() const { return getX(); }; + virtual DbU::Unit getYMin() const { return getY(); }; + virtual DbU::Unit getYMax() const { return getY(); }; + virtual Point getP1() const { return Point (getX(), getY()); }; + virtual Point getP2() const { return Point (getX(), getY()); }; + virtual DbU::Unit getXCenter() const { return 0;}; + virtual DbU::Unit getYCenter() const { return 0;}; + virtual Point getCenter() const { return Point (getXCenter(), getYCenter());}; + virtual Box getBoundingBox() const; + + virtual bool isHorizontal() = 0; + virtual bool isVertical() = 0; + + virtual void _moveTo (DbU::Unit target); + virtual void translate(const DbU::Unit& dx, const DbU::Unit& dy) {}; + + bool isVisible() const { return _visible; }; + void setVisible() { _visible = true; }; + void setInvisible() { _visible = false; }; + void ToggleVisibility() { _visible = not _visible; }; + + + virtual Record* _getRecord() const; + virtual string _getString() const; + virtual string _getTypeName() const {return _TName("Fence");}; +}; + +} + + +INSPECTOR_P_SUPPORT(Nimbus::Fence); + + +#endif diff --git a/nimbus/src/nimbus/GCell.h b/nimbus/src/nimbus/GCell.h new file mode 100644 index 00000000..69482c29 --- /dev/null +++ b/nimbus/src/nimbus/GCell.h @@ -0,0 +1,271 @@ +// +// This file is part of the Coriolis Project. +// Copyright (C) Laboratoire LIP6 - Departement ASIM +// Universite Pierre et Marie Curie +// +// +// Date : 29/01/2004 +// Author : Hugo Clément +// +// Authors-Tag + + +#ifndef __NIMBUS_GCELL_H__ +#define __NIMBUS_GCELL_H__ + +#include "nimbus/GCells.h" +#include "nimbus/Fence.h" + +namespace Nimbus { + + class VFence; + class HFence; + class NimbusEngine; + + +struct _gcellmapcmp +{ + bool operator()(const DbU::Unit u1, const DbU::Unit u2) const + { + return u1 < u2; + } +}; + +typedef map RBMap; +typedef map RBPavement; +typedef pair RBPair; +typedef list RBList; + + +class GCell : public DBo { + + public: + typedef DBo Inherit; + + class GCellSet : public IntrusiveSet { + public: + typedef IntrusiveSet Inherit; + GCellSet(); + virtual unsigned _getHashValue(GCell* gcell) const; + virtual GCell* _getNextElement(GCell* gcell) const; + virtual void _setNextElement(GCell* gcell, GCell* nextGCell) const; + }; + + class SubFenceSet : public IntrusiveSet { + public: + typedef IntrusiveSet Inherit; + SubFenceSet(); + virtual unsigned _getHashValue(Fence* fence) const; + virtual Fence* _getNextElement(Fence* fence) const; + virtual void _setNextElement(Fence* fence, Fence* nextFence) const; + }; + + + private: + NimbusEngine* _nimbus; + Box _box; + unsigned _step; + Interval _Xinterval; + Interval _Yinterval; + GCell* _container; + GCell* _nextOfGCellGCellSet; + GCellSet _subGCells; + SubFenceSet _subFences; + RBPavement _pavement; + + //SubFenceSet _surroundingFences; + HFence* _upfence; + HFence* _downfence; + VFence* _leftfence; + VFence* _rightfence; + + bool _isAPlacementLeaf; + bool _isARoutingLeaf; + + //map> _componentNetMap; + // getComponents(Net* net); // setComponent(Net* net, Component* component) + + public: + + /*! + * \fn GCell::GCell ( unsigned step, const Box& box, GCell* container = NULL ) + * \param nimbus proxy to nimbus + * \param step the hierarchy level of the routbox + * \param box hurricane box of this routbox + * \param container the parent container of the box + * creates a new routbox at level step, dimensions and position specified by box, + * under container (no consistency check) + */ + private: + GCell (NimbusEngine* nimbus, unsigned step, const Box& box, GCell* container = NULL); + public: + static GCell* create(NimbusEngine* nimbus, unsigned step, const Box& box, GCell* container = NULL); + + protected: virtual void _preDestroy(); + + public: + Cell* getCell () const; + /* Box methods */ + DbU::Unit getXMin() const { return _box.getXMin(); }; + DbU::Unit getYMin() const { return _box.getYMin(); }; + DbU::Unit getXMax() const { return _box.getXMax(); }; + DbU::Unit getYMax() const { return _box.getYMax(); }; + + DbU::Unit getXCenter() const { return _box.getXCenter(); }; + DbU::Unit getYCenter() const { return _box.getYCenter(); }; + Point getCenter() const { return _box.getCenter(); }; + + DbU::Unit getWidth() const { return _box.getWidth(); }; + DbU::Unit getHalfWidth() const {return _box.getHalfWidth();}; + DbU::Unit getHeight() const { return _box.getHeight(); }; + DbU::Unit getHalfHeight() const {return _box.getHalfHeight();}; + + Box getUnion(const Box& box) const { return _box.getUnion(box); }; + + Box getIntersection(const Box& box) const { return _box.getIntersection(box); }; + DbU::Unit manhattanDistance(const Point& pt) const { return _box.manhattanDistance(pt); }; + DbU::Unit manhattanDistance(const Box& box) const { return _box.manhattanDistance(box); }; + + bool isEmpty() const { return _box.isEmpty(); }; + bool isFlat() const { return _box.isFlat(); }; + bool isPonctual() const { return _box.isPonctual(); }; + + bool contains(const DbU::Unit& x, const DbU::Unit& y) const { return _box.contains(x,y); }; + bool contains(const Point& point) const { return _box.contains(point); }; + bool contains(const Box& box) const { return _box.contains(box); }; + + bool intersect(const Box& box) const { return _box.intersect(box); }; + + bool isConstrainedBy(const Box& box) const { return _box.isConstrainedBy(box); }; + + const Box& getBox() const { return _box; }; + + unsigned getStep() const { return _step; }; + unsigned getDepth() const { return _step; }; + GCell* getContainer() const { return _container; }; + bool isASubGCellOf(GCell* gcell) const; + bool isAStrictSubGCellOf(GCell* gcell) const; + void makeSub (); + /*! + * \fn bool GCell::hasSubGCells () + * The name is quite straightforward, isn't it ? + */ + + GCell* _getNextOfGCellGCellSet() const {return _nextOfGCellGCellSet;}; + void _setNextOfGCellGCellSet(GCell* gcell) {_nextOfGCellGCellSet = gcell;}; + + bool hasSubGCells () const; + bool horizontalIsCrossed (DbU::Unit& Y) const; + bool verticalIsCrossed (DbU::Unit& X) const; + bool strictContains(const Point& point) const; + bool strictContains(const DbU::Unit& x, const DbU::Unit& y) const; + + void subHSplit (DbU::Unit& Y); + void subVSplit (DbU::Unit& X); + RBPair hSplitMe (DbU::Unit& coord); + RBPair vSplitMe (DbU::Unit& coord); + + GCells getSubGCells () const { return _subGCells.getElements(); }; + Fences getSurroundingFences () const;// { return _surroundingFences.getElements(); }; + Fences getSubFences() const { return _subFences.getElements(); }; + Fences getInnerFences() const { return _subFences.getElements(); }; + Fence* getOppositeFence(const Fence* fence) const; + //void addSurroundingFence (Fence* fence) { _surroundingFences._Insert(fence); }; + void addSubGCell (GCell* gcell); + void removeSubGCell (GCell* gcell); + void addInnerFence (Fence* fence); + + GCell* getPlacementLeaf(); + bool isAPlacementLeaf() const { return _isAPlacementLeaf; }; + void setAsPlacementLeaf(); + void _setNotPlacementLeaf() { _isAPlacementLeaf = false; }; + void setSubGCellsAsPlacementLeaves(); + void recFlushSubPlacementLeaves(GCell* gcell); + GCell* getRoutingLeaf(); + bool isARoutingLeaf() const { return _isARoutingLeaf; }; + void setAsRoutingLeaf(); + void _setNotRoutingLeaf() { _isARoutingLeaf = false; }; + void setSubGCellsAsRoutingLeaves(); + void recFlushSubRoutingLeaves(GCell* gcell); + + double testMargin(); + + // Resizing + public: + void setXMin (DbU::Unit x); + void setYMin (DbU::Unit y); + void setXMax (DbU::Unit x); + void setYMax (DbU::Unit y); + + // Pavement + private: + void addToPavement (GCell* gcell); + void removeFromPavement (GCell* gcell); + public: + void dumpPavement () const; + + /*! + * \fn GCell* GCell::getRightOf () + * \fn GCell* GCell::getLeftOf () + * \fn GCell* GCell::getDownOf () + * \fn GCell* GCell::getUpOf () + * \fn GCell* GCell::getUpperRight () + * \fn GCell* GCell::getUpperLeft () + * \fn GCell* GCell::getBottomRight () + * \fn GCell* GCell::getBottomLeft () + * Navigate through the subroutboxes + */ + public: + void setUpFence (HFence* hfence) { _upfence = hfence; }; + void setDownFence (HFence* hfence) { _downfence = hfence; }; + void setLeftFence (VFence* vfence) { _leftfence = vfence; }; + void setRightFence (VFence* vfence) { _rightfence = vfence; }; + + HFence* getUpFence() const { return _upfence; }; + HFence* getDownFence() const { return _downfence; }; + VFence* getLeftFence() const { return _leftfence; }; + VFence* getRightFence() const { return _rightfence; }; + + GCell* getRightOfMe () const; + GCell* getLeftOfMe () const; + GCell* getDownOfMe () const; + GCell* getUpOfMe () const; + + GCell* computeRightOfMe () const; + GCell* computeLeftOfMe () const; + GCell* computeDownOfMe () const; + GCell* computeUpOfMe () const; + + GCell* getSubRightOf (GCell* gcell) const; + GCell* getSubLeftOf (GCell* gcell) const; + GCell* getSubDownOf (GCell* gcell) const; + GCell* getSubUpOf (GCell* gcell) const; + + GCell* _computeSubRightOf (const GCell* gcell) const; + GCell* _computeSubLeftOf (const GCell* gcell) const; + GCell* _computeSubDownOf (const GCell* gcell) const; + GCell* _computeSubUpOf (const GCell* gcell) const; + + GCell* getSubUpperRight () const; + GCell* getSubUpperLeft () const; + GCell* getSubLowerRight () const { return getSubBottomRight(); }; + GCell* getSubBottomRight () const; + GCell* getSubLowerLeft () const { return getSubBottomLeft(); }; + GCell* getSubBottomLeft () const; + + GCell* _recGetRightOfMe () const; + GCell* _recGetLeftOfMe () const; + GCell* _recGetDownOfMe () const; + GCell* _recGetUpOfMe () const; + + virtual string _getTypeName() const {return _TName("Nimbus::GCell");} + virtual string _getString() const; + virtual Record* _getRecord() const; +}; // class GCell +} // namespace Nimbus + + +INSPECTOR_P_SUPPORT(Nimbus::GCell); + + +#endif diff --git a/nimbus/src/nimbus/Grid.h b/nimbus/src/nimbus/Grid.h index 7245fb20..9a2c1f84 100644 --- a/nimbus/src/nimbus/Grid.h +++ b/nimbus/src/nimbus/Grid.h @@ -51,12 +51,12 @@ class Grid { public: Cell* getCell() const { return _cell; }; public: NimbusEngine* getNimbus() const { return _nimbus; }; /*! - * \fn void Grid::rectangularShape ( double margin, double aspectRatio, DbU::Unit sumWidth, DbU::Unit minWidth ) + * \fn void Grid::rectangularShape ( double margin, double aspectRatio, double sumWidth, DbU::Unit minWidth ) * \param margin Additionnal free space in the abutment box * \param aspectRatio * \param sumWidth */ - public: void rectangularShape(double margin, double aspectRatio, DbU::Unit sumWidth, DbU::Unit minWidth); + public: void rectangularShape(double margin, double aspectRatio, double sumWidth, DbU::Unit minWidth); /*! * \fn void Grid::horizontalLongSplit (unsigned step, DbU::Unit& Y) diff --git a/nimbus/src/nimbus/NimbusEngine.h b/nimbus/src/nimbus/NimbusEngine.h index ca649110..1b722416 100644 --- a/nimbus/src/nimbus/NimbusEngine.h +++ b/nimbus/src/nimbus/NimbusEngine.h @@ -59,18 +59,25 @@ class NimbusEngine : public ToolEngine { // ************ private: NimbusEngine (Cell* cell, const Box& workzone); - public: static NimbusEngine* create (Cell* cell, const Library* library, const Box& workZone=Box()); + public: static void _preCreate(Cell*); + public: static NimbusEngine* create (Cell* cell, const Box& workZone=Box()); // Accessors // ********* public: - virtual const Name& getName () const; - static const Name& staticGetName (); - static NimbusEngine* get ( Cell* ); - inline bool doPinsPlacement () const; - inline double getAspectRatio () const; - inline double getMargin () const; - inline const Box& getWorkZone () const; + virtual const Name& getName () const; + static const Name& staticGetName (); + static NimbusEngine* get ( Cell* ); + inline Configuration* getConfiguration (); + inline bool doPinsPlacement () const; + inline double getAspectRatio () const; + inline double getMargin () const; + inline const Box& getWorkZone () const; + inline DbU::Unit getPitch () const; + inline DbU::Unit getSliceHeight () const; + inline DbU::Unit getSliceStep () const; + inline const std::vector& + getLayerGauges () const; public: Grid* getGrid() { return _grid; }; public: unsigned getDepth() { return _depth; }; @@ -157,10 +164,16 @@ class NimbusEngine : public ToolEngine { }; - inline bool NimbusEngine::doPinsPlacement () const { return _configuration->doPinsPlacement(); } - inline double NimbusEngine::getAspectRatio () const { return _configuration->getAspectRatio(); } - inline double NimbusEngine::getMargin () const { return _configuration->getMargin(); } - inline const Box& NimbusEngine::getWorkZone () const { return _configuration->getWorkZone(); } + inline Configuration* NimbusEngine::getConfiguration () { return _configuration; } + inline bool NimbusEngine::doPinsPlacement () const { return _configuration->doPinsPlacement(); } + inline double NimbusEngine::getAspectRatio () const { return _configuration->getAspectRatio(); } + inline double NimbusEngine::getMargin () const { return _configuration->getMargin(); } + inline const Box& NimbusEngine::getWorkZone () const { return _configuration->getWorkZone(); } + inline DbU::Unit NimbusEngine::getPitch () const { return _configuration->getPitch(); } + inline DbU::Unit NimbusEngine::getSliceHeight () const { return _configuration->getSliceHeight(); } + inline DbU::Unit NimbusEngine::getSliceStep () const { return _configuration->getSliceStep(); } + inline const std::vector& + NimbusEngine::getLayerGauges () const { return _configuration->getLayerGauges(); } } // namespace Nimbus