* ./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...
This commit is contained in:
Jean-Paul Chaput 2013-07-26 11:01:32 +00:00
parent bc23a539a5
commit 039e58e30a
4 changed files with 171 additions and 110 deletions

View File

@ -1,27 +1,30 @@
// -*- C++ -*- // -*- C++ -*-
// //
// This file is part of the Coriolis Software. // 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
// //
// =================================================================== // +-----------------------------------------------------------------+
// // | C O R I O L I S |
// $Id$ // | Alliance / Hurricane Interface |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Module : "./ToolEngine.cpp" |
// +-----------------------------------------------------------------+
#include "hurricane/Commons.h" #include "hurricane/Commons.h"
#include "hurricane/Error.h" #include "hurricane/Error.h"
#include "hurricane/Cell.h" #include "hurricane/Cell.h"
#include "hurricane/Relation.h" #include "hurricane/Relation.h"
#include "crlcore/Utilities.h"
#include "crlcore/Utilities.h" #include "crlcore/ToolEngine.h"
#include "crlcore/ToolEngine.h"
namespace { namespace {
using std::cout; using std::cout;
using std::cerr; using std::cerr;
using std::endl; using std::endl;
@ -38,7 +41,7 @@ namespace {
using CRL::ToolEngine; using CRL::ToolEngine;
const Name ToolEnginesRelationName = "ToolEnginesRelationName"; const Name ToolEnginesRelationName = "ToolEnginesRelationName";
// ------------------------------------------------------------------- // -------------------------------------------------------------------
@ -162,14 +165,14 @@ namespace {
set<ToolEnginesRelation*>::iterator irelation = _toolEnginesRelations.begin(); set<ToolEnginesRelation*>::iterator irelation = _toolEnginesRelations.begin();
for ( ; irelation != _toolEnginesRelations.end() ; ++irelation ) { for ( ; irelation != _toolEnginesRelations.end() ; ++irelation ) {
vector<ToolEngine*> tools; vector<ToolEngine*> tools;
forEach ( ToolEngine*, itool, (*irelation)->getSlaveOwners().getSubSet<ToolEngine*>() ) forEach ( ToolEngine*, itool, (*irelation)->getSlaveOwners().getSubSet<ToolEngine*>() ) {
tools.push_back ( *itool ); tools.push_back( *itool );
for ( size_t i=0 ; i<tools.size() ; ++i ) {
tools[i]->destroy ();
} }
for ( size_t i=0 ; i<tools.size() ; ++i )
tools[i]->destroy();
} }
_toolEnginesRelations.clear (); _toolEnginesRelations.clear();
} }
@ -185,6 +188,9 @@ namespace CRL {
// Class : "CRL::ToolEngine". // Class : "CRL::ToolEngine".
bool ToolEngine::_inDestroyAll = false;
ToolEngine::ToolEngine ( Cell* cell ) ToolEngine::ToolEngine ( Cell* cell )
: DBo() : DBo()
, _cell (cell) , _cell (cell)
@ -225,22 +231,26 @@ namespace CRL {
} }
bool ToolEngine::inDestroyAll ()
{ return _inDestroyAll; }
void ToolEngine::destroyAll () void ToolEngine::destroyAll ()
{ {
ToolEnginesRelation::destroyAllToolEnginesRelations (); _inDestroyAll = true;
ToolEnginesRelation::destroyAllToolEnginesRelations();
_inDestroyAll = false;
} }
string ToolEngine::_getTypeName () const string ToolEngine::_getTypeName () const
{ { return _TName ( "ToolEngine" ); }
return _TName ( "ToolEngine" );
}
string ToolEngine::_getString () const string ToolEngine::_getString () const
{ {
string s = DBo::_getString(); string s = DBo::_getString();
s.insert(s.length() - 1, " " + getString(getName())); s.insert(s.length() - 1, " " + getString(_cell->getName()));
return s; return s;
} }

View File

@ -1,6 +1,18 @@
// author : Damien Dupuis
// date : 08.12.2009
// -*- C++ -*- // -*- 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 <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
@ -28,84 +40,106 @@ using namespace Hurricane;
#include "Agds.h" #include "Agds.h"
namespace { namespace {
class AgdsQuery : public Query {
class AgdsQuery : public Query {
public: public:
AgdsQuery ( Cell* ); AgdsQuery ( Cell* );
inline void setStructure ( AGDS::Structure* );
inline void setStructure(AGDS::Structure*); virtual bool hasGoCallback () const;
virtual void goCallback ( Go* );
virtual bool hasGoCallback() const; virtual void extensionGoCallback ( Go* );
virtual void goCallback ( Go* ); virtual void masterCellCallback ();
// not used but needed for compilation :
virtual void extensionGoCallback(Go*) {};
virtual void masterCellCallback() {};
private: private:
Cell* _cell; Cell* _cell;
AGDS::Structure* _str; 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; Box b;
const BasicLayer* layer;
if (dynamic_cast<const Pad*>(go)) { if (dynamic_cast<const Pad*>(go)) {
const Pad* pad = static_cast<const Pad*>(go); const Pad* pad = static_cast<const Pad*>(go);
b = pad->getBoundingBox(); b = pad->getBoundingBox();
layer = dynamic_cast<const BasicLayer*>(pad->getLayer());
} }
else if (dynamic_cast<const Contact*>(go)) { else if (dynamic_cast<const Contact*>(go)) {
const Contact* contact = static_cast<const Contact*>(go); const Contact* contact = static_cast<const Contact*>(go);
b = contact->getBoundingBox(); b = contact->getBoundingBox();
layer = dynamic_cast<const BasicLayer*>(contact->getLayer());
} }
else if (dynamic_cast<const Segment*>(go)) { else if (dynamic_cast<const Segment*>(go)) {
const Segment* segment = static_cast<const Segment*>(go); const Segment* segment = static_cast<const Segment*>(go);
b = segment->getBoundingBox(); b = segment->getBoundingBox();
layer = dynamic_cast<const BasicLayer*>(segment->getLayer());
} }
else { else
return; return;
}
AGDS::Rectangle* rect = new AGDS::Rectangle ( layer->getExtractNumber() getTransformation().applyOn( b );
, DbU::getPhysical(b.getXMin(), DbU::Nano) AGDS::Rectangle* rect = new AGDS::Rectangle ( getBasicLayer()->getExtractNumber()
, DbU::getPhysical(b.getYMin(), DbU::Nano) , DbU::getPhysical(b.getXMin(), DbU::Nano)
, DbU::getPhysical(b.getXMax(), DbU::Nano) , DbU::getPhysical(b.getYMin(), DbU::Nano)
, DbU::getPhysical(b.getYMax(), DbU::Nano)); , DbU::getPhysical(b.getXMax(), DbU::Nano)
_str->addElement(rect); , DbU::getPhysical(b.getYMax(), DbU::Nano));
} _str->addElement( rect );
} // namespace }
} // Anonymous namespace.
namespace CRL { 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()); name = getString(cell->getName());
replace(name.begin(), name.end(), ' ', '_'); replace(name.begin(), name.end(), ' ', '_');
lib = getString(cell->getLibrary()->getName()); lib = getString(cell->getLibrary()->getName());
replace(lib.begin(), lib.end(), ' ', '_'); replace(lib.begin(), lib.end(), ' ', '_');
uUnits = 0.001; uUnits = 0.001;
pUnits = 1.0E-9; 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)); AGDS::Library* gdsLib = new AGDS::Library ( lib );
agdsQuery.setStructure(str); 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() ) { forEach ( BasicLayer*, basicLayer, DataBase::getDB()->getTechnology()->getBasicLayers() ) {
agdsQuery.setBasicLayer(*basicLayer); agdsQuery.setBasicLayer( *basicLayer );
agdsQuery.doQuery(); agdsQuery.doQuery();
} }
gdsLib->addStructure(str); gdsLib->addStructure( str );
gdsLib->writeToFile(filePath); gdsLib->writeToFile ( filePath );
} }
} // namespace CRL
} // CRL namespace.

