* ./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++ -*-
//
// 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<ToolEnginesRelation*>::iterator irelation = _toolEnginesRelations.begin();
for ( ; irelation != _toolEnginesRelations.end() ; ++irelation ) {
vector<ToolEngine*> tools;
forEach ( ToolEngine*, itool, (*irelation)->getSlaveOwners().getSubSet<ToolEngine*>() )
tools.push_back ( *itool );
for ( size_t i=0 ; i<tools.size() ; ++i ) {
tools[i]->destroy ();
forEach ( ToolEngine*, itool, (*irelation)->getSlaveOwners().getSubSet<ToolEngine*>() ) {
tools.push_back( *itool );
}
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".
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;
}

View File

@ -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 <iostream>
#include <iomanip>
@ -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<const Pad*>(go)) {
const Pad* pad = static_cast<const Pad*>(go);
b = pad->getBoundingBox();
layer = dynamic_cast<const BasicLayer*>(pad->getLayer());
const Pad* pad = static_cast<const Pad*>(go);
b = pad->getBoundingBox();
}
else if (dynamic_cast<const Contact*>(go)) {
const Contact* contact = static_cast<const Contact*>(go);
b = contact->getBoundingBox();
layer = dynamic_cast<const BasicLayer*>(contact->getLayer());
const Contact* contact = static_cast<const Contact*>(go);
b = contact->getBoundingBox();
}
else if (dynamic_cast<const Segment*>(go)) {
const Segment* segment = static_cast<const Segment*>(go);
b = segment->getBoundingBox();
layer = dynamic_cast<const BasicLayer*>(segment->getLayer());
const Segment* segment = static_cast<const Segment*>(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.

View File

@ -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 <string>
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

View File

@ -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;