separated oaTech opening and creation from design driving ... for mixed mode debug ...
This commit is contained in:
parent
1a33586cf9
commit
37d8084a6a
|
@ -10,8 +10,8 @@ using namespace Hurricane;
|
||||||
namespace CRL {
|
namespace CRL {
|
||||||
OADriver::OADriver(Cell* cell) : _cell(cell) {}
|
OADriver::OADriver(Cell* cell) : _cell(cell) {}
|
||||||
|
|
||||||
void OADriver::save(const std::string& filePath) {
|
void OADriver::save(const std::string& technoFilePath,const std::string& designFilePath) {
|
||||||
CRL::OpenAccess::oaDriver(filePath, _cell);
|
CRL::OpenAccess::oaDriver(technoFilePath,designFilePath, _cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
OAParser::OAParser(const std::string& cellLibPath,const std::string& cellLibName,
|
OAParser::OAParser(const std::string& cellLibPath,const std::string& cellLibName,
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace CRL {
|
||||||
Hurricane::Cell* _cell;
|
Hurricane::Cell* _cell;
|
||||||
public:
|
public:
|
||||||
OADriver(Hurricane::Cell*);
|
OADriver(Hurricane::Cell*);
|
||||||
void save(const std::string& path);
|
void save(const std::string& technoFilePath,const std::string& designFilePath);
|
||||||
};
|
};
|
||||||
} // End of CRL namespace.
|
} // End of CRL namespace.
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
// -*-compile-command:"cd ../../../../.. && make"-*-
|
||||||
|
|
||||||
|
#ifndef __MYASSERT_H__
|
||||||
|
#define __MYASSERT_H__
|
||||||
|
|
||||||
|
#include "hurricane/Error.h"
|
||||||
|
|
||||||
|
#undef assert
|
||||||
|
#define assert(cond) if (! (cond) ) throw Error("assertion failed : " + string( #cond ) )
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,5 +1,5 @@
|
||||||
// -*-compile-command:"cd ../../../../.. && make"-*-
|
// -*-compile-command:"cd ../../../../.. && make"-*-
|
||||||
// Time-stamp: "2010-08-12 19:28:37" - OpenAccess.h
|
// Time-stamp: "2010-09-17 17:00:35" - OpenAccess.h
|
||||||
// x-----------------------------------------------------------------x
|
// x-----------------------------------------------------------------x
|
||||||
// | This file is part of the hurricaneAMS Software. |
|
// | This file is part of the hurricaneAMS Software. |
|
||||||
// | Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved |
|
// | Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved |
|
||||||
|
@ -24,7 +24,7 @@ namespace Hurricane {
|
||||||
namespace CRL {
|
namespace CRL {
|
||||||
class OpenAccess {
|
class OpenAccess {
|
||||||
public:
|
public:
|
||||||
static void oaDriver(const std::string& libPath, Hurricane::Cell* cell);
|
static void oaDriver(const std::string& technoPath, const std::string& designPath, Hurricane::Cell* cell);
|
||||||
static Hurricane::Cell* oaCellParser(const std::string& cellLibPath, const std::string& cellLibName, const std::string& cellName,
|
static Hurricane::Cell* oaCellParser(const std::string& cellLibPath, const std::string& cellLibName, const std::string& cellName,
|
||||||
const std::string& techLibPath, const std::string& techLibName);
|
const std::string& techLibPath, const std::string& techLibName);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// -*-compile-command:"cd ../../../../.. && make"-*-
|
// -*-compile-command:"cd ../../../../.. && make"-*-
|
||||||
// Time-stamp: "2010-08-24 13:07:42" - OpenAccessCommon.h
|
// Time-stamp: "2010-09-18 13:38:28" - OpenAccessCommon.h
|
||||||
// x-----------------------------------------------------------------x
|
// x-----------------------------------------------------------------x
|
||||||
// | This file is part of the hurricaneAMS Software. |
|
// | This file is part of the hurricaneAMS Software. |
|
||||||
// | Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved |
|
// | Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved |
|
||||||
|
@ -14,12 +14,12 @@
|
||||||
#define __OPENACCESSCOMMON_H__
|
#define __OPENACCESSCOMMON_H__
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
#include <boost/filesystem/operations.hpp>
|
|
||||||
namespace bfs = boost::filesystem;
|
|
||||||
|
|
||||||
#ifdef HAVE_OPENACCESS
|
#ifdef HAVE_OPENACCESS
|
||||||
|
|
||||||
|
#include "PathsUtils.h"
|
||||||
|
|
||||||
#include "hurricane/Cell.h"
|
#include "hurricane/Cell.h"
|
||||||
#include "hurricane/BasicLayer.h"
|
#include "hurricane/BasicLayer.h"
|
||||||
using namespace Hurricane;
|
using namespace Hurricane;
|
||||||
|
@ -27,8 +27,8 @@ using namespace Hurricane;
|
||||||
#include "oa/oaDesignDB.h"
|
#include "oa/oaDesignDB.h"
|
||||||
using namespace oa;
|
using namespace oa;
|
||||||
|
|
||||||
#undef assert
|
#include "MyAssert.h"
|
||||||
#define assert(cond) if (! (cond) ) throw Error("assertion failed : " + string( #cond ) )
|
|
||||||
//#define assert(cond)
|
//#define assert(cond)
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -137,32 +137,6 @@ namespace CRL_OA {
|
||||||
cerr << endl;
|
cerr << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
@todo complete,verify ...
|
|
||||||
*/
|
|
||||||
static BasicLayer::Material::Code getBasicLayerTypeFromOAMaterial(const oaMaterial& material) {
|
|
||||||
switch(material) {
|
|
||||||
case oacNWellMaterial:
|
|
||||||
return BasicLayer::Material::nWell;
|
|
||||||
case oacPWellMaterial:
|
|
||||||
return BasicLayer::Material::pWell;
|
|
||||||
case oacNImplantMaterial:
|
|
||||||
return BasicLayer::Material::nImplant;
|
|
||||||
case oacPImplantMaterial:
|
|
||||||
return BasicLayer::Material::pImplant;
|
|
||||||
case oacPolyMaterial:
|
|
||||||
return BasicLayer::Material::poly;
|
|
||||||
case oacCutMaterial:
|
|
||||||
return BasicLayer::Material::cut;
|
|
||||||
case oacMetalMaterial:
|
|
||||||
case oacContactlessMetalMaterial:
|
|
||||||
return BasicLayer::Material::metal;
|
|
||||||
default:
|
|
||||||
return BasicLayer::Material::other;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
save and close design(s) stored in a map
|
save and close design(s) stored in a map
|
||||||
*/
|
*/
|
||||||
|
@ -191,13 +165,26 @@ namespace CRL_OA {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
handling realpath
|
utility function to open a technology in OA format
|
||||||
*/
|
*/
|
||||||
static void realPath(string& pathToChange){
|
static pair<oaTech*,bool> openOATech(oaLib* techOAlib){
|
||||||
if(bfs::path::default_name_check_writable())
|
assert(techOAlib);
|
||||||
bfs::path::default_name_check(bfs::portable_posix_name);
|
bool created = false;
|
||||||
bfs::path resolvedPath = pathToChange;
|
cerr << "oaTech::find" << endl;
|
||||||
pathToChange = system_complete(resolvedPath).string();
|
oaTech* theOATech = oaTech::find(techOAlib);
|
||||||
|
if(!theOATech){
|
||||||
|
if (oaTech::exists(techOAlib)){
|
||||||
|
cerr << "oaTech::open" << endl;
|
||||||
|
theOATech = oaTech::open(techOAlib,'a');
|
||||||
|
}
|
||||||
|
if(!theOATech){
|
||||||
|
cerr << "oaTech::create" << endl;
|
||||||
|
theOATech = oaTech::create(techOAlib);
|
||||||
|
created = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assert(techOAlib);
|
||||||
|
return make_pair<oaTech*,bool>(theOATech,created);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -213,53 +200,7 @@ namespace CRL_OA {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
suppose the path has been resolved with system_complete
|
open oaLib with the info gathered by libInfos function
|
||||||
before calling this function and path are posix_name
|
|
||||||
then split the path in boos::filesystem::path corresponding of each dir
|
|
||||||
from most root parent to leaf dir
|
|
||||||
@see create_all_dirs
|
|
||||||
*/
|
|
||||||
static std::vector<bfs::path> split_in_dirs(const bfs::path& p){
|
|
||||||
string pstr(p.string());
|
|
||||||
register size_t len(pstr.length());
|
|
||||||
register char delim('/');
|
|
||||||
register size_t firstDelim=0;
|
|
||||||
register size_t secondDelim=1;
|
|
||||||
vector<bfs::path> dirs;
|
|
||||||
while(firstDelim < len){
|
|
||||||
while(secondDelim < len && pstr[secondDelim]!=delim)
|
|
||||||
secondDelim++;
|
|
||||||
string dir = pstr.substr(0,secondDelim);
|
|
||||||
if(dir.empty())
|
|
||||||
break;
|
|
||||||
dirs.push_back(bfs::path(dir));
|
|
||||||
firstDelim = secondDelim;
|
|
||||||
secondDelim++;
|
|
||||||
}
|
|
||||||
return dirs;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
work around for boost::filesystem::create_directories
|
|
||||||
missing in old boost versions like 1.33.1
|
|
||||||
and equivalent to recursivly creating directories
|
|
||||||
instead this is done iteratively.
|
|
||||||
*/
|
|
||||||
static void create_all_dirs(const bfs::path& p){
|
|
||||||
if(p.empty() || bfs::exists(p))
|
|
||||||
return;
|
|
||||||
std::vector<bfs::path> test;
|
|
||||||
test = split_in_dirs(p);
|
|
||||||
std::vector<bfs::path>::iterator it = test.begin();
|
|
||||||
for(;it != test.end();it++){
|
|
||||||
if(it->empty() || bfs::exists(*it))
|
|
||||||
continue;
|
|
||||||
bfs::create_directory(*it);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
open oaLib with the info gathered by libPath function
|
|
||||||
*/
|
*/
|
||||||
static oaLib* openOALib(const pair<oaScalarName,string>& infos){
|
static oaLib* openOALib(const pair<oaScalarName,string>& infos){
|
||||||
oaLib *lib = NULL;
|
oaLib *lib = NULL;
|
||||||
|
@ -288,10 +229,11 @@ namespace CRL_OA {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
create cds.lib file in the path containong OA libs so Cadence (c) software could
|
create cds.lib file in the path containing OA libs
|
||||||
open them
|
so Cadence (c) software can open them
|
||||||
*/
|
*/
|
||||||
static void createCDS(const pair<oaScalarName,string>& infos,const string& path){
|
static void createCDS(const pair<oaScalarName,string>& infos,
|
||||||
|
const string& path){
|
||||||
try{
|
try{
|
||||||
cerr << "Overwriting cds.lib file begin " << endl;
|
cerr << "Overwriting cds.lib file begin " << endl;
|
||||||
string cdsPath = path + "/cds.lib";
|
string cdsPath = path + "/cds.lib";
|
||||||
|
@ -409,7 +351,7 @@ namespace CRL_OA {
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
};//struct oaCommon
|
};//struct oaFuncs
|
||||||
}//end CRL_OA namespace
|
}//end CRL_OA namespace
|
||||||
|
|
||||||
#endif//HAVE_OPENACCESS
|
#endif//HAVE_OPENACCESS
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// -*-compile-command:"cd ../../../../.. && make"-*-
|
// -*-compile-command:"cd ../../../../.. && make"-*-
|
||||||
// Time-stamp: "2010-08-26 17:35:32" - OpenAccessDriver.cpp
|
// Time-stamp: "2010-09-18 13:45:34" - OpenAccessDriver.cpp
|
||||||
// x-----------------------------------------------------------------x
|
// x-----------------------------------------------------------------x
|
||||||
// | This file is part of the hurricaneAMS Software. |
|
// | This file is part of the hurricaneAMS Software. |
|
||||||
// | Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved |
|
// | Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved |
|
||||||
|
@ -15,6 +15,7 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <memory>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#include "hurricane/DataBase.h"
|
#include "hurricane/DataBase.h"
|
||||||
|
@ -43,6 +44,8 @@ using namespace Hurricane;
|
||||||
#include "OpenAccess.h"
|
#include "OpenAccess.h"
|
||||||
#include "OpenAccessCommon.h"
|
#include "OpenAccessCommon.h"
|
||||||
|
|
||||||
|
#define VERBOSE
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
#ifdef HAVE_OPENACCESS
|
#ifdef HAVE_OPENACCESS
|
||||||
using namespace CRL_OA;
|
using namespace CRL_OA;
|
||||||
|
@ -60,7 +63,8 @@ namespace {
|
||||||
typedef map<const Component*, oaRect*> Component2OARectMap;
|
typedef map<const Component*, oaRect*> Component2OARectMap;
|
||||||
typedef map<const Segment*, oaPathSeg*> Segment2OAPathSegMap;
|
typedef map<const Segment*, oaPathSeg*> Segment2OAPathSegMap;
|
||||||
|
|
||||||
string _path;
|
string _technoPath;
|
||||||
|
string _designPath;
|
||||||
oaTech* _oaTech;
|
oaTech* _oaTech;
|
||||||
Library2OALibMap _library2OALib;
|
Library2OALibMap _library2OALib;
|
||||||
Cell2OADesignMap _cell2OADesign4Netlist;
|
Cell2OADesignMap _cell2OADesign4Netlist;
|
||||||
|
@ -80,9 +84,10 @@ namespace {
|
||||||
oaLayer* _layerWire;
|
oaLayer* _layerWire;
|
||||||
DataBase* _db;
|
DataBase* _db;
|
||||||
Technology* _technology;
|
Technology* _technology;
|
||||||
public:
|
protected:
|
||||||
OADriver(const string& path) :
|
OADriver(const string& technoPath, const string& designPath) :
|
||||||
_path(path),
|
_technoPath(technoPath),
|
||||||
|
_designPath(designPath),
|
||||||
_oaTech(NULL),
|
_oaTech(NULL),
|
||||||
_library2OALib(),
|
_library2OALib(),
|
||||||
_cell2OADesign4Netlist(),
|
_cell2OADesign4Netlist(),
|
||||||
|
@ -102,20 +107,41 @@ namespace {
|
||||||
_layerWire(NULL),
|
_layerWire(NULL),
|
||||||
_db(NULL),
|
_db(NULL),
|
||||||
_technology(NULL) {
|
_technology(NULL) {
|
||||||
|
cerr << "OADriver" << endl;
|
||||||
_db = DataBase::getDB();
|
_db = DataBase::getDB();
|
||||||
if (!_db) {
|
if (!_db)
|
||||||
throw Error("no database");
|
throw Error("no database");
|
||||||
}
|
|
||||||
_technology = _db->getTechnology();
|
_technology = _db->getTechnology();
|
||||||
if (!_technology) {
|
if (!_technology)
|
||||||
throw Error("no technology");
|
throw Error("no technology");
|
||||||
|
realPath(_technoPath);
|
||||||
|
realPath(_designPath);
|
||||||
|
cerr << "techno realpath: " << _technoPath << endl;
|
||||||
|
cerr << "design realpath: " << _designPath << endl;
|
||||||
}
|
}
|
||||||
oaFuncs::realPath(_path);
|
|
||||||
cerr << "realpath: " << _path << endl;
|
public:
|
||||||
|
static OADriver* create(const string& technoPath, const string& designPath) {
|
||||||
|
OADriver* oaDriver = new OADriver(technoPath,designPath);
|
||||||
|
|
||||||
|
// load previously converted or existing tech in OA format
|
||||||
|
|
||||||
|
|
||||||
|
oaDriver->getOATech();
|
||||||
|
|
||||||
|
return oaDriver;
|
||||||
|
}
|
||||||
|
|
||||||
|
oaTech* getOATech() {
|
||||||
|
assert(_oaTech);
|
||||||
|
return _oaTech;
|
||||||
}
|
}
|
||||||
|
|
||||||
~OADriver() {
|
~OADriver() {
|
||||||
|
cerr << "~OADriver" << endl;
|
||||||
|
#ifdef VERBOSE
|
||||||
cerr << "SAVING ALL" << endl;
|
cerr << "SAVING ALL" << endl;
|
||||||
|
#endif
|
||||||
_oaTech->save();
|
_oaTech->save();
|
||||||
_oaTech->close();
|
_oaTech->close();
|
||||||
oaFuncs::saveOADesignsInMap(_cell2OADesign4Netlist);
|
oaFuncs::saveOADesignsInMap(_cell2OADesign4Netlist);
|
||||||
|
@ -132,42 +158,55 @@ namespace {
|
||||||
oaLib* lib = it->second;
|
oaLib* lib = it->second;
|
||||||
lib->close();
|
lib->close();
|
||||||
}
|
}
|
||||||
_path.clear();
|
_technoPath.clear();
|
||||||
|
_designPath.clear();
|
||||||
|
#ifdef VERBOSE
|
||||||
cerr << "ALL SAVED" << endl;
|
cerr << "ALL SAVED" << endl;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
oaTech* loadOATech(const string& path) {
|
||||||
|
oaLib* lib = NULL;
|
||||||
|
oaTech* tech = NULL;
|
||||||
|
|
||||||
|
return tech;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
create a oaLib from a Library
|
create a oaLib from a Library
|
||||||
*/
|
*/
|
||||||
oaLib* toOALib(const Library* library, bool recursive=false) {
|
oaLib* toOALib(const Library* library, const string& path,bool recursive=false) {
|
||||||
cerr << "toOALib" << endl;
|
|
||||||
assert(library);
|
assert(library);
|
||||||
Library2OALibMap::iterator it = _library2OALib.find(library);
|
Library2OALibMap::iterator it = _library2OALib.find(library);
|
||||||
if (it != _library2OALib.end())
|
if (it != _library2OALib.end())
|
||||||
return it->second;
|
return it->second;
|
||||||
|
cerr << "toOALib" << endl;
|
||||||
|
|
||||||
// 1) create or open library
|
// 1) create or open library
|
||||||
cerr << "lib path : " << _path << endl;
|
#ifdef VERBOSE
|
||||||
pair<oaScalarName,string> infos = oaFuncs::libInfos(_path,
|
cerr << "lib path : " << path << endl;
|
||||||
|
#endif
|
||||||
|
pair<oaScalarName,string> infos = oaFuncs::libInfos(path,
|
||||||
getString(library->getName()));
|
getString(library->getName()));
|
||||||
oaLib *lib = oaFuncs::openOALib(infos);
|
oaLib *lib = oaFuncs::openOALib(infos);
|
||||||
_library2OALib[library] = lib;
|
_library2OALib[library] = lib;
|
||||||
|
|
||||||
if(recursive){
|
if(recursive){
|
||||||
// 2) for each cell convert them too : if it's a standard cell library for example
|
// 2) for each cell convert them too : if it's a standard cell library for example
|
||||||
|
if(_oaTech){
|
||||||
for_each_cell(c ,library->getCells()){
|
for_each_cell(c ,library->getCells()){
|
||||||
toOACell(c);
|
toOACell(_oaTech, c);
|
||||||
end_for;
|
end_for;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// 3) also convert each contained library if any
|
// 3) also convert each contained library if any
|
||||||
for_each_library(l ,library->getLibraries()){
|
for_each_library(l ,library->getLibraries()){
|
||||||
toOALib(l);
|
toOALib(l,path,recursive);
|
||||||
end_for;
|
end_for;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 4) create, update library list file
|
// 4) create, update library list file
|
||||||
oaFuncs::createCDS(infos,_path);
|
oaFuncs::createCDS(infos,path);
|
||||||
infos.second.clear();
|
infos.second.clear();
|
||||||
|
|
||||||
return lib;
|
return lib;
|
||||||
|
@ -179,23 +218,32 @@ namespace {
|
||||||
*/
|
*/
|
||||||
int generateLayerID(const BasicLayer* bLayer){
|
int generateLayerID(const BasicLayer* bLayer){
|
||||||
// the layer number is unique to a particular layer
|
// the layer number is unique to a particular layer
|
||||||
cerr << "generateLayerID -> ";
|
cerr << "generateLayerID";
|
||||||
|
#ifdef VERBOSE
|
||||||
|
cerr << " -> ";
|
||||||
|
#endif
|
||||||
int numLayer = _layerID;
|
int numLayer = _layerID;
|
||||||
if(bLayer){
|
if(bLayer){
|
||||||
numLayer = bLayer->getExtractNumber();
|
numLayer = bLayer->getExtractNumber();
|
||||||
if(_layerIDS.find(numLayer) == _layerIDS.end()){
|
if(_layerIDS.find(numLayer) == _layerIDS.end()){
|
||||||
|
#ifdef VERBOSE
|
||||||
cerr << "getExtractNumber " << numLayer << endl;
|
cerr << "getExtractNumber " << numLayer << endl;
|
||||||
|
#endif
|
||||||
_layerIDS.insert(numLayer);
|
_layerIDS.insert(numLayer);
|
||||||
return numLayer;
|
return numLayer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cerr << " while(...) ";
|
#ifdef VERBOSE
|
||||||
|
cerr << "while(...) ";
|
||||||
|
#endif
|
||||||
set<int>::iterator it;
|
set<int>::iterator it;
|
||||||
while((it = _layerIDS.find(_layerID)) != _layerIDS.end()){
|
while((it = _layerIDS.find(_layerID)) != _layerIDS.end()){
|
||||||
numLayer = ++_layerID;
|
numLayer = ++_layerID;
|
||||||
}
|
}
|
||||||
|
#ifdef VERBOSE
|
||||||
cerr << numLayer << endl;
|
cerr << numLayer << endl;
|
||||||
|
#endif
|
||||||
_layerIDS.insert(numLayer);
|
_layerIDS.insert(numLayer);
|
||||||
return numLayer;
|
return numLayer;
|
||||||
}
|
}
|
||||||
|
@ -359,38 +407,30 @@ namespace {
|
||||||
@todo complete with technology info for layers
|
@todo complete with technology info for layers
|
||||||
@see toOALib
|
@see toOALib
|
||||||
*/
|
*/
|
||||||
oaTech* toOATech(const Technology* technology,const Library* lib) {
|
oaTech* toOATech(const Technology* technology,
|
||||||
|
const Library* lib,
|
||||||
|
const string& technoPath) {
|
||||||
cerr << "createOATechForTechnology" << endl;
|
cerr << "createOATechForTechnology" << endl;
|
||||||
assert(technology);
|
assert(technology);
|
||||||
|
|
||||||
// 1) get or create Library for the techno
|
// 1) get or create Library for the techno
|
||||||
assert(lib);
|
assert(lib);
|
||||||
oaLib* techOAlib = toOALib(lib);
|
oaLib* techOAlib = toOALib(lib,technoPath);
|
||||||
assert(techOAlib);
|
assert(techOAlib);
|
||||||
|
|
||||||
// 2) get or create oaTech container
|
// 2) get or create oaTech container
|
||||||
bool created = false;
|
pair<oaTech*,bool> techPair = oaFuncs::openOATech(techOAlib);
|
||||||
cerr << "oaTech::find" << endl;
|
oaTech* theOATech = techPair.first;
|
||||||
oaTech* theOATech = oaTech::find(techOAlib);
|
bool created = techPair.second;
|
||||||
if(!theOATech){
|
|
||||||
if (oaTech::exists(techOAlib)){
|
assert(theOATech);
|
||||||
cerr << "oaTech::open" << endl;
|
|
||||||
theOATech = oaTech::open(techOAlib,'a');
|
|
||||||
}
|
|
||||||
if(!theOATech){
|
|
||||||
cerr << "oaTech::create" << endl;
|
|
||||||
theOATech = oaTech::create(techOAlib);
|
|
||||||
created = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
assert(techOAlib);
|
|
||||||
if(created){
|
if(created){
|
||||||
theOATech->setDefaultManufacturingGrid(10);
|
theOATech->setDefaultManufacturingGrid(10);
|
||||||
theOATech->setDBUPerUU(oaViewType::get(oacMaskLayout), 2000);
|
theOATech->setDBUPerUU(oaViewType::get(oacMaskLayout), 2000);
|
||||||
|
//create and add foundry constraint group
|
||||||
//create and add foundry constraint group for General manufacturing rules
|
//for General manufacturing rules
|
||||||
//and add oaSimpleConstraintType too
|
//and add oaSimpleConstraintType too
|
||||||
assert(theOATech);
|
|
||||||
//add the constraint group for oa2lef
|
//add the constraint group for oa2lef
|
||||||
theOATech->getDefaultConstraintGroup();
|
theOATech->getDefaultConstraintGroup();
|
||||||
oaConstraintGroup *cgFoundry = theOATech->getFoundryRules();
|
oaConstraintGroup *cgFoundry = theOATech->getFoundryRules();
|
||||||
|
@ -496,7 +536,7 @@ namespace {
|
||||||
// 1) get the master cell for the instance
|
// 1) get the master cell for the instance
|
||||||
Cell* masterCell = instance->getMasterCell();
|
Cell* masterCell = instance->getMasterCell();
|
||||||
assert(masterCell);
|
assert(masterCell);
|
||||||
oaDesign* masterDesign = toOADesign(masterCell);
|
oaDesign* masterDesign = toOADesign(_oaTech,masterCell);
|
||||||
assert(masterDesign);
|
assert(masterDesign);
|
||||||
|
|
||||||
oaNativeNS ns;
|
oaNativeNS ns;
|
||||||
|
@ -555,6 +595,7 @@ namespace {
|
||||||
return oaName(scN);
|
return oaName(scN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
convert to OAPoint
|
convert to OAPoint
|
||||||
*/
|
*/
|
||||||
|
@ -820,7 +861,7 @@ namespace {
|
||||||
|
|
||||||
// 1) get the lib containing the cell
|
// 1) get the lib containing the cell
|
||||||
oaNativeNS ns;
|
oaNativeNS ns;
|
||||||
oaLib* lib = toOALib(cell->getLibrary());
|
oaLib* lib = toOALib(cell->getLibrary(),_designPath);
|
||||||
assert(lib);
|
assert(lib);
|
||||||
|
|
||||||
// 2) create a netlist CellView of the cell
|
// 2) create a netlist CellView of the cell
|
||||||
|
@ -857,7 +898,7 @@ namespace {
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
oaNativeNS ns;
|
oaNativeNS ns;
|
||||||
oaLib* lib = toOALib(cell->getLibrary());
|
oaLib* lib = toOALib(cell->getLibrary(),_designPath);
|
||||||
assert(lib);
|
assert(lib);
|
||||||
oaScalarName scNameDesign(ns, getString(cell->getName()).c_str());
|
oaScalarName scNameDesign(ns, getString(cell->getName()).c_str());
|
||||||
oaScalarName scNameView(ns, "symbolic");
|
oaScalarName scNameView(ns, "symbolic");
|
||||||
|
@ -895,7 +936,7 @@ namespace {
|
||||||
return it->second;
|
return it->second;
|
||||||
|
|
||||||
oaNativeNS ns;
|
oaNativeNS ns;
|
||||||
oaLib* lib = toOALib(cell->getLibrary());
|
oaLib* lib = toOALib(cell->getLibrary(),_designPath);
|
||||||
assert(lib);
|
assert(lib);
|
||||||
oaScalarName scNameDesign(ns, getString(cell->getName()).c_str());
|
oaScalarName scNameDesign(ns, getString(cell->getName()).c_str());
|
||||||
oaScalarName scNameView(ns, "schematic");
|
oaScalarName scNameView(ns, "schematic");
|
||||||
|
@ -933,7 +974,7 @@ namespace {
|
||||||
}
|
}
|
||||||
|
|
||||||
oaNativeNS ns;
|
oaNativeNS ns;
|
||||||
oaLib* lib = toOALib(cell->getLibrary());
|
oaLib* lib = toOALib(cell->getLibrary(), _designPath);
|
||||||
assert(lib);
|
assert(lib);
|
||||||
oaScalarName scNameDesign(ns, getString(cell->getName()).c_str());
|
oaScalarName scNameDesign(ns, getString(cell->getName()).c_str());
|
||||||
oaScalarName scNameView(ns, "layout");
|
oaScalarName scNameView(ns, "layout");
|
||||||
|
@ -989,6 +1030,7 @@ namespace {
|
||||||
topBlock->getBBox(boundingBox);
|
topBlock->getBBox(boundingBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//tests
|
||||||
oaUInt4 count = 0;
|
oaUInt4 count = 0;
|
||||||
oaIter<oaLPPHeader> headers(designCellView->getTopBlock()->getLPPHeaders());
|
oaIter<oaLPPHeader> headers(designCellView->getTopBlock()->getLPPHeaders());
|
||||||
while (oaLPPHeader* lppHeader = headers.getNext()) {
|
while (oaLPPHeader* lppHeader = headers.getNext()) {
|
||||||
|
@ -1006,13 +1048,16 @@ namespace {
|
||||||
/**
|
/**
|
||||||
Convert a Cell to OA designs ...
|
Convert a Cell to OA designs ...
|
||||||
*/
|
*/
|
||||||
oaDesign* toOADesign(const Cell* cell) {
|
oaDesign* toOADesign(oaTech* tech,const Cell* cell) {
|
||||||
cerr << "toOADesign " << cell << endl;
|
cerr << "toOADesign " << cell << endl;
|
||||||
assert(cell);
|
assert(cell);
|
||||||
|
assert(tech);
|
||||||
|
_oaTech = tech;
|
||||||
|
#if 0
|
||||||
// 1) get technology
|
// 1) get technology
|
||||||
if(!_oaTech)
|
if(!_oaTech)
|
||||||
_oaTech = toOATech(_technology,cell->getLibrary());
|
_oaTech = toOATech(_technology,cell->getLibrary());
|
||||||
|
#endif
|
||||||
|
|
||||||
// 2) create OA structure ...
|
// 2) create OA structure ...
|
||||||
oaDesign* layoutView = addLayout(cell);
|
oaDesign* layoutView = addLayout(cell);
|
||||||
|
@ -1062,12 +1107,12 @@ namespace {
|
||||||
return cell;
|
return cell;
|
||||||
}
|
}
|
||||||
|
|
||||||
oaCell* toOACell(const Cell* cell) {
|
oaCell* toOACell(oaTech* tech, const Cell* cell) {
|
||||||
Cell2OACellMap::iterator it = _cell2OAcell.find(cell);
|
Cell2OACellMap::iterator it = _cell2OAcell.find(cell);
|
||||||
if (it != _cell2OAcell.end())
|
if (it != _cell2OAcell.end())
|
||||||
return it->second;
|
return it->second;
|
||||||
|
|
||||||
oaCell* c1 = toOACell( toOADesign(cell) );
|
oaCell* c1 = toOACell( toOADesign(tech, cell) );
|
||||||
_cell2OAcell[cell] = c1;
|
_cell2OAcell[cell] = c1;
|
||||||
|
|
||||||
return c1;
|
return c1;
|
||||||
|
@ -1077,7 +1122,7 @@ namespace {
|
||||||
}//namespace CRL_OA
|
}//namespace CRL_OA
|
||||||
|
|
||||||
namespace CRL {
|
namespace CRL {
|
||||||
void OpenAccess::oaDriver(const string& path, Cell* cell) {
|
void OpenAccess::oaDriver(const string& technoPath,const string& designPath, Cell* cell) {
|
||||||
cerr << "oaDriver" << endl;
|
cerr << "oaDriver" << endl;
|
||||||
#ifdef HAVE_OPENACCESS
|
#ifdef HAVE_OPENACCESS
|
||||||
oaCell* convertedCell = NULL;
|
oaCell* convertedCell = NULL;
|
||||||
|
@ -1085,18 +1130,23 @@ namespace CRL {
|
||||||
cell->materialize();
|
cell->materialize();
|
||||||
//for the moment a driver for hurricaneAMS
|
//for the moment a driver for hurricaneAMS
|
||||||
//save the Cell only and all used Cell
|
//save the Cell only and all used Cell
|
||||||
cerr << "Saving " << cell << " in " << path << endl;
|
cerr << "Saving design " << cell << " in " << designPath << endl;
|
||||||
|
cerr << "Using techno from " << technoPath << endl;
|
||||||
try {
|
try {
|
||||||
oaDesignInit(oacAPIMajorRevNumber,
|
oaDesignInit(oacAPIMajorRevNumber,
|
||||||
oacAPIMinorRevNumber,
|
oacAPIMinorRevNumber,
|
||||||
oacDataModelRevNumber);
|
oacDataModelRevNumber);
|
||||||
|
|
||||||
OADriver oaDriver(path);
|
auto_ptr<OADriver> oaDriver(OADriver::create(technoPath, designPath));
|
||||||
convertedCell = oaDriver.toOACell(cell);
|
|
||||||
|
oaTech* tech = NULL;
|
||||||
|
tech = oaDriver->getOATech();
|
||||||
|
assert(tech);
|
||||||
|
convertedCell = oaDriver->toOACell(tech,cell);
|
||||||
}catch (oaException &e) {
|
}catch (oaException &e) {
|
||||||
cerr << "OA::ERROR => " << e.getMsg() << endl;
|
cerr << "OA::ERROR => " << e.getMsg() << endl;
|
||||||
exit(1);
|
exit(1);
|
||||||
}catch(std::exception& e){
|
}catch(std::exception& e) {
|
||||||
cerr << "STD::ERROR => " << e.what() << endl;
|
cerr << "STD::ERROR => " << e.what() << endl;
|
||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// -*-compile-command:"cd ../../../../.. && make"-*-
|
// -*-compile-command:"cd ../../../../.. && make"-*-
|
||||||
// Time-stamp: "2010-08-13 00:11:06" - OpenAccessParser.cpp
|
// Time-stamp: "2010-09-18 13:28:46" - OpenAccessParser.cpp
|
||||||
// x-----------------------------------------------------------------x
|
// x-----------------------------------------------------------------x
|
||||||
// | This file is part of the hurricaneAMS Software. |
|
// | This file is part of the hurricaneAMS Software. |
|
||||||
// | Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved |
|
// | Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved |
|
||||||
|
@ -71,6 +71,31 @@ namespace {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@todo complete,verify ...
|
||||||
|
*/
|
||||||
|
static BasicLayer::Material::Code fromOAMaterial(const oaMaterial& material) {
|
||||||
|
switch(material) {
|
||||||
|
case oacNWellMaterial:
|
||||||
|
return BasicLayer::Material::nWell;
|
||||||
|
case oacPWellMaterial:
|
||||||
|
return BasicLayer::Material::pWell;
|
||||||
|
case oacNImplantMaterial:
|
||||||
|
return BasicLayer::Material::nImplant;
|
||||||
|
case oacPImplantMaterial:
|
||||||
|
return BasicLayer::Material::pImplant;
|
||||||
|
case oacPolyMaterial:
|
||||||
|
return BasicLayer::Material::poly;
|
||||||
|
case oacCutMaterial:
|
||||||
|
return BasicLayer::Material::cut;
|
||||||
|
case oacMetalMaterial:
|
||||||
|
case oacContactlessMetalMaterial:
|
||||||
|
return BasicLayer::Material::metal;
|
||||||
|
default:
|
||||||
|
return BasicLayer::Material::other;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Cell* getCell(const string& cellNameStr) {
|
Cell* getCell(const string& cellNameStr) {
|
||||||
DataBase* db = DataBase::getDB();
|
DataBase* db = DataBase::getDB();
|
||||||
if (!db || !db->getRootLibrary() ) {
|
if (!db || !db->getRootLibrary() ) {
|
||||||
|
@ -107,7 +132,7 @@ namespace {
|
||||||
Library* library = nit->second;
|
Library* library = nit->second;
|
||||||
|
|
||||||
string libPath = libPathStr;
|
string libPath = libPathStr;
|
||||||
oaFuncs::realPath(libPath);
|
realPath(libPath);
|
||||||
|
|
||||||
oaLib* oaLibrary = NULL;
|
oaLib* oaLibrary = NULL;
|
||||||
try {
|
try {
|
||||||
|
@ -120,7 +145,7 @@ namespace {
|
||||||
}
|
}
|
||||||
|
|
||||||
cerr << "TITI" << endl;
|
cerr << "TITI" << endl;
|
||||||
oaTechnology2Technology(oaLibrary);
|
fromOATech(oaLibrary);
|
||||||
|
|
||||||
//create Hurricane library
|
//create Hurricane library
|
||||||
DataBase* db = DataBase::getDB();
|
DataBase* db = DataBase::getDB();
|
||||||
|
@ -294,7 +319,7 @@ namespace {
|
||||||
/**
|
/**
|
||||||
heart of the parser algorithm
|
heart of the parser algorithm
|
||||||
*/
|
*/
|
||||||
void oaTechnology2Technology(oaLib* oaLibrary) {
|
void fromOATech(oaLib* oaLibrary) {
|
||||||
assert(oaLibrary);
|
assert(oaLibrary);
|
||||||
try {
|
try {
|
||||||
oaTech* tech = oaTech::open(oaLibrary);
|
oaTech* tech = oaTech::open(oaLibrary);
|
||||||
|
|
|
@ -0,0 +1,76 @@
|
||||||
|
// -*-compile-command:"cd ../../../../.. && make"-*-
|
||||||
|
// Time-stamp: "2010-09-17 17:22:49" - PathsUtils.h
|
||||||
|
// x-----------------------------------------------------------------x
|
||||||
|
// | This file is part of the hurricaneAMS Software. |
|
||||||
|
// | Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved |
|
||||||
|
// | =============================================================== |
|
||||||
|
// | Author : Jean-Manuel Caba |
|
||||||
|
// | E-mail : Jean-Manuel.Caba@asim.lip6.fr |
|
||||||
|
// x-----------------------------------------------------------------x
|
||||||
|
#ifndef __PATHSUTILS_H__
|
||||||
|
#define __PATHSUTILS_H__
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
#include <boost/filesystem/operations.hpp>
|
||||||
|
namespace bfs = boost::filesystem;
|
||||||
|
|
||||||
|
/**
|
||||||
|
handling realpath
|
||||||
|
*/
|
||||||
|
static void realPath(string& pathToChange){
|
||||||
|
if(bfs::path::default_name_check_writable())
|
||||||
|
bfs::path::default_name_check(bfs::portable_posix_name);
|
||||||
|
bfs::path resolvedPath = pathToChange;
|
||||||
|
pathToChange = system_complete(resolvedPath).string();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
suppose the path has been resolved with system_complete
|
||||||
|
before calling this function and path are posix_name
|
||||||
|
then split the path in boos::filesystem::path corresponding of each dir
|
||||||
|
from most root parent to leaf dir
|
||||||
|
@see create_all_dirs
|
||||||
|
*/
|
||||||
|
static std::vector<bfs::path> split_in_dirs(const bfs::path& p){
|
||||||
|
string pstr(p.string());
|
||||||
|
register size_t len(pstr.length());
|
||||||
|
register char delim('/');
|
||||||
|
register size_t firstDelim=0;
|
||||||
|
register size_t secondDelim=1;
|
||||||
|
vector<bfs::path> dirs;
|
||||||
|
while(firstDelim < len){
|
||||||
|
while(secondDelim < len && pstr[secondDelim]!=delim)
|
||||||
|
secondDelim++;
|
||||||
|
string dir = pstr.substr(0,secondDelim);
|
||||||
|
if(dir.empty())
|
||||||
|
break;
|
||||||
|
dirs.push_back(bfs::path(dir));
|
||||||
|
firstDelim = secondDelim;
|
||||||
|
secondDelim++;
|
||||||
|
}
|
||||||
|
return dirs;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
work around for boost::filesystem::create_directories
|
||||||
|
missing in old boost versions like 1.33.1
|
||||||
|
and equivalent to recursivly creating directories
|
||||||
|
instead this is done iteratively.
|
||||||
|
*/
|
||||||
|
static void create_all_dirs(const bfs::path& p){
|
||||||
|
if(p.empty() || bfs::exists(p))
|
||||||
|
return;
|
||||||
|
std::vector<bfs::path> test;
|
||||||
|
test = split_in_dirs(p);
|
||||||
|
std::vector<bfs::path>::iterator it = test.begin();
|
||||||
|
for(;it != test.end();it++){
|
||||||
|
if(it->empty() || bfs::exists(*it))
|
||||||
|
continue;
|
||||||
|
bfs::create_directory(*it);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif//__PATHSUTILS_H__
|
|
@ -40,4 +40,4 @@ export OA_PLUGIN_PATH=$OPENACCESS_TOP/data
|
||||||
# note that $TEMP is /dsk/l1/misc/$(USER) directory
|
# note that $TEMP is /dsk/l1/misc/$(USER) directory
|
||||||
export OA_INCLUDE_DIR=$TEMP/OA_HEADER
|
export OA_INCLUDE_DIR=$TEMP/OA_HEADER
|
||||||
#si on utilise OA de si2 on aura
|
#si on utilise OA de si2 on aura
|
||||||
#export OPENACCESS_INCLUDE=$OPENACCESS_TOP/include
|
#export OA_INCLUDE_DIR=$OPENACCESS_TOP/include
|
||||||
|
|
Loading…
Reference in New Issue