View File

@ -1,42 +1,57 @@
// author : Damien Dupuis
// date : 08.12.2009
// -*- C++ -*- // -*- 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 <string> #include <string>
namespace Hurricane { namespace Hurricane {
class Cell; class Cell;
} }
namespace CRL { namespace CRL {
class GdsDriver {
class GdsDriver {
public: public:
GdsDriver(Hurricane::Cell*); GdsDriver ( Hurricane::Cell* );
bool save ( const std::string& filePath );
bool save(const std::string& filePath); inline std::string getName ();
inline std::string getName(); inline std::string getLib ();
inline std::string getLib(); inline double getUUnits ();
inline double getUUnits(); inline double getPUnits ();
inline double getPUnits();
private: private:
Hurricane::Cell* _cell; Hurricane::Cell* _cell;
std::string _name; std::string _name;
std::string _lib; std::string _lib;
double _uUnits; double _uUnits;
double _pUnits; 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.
# 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

View File

@ -2,7 +2,7 @@
// -*- C++ -*- // -*- C++ -*-
// //
// This file is part of the Coriolis Software. // 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 | // | C O R I O L I S |
@ -37,7 +37,6 @@ namespace Hurricane {
namespace CRL { namespace CRL {
using std::string; using std::string;
using std::vector; using std::vector;
using Hurricane::Record; using Hurricane::Record;
@ -56,6 +55,7 @@ namespace CRL {
static ToolEngines get ( const Cell* cell ); static ToolEngines get ( const Cell* cell );
static ToolEngine* get ( const Cell* cell, const Name& name ); static ToolEngine* get ( const Cell* cell, const Name& name );
static void destroyAll (); static void destroyAll ();
static bool inDestroyAll ();
// Methods. // Methods.
virtual const Name& getName () const = 0; virtual const Name& getName () const = 0;
inline Cell* getCell () const; inline Cell* getCell () const;
@ -66,6 +66,8 @@ namespace CRL {
virtual string _getString () const; virtual string _getString () const;
virtual Record* _getRecord () const; virtual Record* _getRecord () const;
private:
static bool _inDestroyAll;
protected: protected:
// Internal: Attributes // Internal: Attributes
Cell* _cell; Cell* _cell;