From 2797086746b98f95917a20a0230e9688436ffe00 Mon Sep 17 00:00:00 2001 From: Jean-Manuel Caba Date: Mon, 5 Jul 2010 15:29:11 +0000 Subject: [PATCH] working on technology and Layer conversion ... --- crlcore/src/ccore/OADriver.cpp | 3 +- .../ccore/openaccess/OpenAccessWrapper.cpp | 77 +++++++++++++++---- .../src/ccore/openaccess/OpenAccessWrapper.h | 4 +- .../src/ccore/openaccess/test/CMakeLists.txt | 1 + crlcore/src/ccore/openaccess/test/Makefile | 3 + .../ccore/openaccess/test/src/CMakeLists.txt | 2 + .../src/ccore/openaccess/test/src/main.cpp | 40 +++++++--- 7 files changed, 101 insertions(+), 29 deletions(-) diff --git a/crlcore/src/ccore/OADriver.cpp b/crlcore/src/ccore/OADriver.cpp index fe74bb49..8d5d8856 100644 --- a/crlcore/src/ccore/OADriver.cpp +++ b/crlcore/src/ccore/OADriver.cpp @@ -10,7 +10,6 @@ namespace CRL { OADriver::OADriver(Cell* cell) : _cell(cell) {} void OADriver::save(const string& filePath) { - unsigned int saveState; - CRL::OpenAccessWrapper::oaDriver(filePath, _cell, saveState); + CRL::OpenAccessWrapper::oaDriver(filePath, _cell); } }// namespace CRL diff --git a/crlcore/src/ccore/openaccess/OpenAccessWrapper.cpp b/crlcore/src/ccore/openaccess/OpenAccessWrapper.cpp index 1cf2e207..03781f57 100644 --- a/crlcore/src/ccore/openaccess/OpenAccessWrapper.cpp +++ b/crlcore/src/ccore/openaccess/OpenAccessWrapper.cpp @@ -1,5 +1,5 @@ // -*-compile-command:"cd ../../../../.. && make"-*- -// Time-stamp: "2010-06-30 13:45:04" - OpenAccessWrapper.cpp +// Time-stamp: "2010-07-05 17:13:52" - OpenAccessWrapper.cpp // x-----------------------------------------------------------------x // | This file is part of the hurricaneAMS Software. | // | Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved | @@ -17,11 +17,13 @@ using namespace oa; #endif #include "hurricane/DataBase.h" +#include "hurricane/Technology.h" #include "hurricane/Library.h" #include "hurricane/Cell.h" #include "hurricane/NetExternalComponents.h" #include "hurricane/Segment.h" #include "hurricane/Pad.h" +#include "hurricane/BasicLayer.h" using namespace Hurricane; #include "OpenAccessWrapper.h" @@ -118,11 +120,9 @@ namespace { assert(design); oaBlock* masterBlock = design->getTopBlock(); oaTerm* term = oaTerm::find(masterBlock, instTermName); - if (!term) { - cerr << "looking for " << plug->getName() << endl; - printBlockTerms(masterBlock); - } assert(term); + cerr << "looking for " << plug->getName() << endl; + printBlockTerms(masterBlock); instTerm = oaInstTerm::create(NULL, inst, term); return instTerm; } @@ -133,6 +133,7 @@ namespace { typedef map Cell2OADesignMap; typedef pair OAInstPair; typedef map Instance2OAInstsMap; + typedef map Layer2OAPhysicalLayerMap; string _path; oaTech* _oaTech; @@ -140,6 +141,7 @@ namespace { Library2OALibMap _library2OALibMap; Cell2OADesignMap _cell2OADesignMap; Instance2OAInstsMap _instance2OAInstMap; + Layer2OAPhysicalLayerMap _layer2OAPhysicalLayerMap; DataBase* _db; Technology* _technology; public: @@ -150,6 +152,7 @@ namespace { _library2OALibMap(), _cell2OADesignMap(), _instance2OAInstMap(), + _layer2OAPhysicalLayerMap(), _db(NULL), _technology(NULL) { _db = DataBase::getDB(); @@ -212,15 +215,62 @@ namespace { } /** - @todo complete with technology info + @todo verify + */ + oaMaterial basicLayerMaterial2oaMaterial(const BasicLayer::Material& material){ + switch ( material.getCode() ) { + case BasicLayer::Material::nWell: return oacNWellMaterial; + case BasicLayer::Material::pWell: return oacPWellMaterial; + case BasicLayer::Material::nImplant: return oacNImplantMaterial; + case BasicLayer::Material::pImplant: return oacPImplantMaterial; + case BasicLayer::Material::active: return oacOtherMaterial;//is it OK? + case BasicLayer::Material::poly: return oacPolyMaterial; + case BasicLayer::Material::cut: return oacCutMaterial; + case BasicLayer::Material::metal: return oacMetalMaterial; + case BasicLayer::Material::blockage: return oacOtherMaterial;//is it OK? + case BasicLayer::Material::other: return oacOtherMaterial; + } + throw Error("ERROR : unknow Material"); + return oacOtherMaterial; + } + + /** + @todo complete with technology info for layers */ oaTech* createOATechForTechnology(const Technology* technology,oaLib* lib) { oaTech* oaTech = oaTech::create(lib); oaTech->setDefaultManufacturingGrid(10); oaTech->setDBUPerUU(oaViewType::get(oacMaskLayout), 1000); - + + int layerID=0; + for_each_layer(layer, technology->getLayers()) { + oaString layerName = getString(layer->getName()).c_str(); + oaPhysicalLayer* oaLayer = NULL; + { + BasicLayer* bLayer = dynamic_cast(layer); + if(bLayer) + oaLayer = oaPhysicalLayer::create(oaTech, layerName, layerID++,basicLayerMaterial2oaMaterial(bLayer->getMaterial())); + else + oaLayer = oaPhysicalLayer::create(oaTech, layerName, layerID++); + } + assert(oaLayer); + _layer2OAPhysicalLayerMap[layer] = oaLayer; + DbU::Unit minSize = layer->getMinimalSize(); + DbU::Unit minSpace = layer->getMinimalSpacing(); + DbU::Unit pitch = layer->getPitch(); + end_for; + } + + for_each_basic_layer(basicLayer, technology->getBasicLayers()) { + Layer2OAPhysicalLayerMap::iterator it = _layer2OAPhysicalLayerMap.find((Layer*)(basicLayer)); + if (it != _layer2OAPhysicalLayerMap.end()) { + oaPhysicalLayer* oaLayer = it->second; + unsigned gdsIInumber = basicLayer->getExtractNumber(); + } + end_for; + } + assert(oaTech != NULL); - return oaTech; } @@ -235,11 +285,13 @@ namespace { cerr << "getOALibForLibrary" << endl; oaLib* lib = getOALibForLibrary(cell->getLibrary()); oaScalarName scNameDesign(ns, getString(cell->getName()).c_str()); + oaScalarName scNameViewSchematic(ns, "schematic"); oaScalarName scNameView(ns, "layout"); oaScalarName scNameLib; lib->getName(scNameLib); - oaDesign* design = oaDesign::open(scNameLib, scNameDesign, scNameView, oaViewType::get(oacSchematic), 'w'); + oaDesign* designSch = oaDesign::open(scNameLib, scNameDesign, scNameViewSchematic, oaViewType::get(oacSchematic), 'w'); + oaDesign* design = oaDesign::open(scNameLib, scNameDesign, scNameView, oaViewType::get(oacMaskLayout), 'w'); oaBlock* block = oaBlock::create(design); cerr << "transformation of instance" << endl; @@ -297,7 +349,7 @@ namespace { } namespace CRL { - void OpenAccessWrapper::oaDriver(const string& path, Cell* cell, unsigned int& saveState) { + void OpenAccessWrapper::oaDriver(const string& path, Cell* cell) { #ifdef HAVE_OPENACCESS //for the moment a driver for hurricaneAMS //save the Cell and all used Cells @@ -308,10 +360,7 @@ namespace CRL { oacAPIMinorRevNumber, oacDataModelRevNumber); - Library* library = cell->getLibrary(); - string pathLib = path + "/" + getString(library->getName()); - - OADriver oaDriver(pathLib); + OADriver oaDriver(path); oaDesign* design = oaDriver.getOADesignForCell(cell); if(design) cerr << getDesignName(design) << endl; diff --git a/crlcore/src/ccore/openaccess/OpenAccessWrapper.h b/crlcore/src/ccore/openaccess/OpenAccessWrapper.h index 3aaf6fac..c93525dd 100644 --- a/crlcore/src/ccore/openaccess/OpenAccessWrapper.h +++ b/crlcore/src/ccore/openaccess/OpenAccessWrapper.h @@ -1,5 +1,5 @@ // -*-compile-command:"cd ../../../../.. && make"-*- -// Time-stamp: "2010-06-29 11:55:46" - OpenAccessWrapper.h +// Time-stamp: "2010-07-01 15:34:45" - OpenAccessWrapper.h // x-----------------------------------------------------------------x // | This file is part of the hurricaneAMS Software. | // | Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved | @@ -25,7 +25,7 @@ namespace Hurricane { namespace CRL { class OpenAccessWrapper { public: - static void oaDriver(const string& cellPath, Cell* cell, unsigned int& saveState); + static void oaDriver(const string& cellPath, Cell* cell); }; } diff --git a/crlcore/src/ccore/openaccess/test/CMakeLists.txt b/crlcore/src/ccore/openaccess/test/CMakeLists.txt index 9cf258e8..b22393cf 100755 --- a/crlcore/src/ccore/openaccess/test/CMakeLists.txt +++ b/crlcore/src/ccore/openaccess/test/CMakeLists.txt @@ -14,6 +14,7 @@ FIND_PACKAGE(CORIOLIS REQUIRED) FIND_PACKAGE(VLSISAPD REQUIRED) FIND_PACKAGE(HURRICANEAMS REQUIRED) FIND_PACKAGE(AMSCORE REQUIRED) +FIND_PACKAGE(Qt4 REQUIRED) # find and setup Qt4 for this project FIND_PACKAGE(LibXml2 REQUIRED) FIND_PACKAGE(PythonLibs REQUIRED) diff --git a/crlcore/src/ccore/openaccess/test/Makefile b/crlcore/src/ccore/openaccess/test/Makefile index 0c928b95..4d46f76c 100644 --- a/crlcore/src/ccore/openaccess/test/Makefile +++ b/crlcore/src/ccore/openaccess/test/Makefile @@ -6,5 +6,8 @@ all: run: cd x86_64/usr/local/bin && ./testOAWrapper /asim/chams/etc/chams/config.freePDK45.xml +debug: + cd x86_64/usr/local/bin && gdb -args ./testOAWrapper /asim/chams/etc/chams/config.freePDK45.xml + clean: rm -rf x86_64 diff --git a/crlcore/src/ccore/openaccess/test/src/CMakeLists.txt b/crlcore/src/ccore/openaccess/test/src/CMakeLists.txt index 19c7b7ae..4c53d292 100755 --- a/crlcore/src/ccore/openaccess/test/src/CMakeLists.txt +++ b/crlcore/src/ccore/openaccess/test/src/CMakeLists.txt @@ -1,4 +1,6 @@ +INCLUDE(${QT_USE_FILE}) + INCLUDE_DIRECTORIES ( ${HURRICANE_INCLUDE_DIR} ${CORIOLIS_INCLUDE_DIR} ${HURRICANEAMS_INCLUDE_DIR} diff --git a/crlcore/src/ccore/openaccess/test/src/main.cpp b/crlcore/src/ccore/openaccess/test/src/main.cpp index 6b3a6952..55463877 100755 --- a/crlcore/src/ccore/openaccess/test/src/main.cpp +++ b/crlcore/src/ccore/openaccess/test/src/main.cpp @@ -18,6 +18,7 @@ using namespace std; using namespace Hurricane; #include "crlcore/Catalog.h" +#include "crlcore/RealTechnologyParser.h" #include "crlcore/AllianceFramework.h" #include "hurricaneAMS/environment/AnalogEnv.h" @@ -35,20 +36,16 @@ void testCell(Cell* dev){ if(dev) cout << "Cell created" << endl; - cout << "driving GDS" << endl; - CRL::GdsDriver(dev).save("/tmp/testGDS"); +// cout << "driving GDS" << endl; +// CRL::GdsDriver(dev).save("/tmp/testGDS"); cout << "driving OA" << endl; CRL::OADriver(dev).save("/tmp/testOA"); } - -int main(int argc,char** argv) { - if(argc != 2) - exit(-5); - - AnalogEnv::create(argv[1]);//create Database ... - cout << "analog environment loaded and database created" << endl; +void testAnalog(char* pathToConf){ + AnalogEnv::create(pathToConf);//create Database ... + cout << "analog environment loaded and database created" << endl; DataBase* db = DataBase::getDB(); assert(db != NULL); Library* rootLib = db->getRootLibrary(); @@ -78,10 +75,31 @@ int main(int argc,char** argv) { cout << "testing cell myCM" << endl; testCell(dev); + db->destroy(); +} -// cout << "creating and testing cell from sxlib inv_x1" << endl; +void testNum(){ + cout << "creating cell from sxlib inv_x1" << endl; + CRL::AllianceFramework::get(); + DataBase* db = DataBase::getDB(); + assert(db != NULL); + CRL::RealTechnologyParser::load(db, "/asim/coriolis2/etc/coriolis2/technology.freePDK45.s2r.xml"); + Cell* mySxlibCell = CRL::AllianceFramework::get()->getCell( "inv_x1", CRL::Catalog::State::Views ); + cout << "testing cell from sxlib inv_x1" << endl; + testCell(mySxlibCell); + db = DataBase::getDB(); + assert(db != NULL); + db->destroy(); +} -// testCell(CRL::AllianceFramework::get()->getCell( "inv_x1", CRL::Catalog::State::Views )); + + +int main(int argc,char** argv) { + if(argc != 2) + exit(-5); + + testAnalog(argv[1]); +// testNum(); cout << "ending normally" << endl; return 0;