From 039e58e30a1a53bd464d12e484142701e7cf7190 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Fri, 26 Jul 2013 11:01:32 +0000 Subject: [PATCH] * ./crlcore/src/ccore/agds: - Bug: In AgdsQuery::goCallBack(), take account the instance transformation. This problem was not showing until now because there wasn't any instances... --- crlcore/src/ccore/ToolEngine.cpp | 60 +++++----- crlcore/src/ccore/agds/AgdsDriver.cpp | 146 +++++++++++++++---------- crlcore/src/ccore/crlcore/GdsDriver.h | 69 +++++++----- crlcore/src/ccore/crlcore/ToolEngine.h | 6 +- 4 files changed, 171 insertions(+), 110 deletions(-) diff --git a/crlcore/src/ccore/ToolEngine.cpp b/crlcore/src/ccore/ToolEngine.cpp index a0f73d19..6b592157 100644 --- a/crlcore/src/ccore/ToolEngine.cpp +++ b/crlcore/src/ccore/ToolEngine.cpp @@ -1,27 +1,30 @@ - // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// Copyright (c) UPMC 2008-2013, All Rights Reserved // -// =================================================================== -// -// $Id$ +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | Alliance / Hurricane Interface | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./ToolEngine.cpp" | +// +-----------------------------------------------------------------+ -#include "hurricane/Commons.h" -#include "hurricane/Error.h" -#include "hurricane/Cell.h" -#include "hurricane/Relation.h" - -#include "crlcore/Utilities.h" -#include "crlcore/ToolEngine.h" +#include "hurricane/Commons.h" +#include "hurricane/Error.h" +#include "hurricane/Cell.h" +#include "hurricane/Relation.h" +#include "crlcore/Utilities.h" +#include "crlcore/ToolEngine.h" namespace { - using std::cout; using std::cerr; using std::endl; @@ -38,7 +41,7 @@ namespace { using CRL::ToolEngine; - const Name ToolEnginesRelationName = "ToolEnginesRelationName"; + const Name ToolEnginesRelationName = "ToolEnginesRelationName"; // ------------------------------------------------------------------- @@ -162,14 +165,14 @@ namespace { set::iterator irelation = _toolEnginesRelations.begin(); for ( ; irelation != _toolEnginesRelations.end() ; ++irelation ) { vector tools; - forEach ( ToolEngine*, itool, (*irelation)->getSlaveOwners().getSubSet() ) - tools.push_back ( *itool ); - - for ( size_t i=0 ; idestroy (); + forEach ( ToolEngine*, itool, (*irelation)->getSlaveOwners().getSubSet() ) { + tools.push_back( *itool ); } + + for ( size_t i=0 ; idestroy(); } - _toolEnginesRelations.clear (); + _toolEnginesRelations.clear(); } @@ -185,6 +188,9 @@ namespace CRL { // Class : "CRL::ToolEngine". + bool ToolEngine::_inDestroyAll = false; + + ToolEngine::ToolEngine ( Cell* cell ) : DBo() , _cell (cell) @@ -225,22 +231,26 @@ namespace CRL { } + bool ToolEngine::inDestroyAll () + { return _inDestroyAll; } + + void ToolEngine::destroyAll () { - ToolEnginesRelation::destroyAllToolEnginesRelations (); + _inDestroyAll = true; + ToolEnginesRelation::destroyAllToolEnginesRelations(); + _inDestroyAll = false; } string ToolEngine::_getTypeName () const - { - return _TName ( "ToolEngine" ); - } + { return _TName ( "ToolEngine" ); } string ToolEngine::_getString () const { string s = DBo::_getString(); - s.insert(s.length() - 1, " " + getString(getName())); + s.insert(s.length() - 1, " " + getString(_cell->getName())); return s; } diff --git a/crlcore/src/ccore/agds/AgdsDriver.cpp b/crlcore/src/ccore/agds/AgdsDriver.cpp index 0bed2f21..34a410c5 100644 --- a/crlcore/src/ccore/agds/AgdsDriver.cpp +++ b/crlcore/src/ccore/agds/AgdsDriver.cpp @@ -1,6 +1,18 @@ -// author : Damien Dupuis -// date : 08.12.2009 // -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC 2009-2013, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | C R L C o r e - ASCII/GDS Driver | +// | | +// | Author : Damien DUPUIS | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Module : "./agds/AgdsDriver.cpp" | +// +-----------------------------------------------------------------+ + #include #include @@ -28,84 +40,106 @@ using namespace Hurricane; #include "Agds.h" + namespace { -class AgdsQuery : public Query { + + + class AgdsQuery : public Query { public: - AgdsQuery ( Cell* ); - - inline void setStructure(AGDS::Structure*); - - virtual bool hasGoCallback() const; - virtual void goCallback ( Go* ); - // not used but needed for compilation : - virtual void extensionGoCallback(Go*) {}; - virtual void masterCellCallback() {}; - + AgdsQuery ( Cell* ); + inline void setStructure ( AGDS::Structure* ); + virtual bool hasGoCallback () const; + virtual void goCallback ( Go* ); + virtual void extensionGoCallback ( Go* ); + virtual void masterCellCallback (); private: - Cell* _cell; - AGDS::Structure* _str; -}; + Cell* _cell; + AGDS::Structure* _str; + }; -AgdsQuery::AgdsQuery(Cell* cell) : Query(), _cell(cell), _str(NULL) { - Query::setQuery(_cell, _cell->getBoundingBox(), Transformation(), NULL, 0, Query::DoComponents); -} -inline void AgdsQuery::setStructure(AGDS::Structure* str) { _str = str; } + AgdsQuery::AgdsQuery ( Cell* cell ) + : Query() + , _cell(cell) + , _str (NULL) + { + Query::setQuery( _cell, _cell->getBoundingBox(), Transformation(), NULL, 0, Query::DoComponents ); + } -bool AgdsQuery::hasGoCallback() const { return true; } -void AgdsQuery::goCallback(Go* go) { + inline void AgdsQuery::setStructure ( AGDS::Structure* str ) { _str = str; } + void AgdsQuery::extensionGoCallback ( Go* ) {} + void AgdsQuery::masterCellCallback () {} + bool AgdsQuery::hasGoCallback () const { return true; } + + + void AgdsQuery::goCallback ( Go* go ) + { Box b; - const BasicLayer* layer; if (dynamic_cast(go)) { - const Pad* pad = static_cast(go); - b = pad->getBoundingBox(); - layer = dynamic_cast(pad->getLayer()); + const Pad* pad = static_cast(go); + b = pad->getBoundingBox(); } else if (dynamic_cast(go)) { - const Contact* contact = static_cast(go); - b = contact->getBoundingBox(); - layer = dynamic_cast(contact->getLayer()); + const Contact* contact = static_cast(go); + b = contact->getBoundingBox(); } else if (dynamic_cast(go)) { - const Segment* segment = static_cast(go); - b = segment->getBoundingBox(); - layer = dynamic_cast(segment->getLayer()); + const Segment* segment = static_cast(go); + b = segment->getBoundingBox(); } - else { - return; - } - AGDS::Rectangle* rect = new AGDS::Rectangle ( layer->getExtractNumber() - , DbU::getPhysical(b.getXMin(), DbU::Nano) - , DbU::getPhysical(b.getYMin(), DbU::Nano) - , DbU::getPhysical(b.getXMax(), DbU::Nano) - , DbU::getPhysical(b.getYMax(), DbU::Nano)); - _str->addElement(rect); -} -} // namespace + else + return; + + getTransformation().applyOn( b ); + AGDS::Rectangle* rect = new AGDS::Rectangle ( getBasicLayer()->getExtractNumber() + , DbU::getPhysical(b.getXMin(), DbU::Nano) + , DbU::getPhysical(b.getYMin(), DbU::Nano) + , DbU::getPhysical(b.getXMax(), DbU::Nano) + , DbU::getPhysical(b.getYMax(), DbU::Nano)); + _str->addElement( rect ); + } + + +} // Anonymous namespace. + namespace CRL { -void agdsDriver(const string filePath, Cell* cell, string& name, string& lib, double& uUnits, double& pUnits) { + + + void agdsDriver ( const string filePath + , Cell* cell + , string& name + , string& lib + , double& uUnits + , double& pUnits + ) + { name = getString(cell->getName()); replace(name.begin(), name.end(), ' ', '_'); + lib = getString(cell->getLibrary()->getName()); replace(lib.begin(), lib.end(), ' ', '_'); + uUnits = 0.001; pUnits = 1.0E-9; - AGDS::Library* gdsLib = new AGDS::Library(lib); - gdsLib->setUserUnits(uUnits); - gdsLib->setPhysUnits(pUnits); - AgdsQuery agdsQuery (cell); - AGDS::Structure* str = new AGDS::Structure(getString(name)); - agdsQuery.setStructure(str); + AGDS::Library* gdsLib = new AGDS::Library ( lib ); + gdsLib->setUserUnits( uUnits ); + gdsLib->setPhysUnits( pUnits ); + AgdsQuery agdsQuery ( cell ); + + AGDS::Structure* str = new AGDS::Structure ( getString(name) ); + agdsQuery.setStructure( str ); forEach ( BasicLayer*, basicLayer, DataBase::getDB()->getTechnology()->getBasicLayers() ) { - agdsQuery.setBasicLayer(*basicLayer); - agdsQuery.doQuery(); + agdsQuery.setBasicLayer( *basicLayer ); + agdsQuery.doQuery(); } - gdsLib->addStructure(str); - gdsLib->writeToFile(filePath); -} -} // namespace CRL + gdsLib->addStructure( str ); + gdsLib->writeToFile ( filePath ); + } + + +} // CRL namespace. diff --git a/crlcore/src/ccore/crlcore/GdsDriver.h b/crlcore/src/ccore/crlcore/GdsDriver.h index ecb90728..a2a6e91a 100644 --- a/crlcore/src/ccore/crlcore/GdsDriver.h +++ b/crlcore/src/ccore/crlcore/GdsDriver.h @@ -1,42 +1,57 @@ -// author : Damien Dupuis -// date : 08.12.2009 // -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC 2009-2013, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | C R L C o r e - ASCII/GDS Driver | +// | | +// | Author : Damien DUPUIS | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Header : "./crlcore/GdsDriver.h" | +// +-----------------------------------------------------------------+ -#ifndef __GDS_DRIVER_H__ -#define __GDS_DRIVER_H__ + +#ifndef CRLCORE_GDS_DRIVER_H +#define CRLCORE_GDS_DRIVER_H #include namespace Hurricane { - class Cell; + class Cell; } + namespace CRL { -class GdsDriver { + + + class GdsDriver { public: - GdsDriver(Hurricane::Cell*); - - bool save(const std::string& filePath); - inline std::string getName(); - inline std::string getLib(); - inline double getUUnits(); - inline double getPUnits(); - + GdsDriver ( Hurricane::Cell* ); + bool save ( const std::string& filePath ); + inline std::string getName (); + inline std::string getLib (); + inline double getUUnits (); + inline double getPUnits (); private: - Hurricane::Cell* _cell; - std::string _name; - std::string _lib; - double _uUnits; - double _pUnits; -}; - -inline std::string GdsDriver::getName() { return _name; }; -inline std::string GdsDriver::getLib() { return _lib; }; -inline double GdsDriver::getUUnits() { return _uUnits; }; -inline double GdsDriver::getPUnits() { return _pUnits; }; -} // End of CRL namespace. + Hurricane::Cell* _cell; + std::string _name; + std::string _lib; + double _uUnits; + double _pUnits; + }; -# endif + inline std::string GdsDriver::getName() { return _name; }; + inline std::string GdsDriver::getLib() { return _lib; }; + inline double GdsDriver::getUUnits() { return _uUnits; }; + inline double GdsDriver::getPUnits() { return _pUnits; }; + + +} // CRL namespace. + +#endif // CRLCORE_GDS_DRIVER_H diff --git a/crlcore/src/ccore/crlcore/ToolEngine.h b/crlcore/src/ccore/crlcore/ToolEngine.h index a779cbfd..7f1e5152 100644 --- a/crlcore/src/ccore/crlcore/ToolEngine.h +++ b/crlcore/src/ccore/crlcore/ToolEngine.h @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2012, All Rights Reserved +// Copyright (c) UPMC 2008-2012, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -37,7 +37,6 @@ namespace Hurricane { namespace CRL { - using std::string; using std::vector; using Hurricane::Record; @@ -56,6 +55,7 @@ namespace CRL { static ToolEngines get ( const Cell* cell ); static ToolEngine* get ( const Cell* cell, const Name& name ); static void destroyAll (); + static bool inDestroyAll (); // Methods. virtual const Name& getName () const = 0; inline Cell* getCell () const; @@ -66,6 +66,8 @@ namespace CRL { virtual string _getString () const; virtual Record* _getRecord () const; + private: + static bool _inDestroyAll; protected: // Internal: Attributes Cell* _cell;