cleaning up OA driver, add simple test source ...
This commit is contained in:
parent
49c0e4d330
commit
31328a6811
|
@ -123,19 +123,14 @@
|
||||||
lefdef/LefParser.cpp
|
lefdef/LefParser.cpp
|
||||||
lefdef/DefParser.cpp
|
lefdef/DefParser.cpp
|
||||||
lefdef/DefDriver.cpp
|
lefdef/DefDriver.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
if ( OA_FOUND )
|
|
||||||
include_directories ( ${OA_INCLUDE_DIR} )
|
|
||||||
set( openaccess_cpps openaccess/COpenAccessBridgeLayer.cpp
|
|
||||||
openaccess/OAWrapper.cpp
|
|
||||||
)
|
|
||||||
endif ( OA_FOUND )
|
|
||||||
if ( LEFDEF_FOUND )
|
if ( LEFDEF_FOUND )
|
||||||
include_directories ( ${LEFDEF_INCLUDE_DIR} )
|
include_directories ( ${LEFDEF_INCLUDE_DIR} )
|
||||||
endif ( LEFDEF_FOUND )
|
endif ( LEFDEF_FOUND )
|
||||||
set (openaccess_cpps ${openaccess_cpps}
|
if ( OA_FOUND )
|
||||||
openaccess/OpenAccessWrapper.cpp )
|
include_directories ( ${OA_INCLUDE_DIR} )
|
||||||
|
endif ( OA_FOUND )
|
||||||
|
set (openaccess_cpps openaccess/OpenAccessWrapper.cpp )
|
||||||
|
|
||||||
set ( VstParserSourceDir ${CRLCORE_SOURCE_DIR}/src/ccore/alliance/vst )
|
set ( VstParserSourceDir ${CRLCORE_SOURCE_DIR}/src/ccore/alliance/vst )
|
||||||
set ( VstParserBinaryDir ${CRLCORE_BINARY_DIR}/src/ccore/alliance/vst )
|
set ( VstParserBinaryDir ${CRLCORE_BINARY_DIR}/src/ccore/alliance/vst )
|
||||||
|
|
|
@ -219,8 +219,8 @@ namespace CRL {
|
||||||
registerSlot ( "spi", (CellParser_t*)spiceParser , "spi" );
|
registerSlot ( "spi", (CellParser_t*)spiceParser , "spi" );
|
||||||
registerSlot ( "def", (CellParser_t*)defParser , "def" );
|
registerSlot ( "def", (CellParser_t*)defParser , "def" );
|
||||||
registerSlot ( "def", (LibraryParser_t*)lefParser , "lef" );
|
registerSlot ( "def", (LibraryParser_t*)lefParser , "lef" );
|
||||||
registerSlot ( "oa", (CellParser_t*)OpenAccessWrapper::oaDesignLoader , "oa" );
|
// registerSlot ( "oa", (CellParser_t*)OpenAccessWrapper::oaDesignLoader , "oa" );
|
||||||
registerSlot ( "oa", (LibraryParser_t*)OpenAccessWrapper::oaLibLoader , "oa" );
|
// registerSlot ( "oa", (LibraryParser_t*)OpenAccessWrapper::oaLibLoader , "oa" );
|
||||||
registerSlot ( "aux", (CellParser_t*)bookshelfParser, "aux" );
|
registerSlot ( "aux", (CellParser_t*)bookshelfParser, "aux" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// -*-compile-command:"cd ../../../../.. && make"-*-
|
||||||
|
// Time-stamp: "2010-06-30 13:45:04" - OpenAccessWrapper.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 |
|
||||||
|
@ -5,6 +7,10 @@
|
||||||
// | Author : Chistophe Alexandre |
|
// | Author : Chistophe Alexandre |
|
||||||
// | E-mail : Christophe.Alexandre@asim.lip6.fr |
|
// | E-mail : Christophe.Alexandre@asim.lip6.fr |
|
||||||
// x-----------------------------------------------------------------x
|
// x-----------------------------------------------------------------x
|
||||||
|
// | Author : Jean-Manuel Caba |
|
||||||
|
// | E-mail : Jean-Manuel.Caba@asim.lip6.fr |
|
||||||
|
// x-----------------------------------------------------------------x
|
||||||
|
|
||||||
#ifdef HAVE_OPENACCESS
|
#ifdef HAVE_OPENACCESS
|
||||||
#include "oa/oaDesignDB.h"
|
#include "oa/oaDesignDB.h"
|
||||||
using namespace oa;
|
using namespace oa;
|
||||||
|
@ -24,50 +30,32 @@ namespace {
|
||||||
|
|
||||||
#ifdef HAVE_OPENACCESS
|
#ifdef HAVE_OPENACCESS
|
||||||
|
|
||||||
#if 0
|
oaString getDesignName(oaDesign* design) {
|
||||||
oaModInstTerm* getModInstTerm(oaModInst* modInst, Plug* plug) {
|
oaNativeNS ns;
|
||||||
oaNativeNS ns;
|
oaString libName, cellName, viewName;
|
||||||
oaScalarName scPlugName(ns, getString(plug->getName()).c_str());
|
design->getLibName(ns, libName);
|
||||||
oaName instTermName(scPlugName);
|
design->getCellName(ns, cellName);
|
||||||
oaModInstTerm* instTerm = oaModInstTerm::find(modInst, instTermName);
|
design->getViewName(ns, viewName);
|
||||||
if (instTerm) {
|
oaString designName = "<" + libName + "," + cellName + "," + viewName + ">";
|
||||||
return instTerm;
|
return designName;
|
||||||
}
|
}
|
||||||
oaModule* masterModule = modInst->getMasterModule();
|
|
||||||
oaModTerm* modTerm = oaModTerm::find(masterModule, instTermName);
|
|
||||||
assert(modTerm);
|
|
||||||
oaModNet* modNet = oaModNet::find(masterModule, instTermName);
|
|
||||||
assert(modNet);
|
|
||||||
instTerm = oaModInstTerm::create(modNet, modInst, instTermName);
|
|
||||||
return instTerm;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
oaString getDesignName(oaDesign* design) {
|
void printBlockTerms(oaBlock* block) {
|
||||||
oaNativeNS ns;
|
cerr << "printBlockTerms" << endl;
|
||||||
oaString libName, cellName, viewName;
|
oaNativeNS ns;
|
||||||
design->getLibName(ns, libName);
|
oaDesign* design = block->getDesign();
|
||||||
design->getCellName(ns, cellName);
|
cerr << " o Printing " << getDesignName(design) << " terms" << endl;
|
||||||
design->getViewName(ns, viewName);
|
oaIter<oaTerm> termIter(block->getTerms());
|
||||||
oaString designName = "<" + libName + "," + cellName + "," + viewName + ">";
|
while (oaTerm* term = termIter.getNext()) {
|
||||||
return designName;
|
oaString termName;
|
||||||
}
|
term->getName(ns, termName);
|
||||||
|
cerr << " - " << termName << endl;
|
||||||
void printBlockTerms(oaBlock* block) {
|
}
|
||||||
oaNativeNS ns;
|
cerr << endl;
|
||||||
oaDesign* design = block->getDesign();
|
|
||||||
cerr << " o Printing " << getDesignName(design) << " terms" << endl;
|
|
||||||
oaIter<oaTerm> termIter(block->getTerms());
|
|
||||||
while (oaTerm* term = termIter.getNext()) {
|
|
||||||
oaString termName;
|
|
||||||
term->getName(ns, termName);
|
|
||||||
cerr << " - " << termName << endl;
|
|
||||||
}
|
}
|
||||||
cerr << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
oaTermType getOATermType(const Net::Direction& direction) {
|
oaTermType getOATermType(const Net::Direction& direction) {
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case Net::Direction::IN:
|
case Net::Direction::IN:
|
||||||
return oacInputTermType;
|
return oacInputTermType;
|
||||||
case Net::Direction::OUT:
|
case Net::Direction::OUT:
|
||||||
|
@ -76,14 +64,16 @@ oaTermType getOATermType(const Net::Direction& direction) {
|
||||||
return oacInputOutputTermType;
|
return oacInputOutputTermType;
|
||||||
case Net::Direction::TRISTATE:
|
case Net::Direction::TRISTATE:
|
||||||
return oacTristateTermType;
|
return oacTristateTermType;
|
||||||
|
case Net::Direction::UNDEFINED:
|
||||||
|
return oacUnusedTermType;// is it OK ?
|
||||||
default:
|
default:
|
||||||
throw Error("unrecognized direction");
|
throw Error("unrecognized direction");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
oaOrient getOAOrientFromOrientation(const Transformation::Orientation& orientation) {
|
oaOrient getOAOrientFromOrientation(const Transformation::Orientation& orientation) {
|
||||||
cerr << orientation << endl;
|
cerr << orientation << endl;
|
||||||
switch (orientation) {
|
switch (orientation) {
|
||||||
case Transformation::Orientation::ID:
|
case Transformation::Orientation::ID:
|
||||||
return oacR0;
|
return oacR0;
|
||||||
case Transformation::Orientation::R1:
|
case Transformation::Orientation::R1:
|
||||||
|
@ -102,41 +92,42 @@ oaOrient getOAOrientFromOrientation(const Transformation::Orientation& orientati
|
||||||
return oacMYR90;
|
return oacMYR90;
|
||||||
default:
|
default:
|
||||||
throw Error("Unrecognized orientation");
|
throw Error("Unrecognized orientation");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void getOATransformFromTransformation(oaTransform& transform, const Transformation& transformation) {
|
void getOATransformFromTransformation(oaTransform& transform, const Transformation& transformation) {
|
||||||
transform.set(transformation.getTx(),
|
transform.set(transformation.getTx(),
|
||||||
transformation.getTy(),
|
transformation.getTy(),
|
||||||
getOAOrientFromOrientation(transformation.getOrientation()));
|
getOAOrientFromOrientation(transformation.getOrientation()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void getOABoxForBox(oaBox& box, const Box& hbox) {
|
void getOABoxForBox(oaBox& box, const Box& hbox) {
|
||||||
box.set(hbox.getXMin(), hbox.getYMin(), hbox.getXMax(), hbox.getYMax());
|
box.set(hbox.getXMin(), hbox.getYMin(), hbox.getXMax(), hbox.getYMax());
|
||||||
}
|
}
|
||||||
|
|
||||||
oaInstTerm* getInstTerm(oaInst* inst, Plug* plug) {
|
oaInstTerm* getInstTerm(oaInst* inst, Plug* plug) {
|
||||||
oaNativeNS ns;
|
cerr << "getInstTerm" << endl;
|
||||||
oaScalarName scPlugName(ns, getString(plug->getMasterNet()->getName()).c_str());
|
oaNativeNS ns;
|
||||||
oaName instTermName(scPlugName);
|
oaScalarName scPlugName(ns, getString(plug->getMasterNet()->getName()).c_str());
|
||||||
oaInstTerm* instTerm = oaInstTerm::find(inst, instTermName);
|
oaName instTermName(scPlugName);
|
||||||
if (instTerm) {
|
oaInstTerm* instTerm = oaInstTerm::find(inst, instTermName);
|
||||||
|
if (instTerm) {
|
||||||
|
return instTerm;
|
||||||
|
}
|
||||||
|
oaDesign* design = inst->getMaster();
|
||||||
|
assert(design);
|
||||||
|
oaBlock* masterBlock = design->getTopBlock();
|
||||||
|
oaTerm* term = oaTerm::find(masterBlock, instTermName);
|
||||||
|
if (!term) {
|
||||||
|
cerr << "looking for " << plug->getName() << endl;
|
||||||
|
printBlockTerms(masterBlock);
|
||||||
|
}
|
||||||
|
assert(term);
|
||||||
|
instTerm = oaInstTerm::create(NULL, inst, term);
|
||||||
return instTerm;
|
return instTerm;
|
||||||
}
|
}
|
||||||
oaDesign* design = inst->getMaster();
|
|
||||||
assert(design);
|
|
||||||
oaBlock* masterBlock = design->getTopBlock();
|
|
||||||
oaTerm* term = oaTerm::find(masterBlock, instTermName);
|
|
||||||
if (!term) {
|
|
||||||
cerr << "looking for " << plug->getName() << endl;
|
|
||||||
printBlockTerms(masterBlock);
|
|
||||||
}
|
|
||||||
assert(term);
|
|
||||||
instTerm = oaInstTerm::create(NULL, inst, term);
|
|
||||||
return instTerm;
|
|
||||||
}
|
|
||||||
|
|
||||||
class OADriver {
|
class OADriver {
|
||||||
private:
|
private:
|
||||||
typedef map<const Library*, oaLib*> Library2OALibMap;
|
typedef map<const Library*, oaLib*> Library2OALibMap;
|
||||||
typedef map<const Cell*, oaDesign*> Cell2OADesignMap;
|
typedef map<const Cell*, oaDesign*> Cell2OADesignMap;
|
||||||
|
@ -149,64 +140,47 @@ class OADriver {
|
||||||
Library2OALibMap _library2OALibMap;
|
Library2OALibMap _library2OALibMap;
|
||||||
Cell2OADesignMap _cell2OADesignMap;
|
Cell2OADesignMap _cell2OADesignMap;
|
||||||
Instance2OAInstsMap _instance2OAInstMap;
|
Instance2OAInstsMap _instance2OAInstMap;
|
||||||
|
DataBase* _db;
|
||||||
|
Technology* _technology;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
OADriver(const string& path):
|
OADriver(const string& path):
|
||||||
_path(path),
|
_path(path),
|
||||||
_oaTech(NULL),
|
_oaTech(NULL),
|
||||||
_oaBlock(NULL),
|
_oaBlock(NULL),
|
||||||
_library2OALibMap(),
|
_library2OALibMap(),
|
||||||
_cell2OADesignMap(),
|
_cell2OADesignMap(),
|
||||||
_instance2OAInstMap() {
|
_instance2OAInstMap(),
|
||||||
DataBase* db = DataBase::getDB();
|
_db(NULL),
|
||||||
if (!db) {
|
_technology(NULL) {
|
||||||
throw Error("no database");
|
_db = DataBase::getDB();
|
||||||
}
|
if (!_db) {
|
||||||
Technology* technology = db->getTechnology();
|
throw Error("no database");
|
||||||
//createOATechForTechnology(technology);
|
|
||||||
}
|
}
|
||||||
|
_technology = _db->getTechnology();
|
||||||
|
if (!_technology) {
|
||||||
|
throw Error("no technology");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
~OADriver() {
|
~OADriver() {
|
||||||
cerr << "SAVING ALL" << endl;
|
cerr << "SAVING ALL" << endl;
|
||||||
|
|
||||||
#if 0
|
|
||||||
oaNativeNS ns;
|
|
||||||
string fullPath = _path + "/lib.defs";
|
|
||||||
oaScalarName scPath(ns, fullPath.c_str());
|
|
||||||
oaString strPath;
|
|
||||||
scPath.get(strPath);
|
|
||||||
oaLibDefList* libDefList = oaLibDefList::get(strPath, 'w');
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (Cell2OADesignMap::iterator it = _cell2OADesignMap.begin();
|
for (Cell2OADesignMap::iterator it = _cell2OADesignMap.begin();
|
||||||
it != _cell2OADesignMap.end();
|
it != _cell2OADesignMap.end();
|
||||||
++it) {
|
++it) {
|
||||||
cerr << it->first << endl;
|
cerr << it->first << endl;
|
||||||
oaDesign* design = it->second;
|
oaDesign* design = it->second;
|
||||||
design->save();
|
design->save();
|
||||||
design->close();
|
design->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Library2OALibMap::iterator it = _library2OALibMap.begin();
|
for (Library2OALibMap::iterator it = _library2OALibMap.begin();
|
||||||
it != _library2OALibMap.end();
|
it != _library2OALibMap.end();
|
||||||
++it) {
|
++it) {
|
||||||
oaLib* lib = it->second;
|
oaLib* lib = it->second;
|
||||||
#if 0
|
|
||||||
oaScalarName libName;
|
|
||||||
lib->getName(libName);
|
|
||||||
oaString libPath;
|
|
||||||
lib->getFullPath(libPath);
|
|
||||||
oaLibDef* libDef = oaLibDef::create(libDefList, libName, libPath);
|
|
||||||
#endif
|
|
||||||
lib->close();
|
lib->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
// libDefList->save();
|
|
||||||
cerr << "ALL SAVED" << endl;
|
cerr << "ALL SAVED" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
oaLib* getOALibForLibrary(const Library* library) {
|
oaLib* getOALibForLibrary(const Library* library) {
|
||||||
Library2OALibMap::iterator it = _library2OALibMap.find(library);
|
Library2OALibMap::iterator it = _library2OALibMap.find(library);
|
||||||
if (it != _library2OALibMap.end()) {
|
if (it != _library2OALibMap.end()) {
|
||||||
|
@ -214,50 +188,40 @@ class OADriver {
|
||||||
}
|
}
|
||||||
oaNativeNS ns;
|
oaNativeNS ns;
|
||||||
const char* strNameLib = getString(library->getName()).c_str();
|
const char* strNameLib = getString(library->getName()).c_str();
|
||||||
if (!strcmp(strNameLib, ".")) {
|
if (!strcmp(strNameLib, "."))
|
||||||
strNameLib = "worklib";
|
strNameLib = "worklib";
|
||||||
}
|
|
||||||
string strPathLib = _path + '/' + strNameLib;
|
string strPathLib = _path + '/' + strNameLib;
|
||||||
//cerr << "Creating new Library for Lib name="
|
cerr << "Creating new Library for Lib name="
|
||||||
// << strNameLib << " to filesystem path=" << strPathLib << endl;
|
<< strNameLib << " to filesystem path=" << strPathLib << endl;
|
||||||
oaScalarName scNameLib(ns, strNameLib);
|
oaScalarName scNameLib(ns, strNameLib);
|
||||||
cerr << "Creating new Library for Lib name="
|
cerr << "Creating new Library for Lib name="
|
||||||
<< strNameLib << " to filesystem path=" << strPathLib << endl;
|
<< strNameLib << " to filesystem path=" << strPathLib << endl;
|
||||||
|
|
||||||
|
string cmd = "rm -rf "+strPathLib+"; mkdir -p "+strPathLib;
|
||||||
|
system(cmd.c_str());
|
||||||
oaLib* lib = oaLib::create(scNameLib, strPathLib.c_str(), oacSharedLibMode, "oaDMFileSys");
|
oaLib* lib = oaLib::create(scNameLib, strPathLib.c_str(), oacSharedLibMode, "oaDMFileSys");
|
||||||
|
|
||||||
//oaScalarName libName;
|
assert(lib);
|
||||||
//_oaTech->getLibName(libName);
|
assert(lib->isValid());
|
||||||
//oaTech::attach(lib, libName);
|
|
||||||
//assert(oaTech::find(lib));
|
assert(_oaTech == NULL);
|
||||||
|
_oaTech = createOATechForTechnology(_technology,lib);
|
||||||
|
|
||||||
|
_library2OALibMap[library] = lib;
|
||||||
|
return lib;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@todo complete with technology info
|
||||||
|
*/
|
||||||
|
oaTech* createOATechForTechnology(const Technology* technology,oaLib* lib) {
|
||||||
oaTech* oaTech = oaTech::create(lib);
|
oaTech* oaTech = oaTech::create(lib);
|
||||||
oaTech->setDefaultManufacturingGrid(10);
|
oaTech->setDefaultManufacturingGrid(10);
|
||||||
oaTech->setDBUPerUU(oaViewType::get(oacMaskLayout), 1000);
|
oaTech->setDBUPerUU(oaViewType::get(oacMaskLayout), 1000);
|
||||||
|
|
||||||
oaLayer* drawingLayer = oaPhysicalLayer::create(oaTech, "drawing", 0);
|
assert(oaTech != NULL);
|
||||||
|
|
||||||
_library2OALibMap[library] = lib;
|
return oaTech;
|
||||||
|
|
||||||
return lib;
|
|
||||||
}
|
|
||||||
|
|
||||||
void createOATechForTechnology(const Technology* technology) {
|
|
||||||
string strPathLib = _path + "/techlib";
|
|
||||||
oaNativeNS ns;
|
|
||||||
oaScalarName scNameLib(ns, "techlib");
|
|
||||||
oaLib* lib = oaLib::create(scNameLib, strPathLib.c_str(), oacSharedLibMode, "oaDMFileSys");
|
|
||||||
_oaTech = oaTech::create(lib);
|
|
||||||
|
|
||||||
oaLayer* drawingLayer = oaPhysicalLayer::create(_oaTech, "drawing", 0);
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
for_each_layer(hlayer, technology->getLayers()) {
|
|
||||||
oaString strLayerName = getString(hlayer->getName()).c_str();
|
|
||||||
oaPhysicalLayer* layer = oaPhysicalLayer::create(techno, strLayerName, layerNum++);
|
|
||||||
end_for;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
lib->close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
oaDesign* getOADesignForCell(const Cell* cell) {
|
oaDesign* getOADesignForCell(const Cell* cell) {
|
||||||
|
@ -268,33 +232,25 @@ class OADriver {
|
||||||
}
|
}
|
||||||
|
|
||||||
oaNativeNS ns;
|
oaNativeNS ns;
|
||||||
|
cerr << "getOALibForLibrary" << endl;
|
||||||
oaLib* lib = getOALibForLibrary(cell->getLibrary());
|
oaLib* lib = getOALibForLibrary(cell->getLibrary());
|
||||||
oaScalarName scNameDesign(ns, getString(cell->getName()).c_str());
|
oaScalarName scNameDesign(ns, getString(cell->getName()).c_str());
|
||||||
oaScalarName scNameView(ns, "layout");
|
oaScalarName scNameView(ns, "layout");
|
||||||
oaScalarName scNameLib;
|
oaScalarName scNameLib;
|
||||||
lib->getName(scNameLib);
|
lib->getName(scNameLib);
|
||||||
|
|
||||||
oaDesign* design = oaDesign::open(scNameLib, scNameDesign, scNameView, oaViewType::get(oacSchematic), 'w');
|
oaDesign* design = oaDesign::open(scNameLib, scNameDesign, scNameView, oaViewType::get(oacSchematic), 'w');
|
||||||
//oaModule* module = oaModule::create(design);
|
|
||||||
oaBlock* block = oaBlock::create(design);
|
oaBlock* block = oaBlock::create(design);
|
||||||
oaTech* tech = oaTech::find(lib);
|
|
||||||
assert(tech);
|
cerr << "transformation of instance" << endl;
|
||||||
oaBox box;
|
|
||||||
getOABoxForBox(box, cell->getAbutmentBox());
|
|
||||||
cerr << cell << " " << cell->getAbutmentBox() << endl;
|
|
||||||
oaRect::create(block, 0, oaPurpose::get(tech, oacDrawingPurposeType)->getNumber(), box);
|
|
||||||
|
|
||||||
for_each_instance(instance, cell->getInstances()) {
|
for_each_instance(instance, cell->getInstances()) {
|
||||||
Cell* masterCell = instance->getMasterCell();
|
Cell* masterCell = instance->getMasterCell();
|
||||||
oaDesign* masterDesign = getOADesignForCell(masterCell);
|
oaDesign* masterDesign = getOADesignForCell(masterCell);
|
||||||
oaScalarName scDesignName;
|
oaScalarName scDesignName;
|
||||||
masterDesign->getCellName(scDesignName);
|
masterDesign->getCellName(scDesignName);
|
||||||
oaString strDesignName;
|
oaString strDesignName;
|
||||||
scDesignName.get(strDesignName);
|
scDesignName.get(strDesignName);
|
||||||
//oaModule* masterModule = masterDesign->getTopModule();
|
|
||||||
//assert(masterModule);
|
|
||||||
oaScalarName scInstName(ns, getString(instance->getName()).c_str());
|
oaScalarName scInstName(ns, getString(instance->getName()).c_str());
|
||||||
//oaModScalarInst* modInst = oaModScalarInst::create(masterModule, masterDesign, scInstName);
|
|
||||||
|
|
||||||
oaTransform transform;
|
oaTransform transform;
|
||||||
getOATransformFromTransformation(transform, instance->getTransformation());
|
getOATransformFromTransformation(transform, instance->getTransformation());
|
||||||
|
@ -302,96 +258,69 @@ class OADriver {
|
||||||
_instance2OAInstMap[instance] = blockInst;
|
_instance2OAInstMap[instance] = blockInst;
|
||||||
end_for;
|
end_for;
|
||||||
}
|
}
|
||||||
|
cerr << "transformation of net" << endl;
|
||||||
for_each_net(net, cell->getNets()) {
|
for_each_net(net, cell->getNets()) {
|
||||||
oaScalarName scNetName(ns, getString(net->getName()).c_str());
|
oaScalarName scNetName(ns, getString(net->getName()).c_str());
|
||||||
//oaModNet* modNet = oaModScalarNet::create(module, scNetName, oacAnalogSigType);
|
|
||||||
oaScalarNet* blockNet = oaScalarNet::create(block, scNetName, oacAnalogSigType);
|
oaScalarNet* blockNet = oaScalarNet::create(block, scNetName, oacAnalogSigType);
|
||||||
if (net->isExternal()) {
|
if (net->isExternal()) {
|
||||||
oaTerm* term = oaTerm::create(blockNet, scNetName, getOATermType(net->getDirection()));
|
oaTerm* term = oaTerm::create(blockNet, scNetName, getOATermType(net->getDirection()));
|
||||||
oaPin* pin = oaPin::create(term);
|
oaPin* pin = oaPin::create(term);
|
||||||
oaTech* tech = oaTech::find(lib);
|
|
||||||
assert(tech);
|
|
||||||
Components externalComponents = NetExternalComponents::get(net);
|
Components externalComponents = NetExternalComponents::get(net);
|
||||||
for_each_component(component, externalComponents) {
|
for_each_component(component, externalComponents) {
|
||||||
oaBox box;
|
oaBox box;
|
||||||
getOABoxForBox(box, component->getBoundingBox());
|
getOABoxForBox(box, component->getBoundingBox());
|
||||||
oaRect* rect = oaRect::create(block, 0,
|
oaRect* rect = oaRect::create(block, 0,
|
||||||
oaPurpose::get(tech, oacDrawingPurposeType)->getNumber(),
|
oaPurpose::get(_oaTech, oacDrawingPurposeType)->getNumber(),
|
||||||
box);
|
box);
|
||||||
rect->addToPin(pin);
|
rect->addToPin(pin);
|
||||||
end_for;
|
end_for;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
cerr << "transformation of plug" << endl;
|
||||||
for_each_plug(plug, net->getPlugs()) {
|
for_each_plug(plug, net->getPlugs()) {
|
||||||
Instance* instance = plug->getInstance();
|
Instance* instance = plug->getInstance();
|
||||||
Instance2OAInstsMap::iterator it = _instance2OAInstMap.find(instance);
|
Instance2OAInstsMap::iterator it = _instance2OAInstMap.find(instance);
|
||||||
assert(it != _instance2OAInstMap.end());
|
assert(it != _instance2OAInstMap.end());
|
||||||
//oaModInst* modInst = it->second.first;
|
|
||||||
oaInst* blockInst = it->second;
|
oaInst* blockInst = it->second;
|
||||||
//oaModInstTerm* modInstTerm = getModInstTerm(modInst, plug);
|
|
||||||
oaInstTerm* instTerm = getInstTerm(blockInst, plug);
|
oaInstTerm* instTerm = getInstTerm(blockInst, plug);
|
||||||
//modInstTerm->addToNet(modNet);
|
assert(instTerm);
|
||||||
instTerm->addToNet(blockNet);
|
instTerm->addToNet(blockNet);
|
||||||
end_for;
|
end_for;
|
||||||
}
|
}
|
||||||
|
|
||||||
for_each_component(component, net->getComponents()) {
|
|
||||||
end_for;
|
|
||||||
}
|
|
||||||
end_for;
|
end_for;
|
||||||
}
|
}
|
||||||
|
|
||||||
_cell2OADesignMap[cell] = design;
|
_cell2OADesignMap[cell] = design;
|
||||||
return design;
|
return design;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace CRL {
|
namespace CRL {
|
||||||
|
void OpenAccessWrapper::oaDriver(const string& path, Cell* cell, unsigned int& saveState) {
|
||||||
void OpenAccessWrapper::oaLibLoader(const string& libPath, Library *lib, Catalog &catalog) {
|
|
||||||
cerr << "\nDummy OpenAccess lib loader call for " << libPath << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OpenAccessWrapper::oaDesignLoader(const string& path, Cell* cell) {
|
|
||||||
cerr << "\nDummy OpenAccess design loader call for " << path << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OpenAccessWrapper::oaDriver(const string& path, Cell* cell, unsigned int& saveState) {
|
|
||||||
#ifdef HAVE_OPENACCESS
|
#ifdef HAVE_OPENACCESS
|
||||||
//for the moment a driver for hurricaneAMS
|
//for the moment a driver for hurricaneAMS
|
||||||
//save the Cell and all used Cells
|
//save the Cell and all used Cells
|
||||||
cerr << "Saving " << cell << " in " << path << endl;
|
cerr << "Saving " << cell << " in " << path << endl;
|
||||||
try {
|
try {
|
||||||
|
oaDesignInit(
|
||||||
oaDesignInit(
|
|
||||||
oacAPIMajorRevNumber,
|
oacAPIMajorRevNumber,
|
||||||
oacAPIMinorRevNumber,
|
oacAPIMinorRevNumber,
|
||||||
oacDataModelRevNumber);
|
oacDataModelRevNumber);
|
||||||
|
|
||||||
Library* library = cell->getLibrary();
|
Library* library = cell->getLibrary();
|
||||||
string pathLib = path + "/" + getString(library->getName());
|
string pathLib = path + "/" + getString(library->getName());
|
||||||
|
|
||||||
const char* strPathLib = pathLib.c_str();
|
OADriver oaDriver(pathLib);
|
||||||
|
oaDesign* design = oaDriver.getOADesignForCell(cell);
|
||||||
// if (oaLib::exists(strPathLib)) {
|
if(design)
|
||||||
// throw Error("impossible to drive Cell, there is an existing OpenAccess db");
|
cerr << getDesignName(design) << endl;
|
||||||
// }
|
} catch (oaException &excp) {
|
||||||
|
cerr << "ERROR: " << excp.getMsg() << endl;
|
||||||
OADriver oaDriver(pathLib);
|
exit(1);
|
||||||
oaDesign* design = oaDriver.getOADesignForCell(cell);
|
}
|
||||||
|
|
||||||
} catch (oaException &excp) {
|
|
||||||
cerr << "ERROR: " << excp.getMsg() << endl;
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
cerr << "\nDummy OpenAccess driver call for " << path << endl;
|
cerr << "\nDummy OpenAccess driver call for " << path << endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// -*-compile-command:"cd ../../../../.. && make"-*-
|
||||||
|
// Time-stamp: "2010-06-29 11:55:46" - OpenAccessWrapper.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 |
|
||||||
|
@ -5,8 +7,12 @@
|
||||||
// | Author : Chistophe Alexandre |
|
// | Author : Chistophe Alexandre |
|
||||||
// | E-mail : Christophe.Alexandre@asim.lip6.fr |
|
// | E-mail : Christophe.Alexandre@asim.lip6.fr |
|
||||||
// x-----------------------------------------------------------------x
|
// x-----------------------------------------------------------------x
|
||||||
#ifndef __OPENACCESSWRAPPER_H
|
// | Author : Jean-Manuel Caba |
|
||||||
#define __OPENACCESSWRAPPER_H
|
// | E-mail : Jean-Manuel.Caba@asim.lip6.fr |
|
||||||
|
// x-----------------------------------------------------------------x
|
||||||
|
|
||||||
|
#ifndef __OPENACCESSWRAPPER_H__
|
||||||
|
#define __OPENACCESSWRAPPER_H__
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -17,16 +23,10 @@ namespace Hurricane {
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace CRL {
|
namespace CRL {
|
||||||
|
class OpenAccessWrapper {
|
||||||
class Catalog;
|
|
||||||
|
|
||||||
class OpenAccessWrapper {
|
|
||||||
public:
|
public:
|
||||||
static void oaLibLoader(const string& libPath, Hurricane::Library* lib, Catalog& catalog);
|
|
||||||
static void oaDesignLoader(const string& path, Hurricane::Cell* cell);
|
|
||||||
static void oaDriver(const string& cellPath, Cell* cell, unsigned int& saveState);
|
static void oaDriver(const string& cellPath, Cell* cell, unsigned int& saveState);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /*__OPENACCESSWRAPPER_H */
|
#endif /*__OPENACCESSWRAPPER_H__ */
|
||||||
|
|
|
@ -0,0 +1,397 @@
|
||||||
|
// x-----------------------------------------------------------------x
|
||||||
|
// | This file is part of the hurricaneAMS Software. |
|
||||||
|
// | Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved |
|
||||||
|
// | =============================================================== |
|
||||||
|
// | Author : Chistophe Alexandre |
|
||||||
|
// | E-mail : Christophe.Alexandre@asim.lip6.fr |
|
||||||
|
// x-----------------------------------------------------------------x
|
||||||
|
#ifdef HAVE_OPENACCESS
|
||||||
|
#include "oa/oaDesignDB.h"
|
||||||
|
using namespace oa;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "hurricane/DataBase.h"
|
||||||
|
#include "hurricane/Library.h"
|
||||||
|
#include "hurricane/Cell.h"
|
||||||
|
#include "hurricane/NetExternalComponents.h"
|
||||||
|
#include "hurricane/Segment.h"
|
||||||
|
#include "hurricane/Pad.h"
|
||||||
|
using namespace Hurricane;
|
||||||
|
|
||||||
|
#include "OpenAccessWrapper.h"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
#ifdef HAVE_OPENACCESS
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
oaModInstTerm* getModInstTerm(oaModInst* modInst, Plug* plug) {
|
||||||
|
oaNativeNS ns;
|
||||||
|
oaScalarName scPlugName(ns, getString(plug->getName()).c_str());
|
||||||
|
oaName instTermName(scPlugName);
|
||||||
|
oaModInstTerm* instTerm = oaModInstTerm::find(modInst, instTermName);
|
||||||
|
if (instTerm) {
|
||||||
|
return instTerm;
|
||||||
|
}
|
||||||
|
oaModule* masterModule = modInst->getMasterModule();
|
||||||
|
oaModTerm* modTerm = oaModTerm::find(masterModule, instTermName);
|
||||||
|
assert(modTerm);
|
||||||
|
oaModNet* modNet = oaModNet::find(masterModule, instTermName);
|
||||||
|
assert(modNet);
|
||||||
|
instTerm = oaModInstTerm::create(modNet, modInst, instTermName);
|
||||||
|
return instTerm;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
oaString getDesignName(oaDesign* design) {
|
||||||
|
oaNativeNS ns;
|
||||||
|
oaString libName, cellName, viewName;
|
||||||
|
design->getLibName(ns, libName);
|
||||||
|
design->getCellName(ns, cellName);
|
||||||
|
design->getViewName(ns, viewName);
|
||||||
|
oaString designName = "<" + libName + "," + cellName + "," + viewName + ">";
|
||||||
|
return designName;
|
||||||
|
}
|
||||||
|
|
||||||
|
void printBlockTerms(oaBlock* block) {
|
||||||
|
oaNativeNS ns;
|
||||||
|
oaDesign* design = block->getDesign();
|
||||||
|
cerr << " o Printing " << getDesignName(design) << " terms" << endl;
|
||||||
|
oaIter<oaTerm> termIter(block->getTerms());
|
||||||
|
while (oaTerm* term = termIter.getNext()) {
|
||||||
|
oaString termName;
|
||||||
|
term->getName(ns, termName);
|
||||||
|
cerr << " - " << termName << endl;
|
||||||
|
}
|
||||||
|
cerr << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
oaTermType getOATermType(const Net::Direction& direction) {
|
||||||
|
switch (direction) {
|
||||||
|
case Net::Direction::IN:
|
||||||
|
return oacInputTermType;
|
||||||
|
case Net::Direction::OUT:
|
||||||
|
return oacOutputTermType;
|
||||||
|
case Net::Direction::INOUT:
|
||||||
|
return oacInputOutputTermType;
|
||||||
|
case Net::Direction::TRISTATE:
|
||||||
|
return oacTristateTermType;
|
||||||
|
default:
|
||||||
|
throw Error("unrecognized direction");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
oaOrient getOAOrientFromOrientation(const Transformation::Orientation& orientation) {
|
||||||
|
cerr << orientation << endl;
|
||||||
|
switch (orientation) {
|
||||||
|
case Transformation::Orientation::ID:
|
||||||
|
return oacR0;
|
||||||
|
case Transformation::Orientation::R1:
|
||||||
|
return oacR90;
|
||||||
|
case Transformation::Orientation::R2:
|
||||||
|
return oacR180;
|
||||||
|
case Transformation::Orientation::R3:
|
||||||
|
return oacR270;
|
||||||
|
case Transformation::Orientation::MX:
|
||||||
|
return oacMX;
|
||||||
|
case Transformation::Orientation::XR:
|
||||||
|
return oacMXR90;
|
||||||
|
case Transformation::Orientation::MY:
|
||||||
|
return oacMY;
|
||||||
|
case Transformation::Orientation::YR:
|
||||||
|
return oacMYR90;
|
||||||
|
default:
|
||||||
|
throw Error("Unrecognized orientation");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void getOATransformFromTransformation(oaTransform& transform, const Transformation& transformation) {
|
||||||
|
transform.set(transformation.getTx(),
|
||||||
|
transformation.getTy(),
|
||||||
|
getOAOrientFromOrientation(transformation.getOrientation()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void getOABoxForBox(oaBox& box, const Box& hbox) {
|
||||||
|
box.set(hbox.getXMin(), hbox.getYMin(), hbox.getXMax(), hbox.getYMax());
|
||||||
|
}
|
||||||
|
|
||||||
|
oaInstTerm* getInstTerm(oaInst* inst, Plug* plug) {
|
||||||
|
oaNativeNS ns;
|
||||||
|
oaScalarName scPlugName(ns, getString(plug->getMasterNet()->getName()).c_str());
|
||||||
|
oaName instTermName(scPlugName);
|
||||||
|
oaInstTerm* instTerm = oaInstTerm::find(inst, instTermName);
|
||||||
|
if (instTerm) {
|
||||||
|
return instTerm;
|
||||||
|
}
|
||||||
|
oaDesign* design = inst->getMaster();
|
||||||
|
assert(design);
|
||||||
|
oaBlock* masterBlock = design->getTopBlock();
|
||||||
|
oaTerm* term = oaTerm::find(masterBlock, instTermName);
|
||||||
|
if (!term) {
|
||||||
|
cerr << "looking for " << plug->getName() << endl;
|
||||||
|
printBlockTerms(masterBlock);
|
||||||
|
}
|
||||||
|
assert(term);
|
||||||
|
instTerm = oaInstTerm::create(NULL, inst, term);
|
||||||
|
return instTerm;
|
||||||
|
}
|
||||||
|
|
||||||
|
class OADriver {
|
||||||
|
private:
|
||||||
|
typedef map<const Library*, oaLib*> Library2OALibMap;
|
||||||
|
typedef map<const Cell*, oaDesign*> Cell2OADesignMap;
|
||||||
|
typedef pair<oaModInst*, oaInst*> OAInstPair;
|
||||||
|
typedef map<Instance*, oaInst*> Instance2OAInstsMap;
|
||||||
|
|
||||||
|
string _path;
|
||||||
|
oaTech* _oaTech;
|
||||||
|
oaBlock* _oaBlock;
|
||||||
|
Library2OALibMap _library2OALibMap;
|
||||||
|
Cell2OADesignMap _cell2OADesignMap;
|
||||||
|
Instance2OAInstsMap _instance2OAInstMap;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
OADriver(const string& path):
|
||||||
|
_path(path),
|
||||||
|
_oaTech(NULL),
|
||||||
|
_oaBlock(NULL),
|
||||||
|
_library2OALibMap(),
|
||||||
|
_cell2OADesignMap(),
|
||||||
|
_instance2OAInstMap() {
|
||||||
|
DataBase* db = DataBase::getDB();
|
||||||
|
if (!db) {
|
||||||
|
throw Error("no database");
|
||||||
|
}
|
||||||
|
Technology* technology = db->getTechnology();
|
||||||
|
//createOATechForTechnology(technology);
|
||||||
|
}
|
||||||
|
|
||||||
|
~OADriver() {
|
||||||
|
cerr << "SAVING ALL" << endl;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
oaNativeNS ns;
|
||||||
|
string fullPath = _path + "/lib.defs";
|
||||||
|
oaScalarName scPath(ns, fullPath.c_str());
|
||||||
|
oaString strPath;
|
||||||
|
scPath.get(strPath);
|
||||||
|
oaLibDefList* libDefList = oaLibDefList::get(strPath, 'w');
|
||||||
|
#endif
|
||||||
|
|
||||||
|
for (Cell2OADesignMap::iterator it = _cell2OADesignMap.begin();
|
||||||
|
it != _cell2OADesignMap.end();
|
||||||
|
++it) {
|
||||||
|
cerr << it->first << endl;
|
||||||
|
oaDesign* design = it->second;
|
||||||
|
design->save();
|
||||||
|
design->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Library2OALibMap::iterator it = _library2OALibMap.begin();
|
||||||
|
it != _library2OALibMap.end();
|
||||||
|
++it) {
|
||||||
|
oaLib* lib = it->second;
|
||||||
|
#if 0
|
||||||
|
oaScalarName libName;
|
||||||
|
lib->getName(libName);
|
||||||
|
oaString libPath;
|
||||||
|
lib->getFullPath(libPath);
|
||||||
|
oaLibDef* libDef = oaLibDef::create(libDefList, libName, libPath);
|
||||||
|
#endif
|
||||||
|
lib->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
// libDefList->save();
|
||||||
|
cerr << "ALL SAVED" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
oaLib* getOALibForLibrary(const Library* library) {
|
||||||
|
Library2OALibMap::iterator it = _library2OALibMap.find(library);
|
||||||
|
if (it != _library2OALibMap.end()) {
|
||||||
|
return it->second;
|
||||||
|
}
|
||||||
|
oaNativeNS ns;
|
||||||
|
const char* strNameLib = getString(library->getName()).c_str();
|
||||||
|
if (!strcmp(strNameLib, ".")) {
|
||||||
|
strNameLib = "worklib";
|
||||||
|
}
|
||||||
|
string strPathLib = _path + '/' + strNameLib;
|
||||||
|
//cerr << "Creating new Library for Lib name="
|
||||||
|
// << strNameLib << " to filesystem path=" << strPathLib << endl;
|
||||||
|
oaScalarName scNameLib(ns, strNameLib);
|
||||||
|
cerr << "Creating new Library for Lib name="
|
||||||
|
<< strNameLib << " to filesystem path=" << strPathLib << endl;
|
||||||
|
oaLib* lib = oaLib::create(scNameLib, strPathLib.c_str(), oacSharedLibMode, "oaDMFileSys");
|
||||||
|
|
||||||
|
//oaScalarName libName;
|
||||||
|
//_oaTech->getLibName(libName);
|
||||||
|
//oaTech::attach(lib, libName);
|
||||||
|
//assert(oaTech::find(lib));
|
||||||
|
|
||||||
|
oaTech* oaTech = oaTech::create(lib);
|
||||||
|
oaTech->setDefaultManufacturingGrid(10);
|
||||||
|
oaTech->setDBUPerUU(oaViewType::get(oacMaskLayout), 1000);
|
||||||
|
|
||||||
|
oaLayer* drawingLayer = oaPhysicalLayer::create(oaTech, "drawing", 0);
|
||||||
|
|
||||||
|
_library2OALibMap[library] = lib;
|
||||||
|
|
||||||
|
return lib;
|
||||||
|
}
|
||||||
|
|
||||||
|
void createOATechForTechnology(const Technology* technology) {
|
||||||
|
string strPathLib = _path + "/techlib";
|
||||||
|
oaNativeNS ns;
|
||||||
|
oaScalarName scNameLib(ns, "techlib");
|
||||||
|
oaLib* lib = oaLib::create(scNameLib, strPathLib.c_str(), oacSharedLibMode, "oaDMFileSys");
|
||||||
|
_oaTech = oaTech::create(lib);
|
||||||
|
|
||||||
|
oaLayer* drawingLayer = oaPhysicalLayer::create(_oaTech, "drawing", 0);
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
for_each_layer(hlayer, technology->getLayers()) {
|
||||||
|
oaString strLayerName = getString(hlayer->getName()).c_str();
|
||||||
|
oaPhysicalLayer* layer = oaPhysicalLayer::create(techno, strLayerName, layerNum++);
|
||||||
|
end_for;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
lib->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
oaDesign* getOADesignForCell(const Cell* cell) {
|
||||||
|
cerr << "getOADesignForCell " << cell << endl;
|
||||||
|
Cell2OADesignMap::iterator it = _cell2OADesignMap.find(cell);
|
||||||
|
if (it != _cell2OADesignMap.end()) {
|
||||||
|
return it->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
oaNativeNS ns;
|
||||||
|
oaLib* lib = getOALibForLibrary(cell->getLibrary());
|
||||||
|
oaScalarName scNameDesign(ns, getString(cell->getName()).c_str());
|
||||||
|
oaScalarName scNameView(ns, "layout");
|
||||||
|
oaScalarName scNameLib;
|
||||||
|
lib->getName(scNameLib);
|
||||||
|
|
||||||
|
oaDesign* design = oaDesign::open(scNameLib, scNameDesign, scNameView, oaViewType::get(oacSchematic), 'w');
|
||||||
|
//oaModule* module = oaModule::create(design);
|
||||||
|
oaBlock* block = oaBlock::create(design);
|
||||||
|
oaTech* tech = oaTech::find(lib);
|
||||||
|
assert(tech);
|
||||||
|
oaBox box;
|
||||||
|
getOABoxForBox(box, cell->getAbutmentBox());
|
||||||
|
cerr << cell << " " << cell->getAbutmentBox() << endl;
|
||||||
|
oaRect::create(block, 0, oaPurpose::get(tech, oacDrawingPurposeType)->getNumber(), box);
|
||||||
|
|
||||||
|
for_each_instance(instance, cell->getInstances()) {
|
||||||
|
Cell* masterCell = instance->getMasterCell();
|
||||||
|
oaDesign* masterDesign = getOADesignForCell(masterCell);
|
||||||
|
oaScalarName scDesignName;
|
||||||
|
masterDesign->getCellName(scDesignName);
|
||||||
|
oaString strDesignName;
|
||||||
|
scDesignName.get(strDesignName);
|
||||||
|
//oaModule* masterModule = masterDesign->getTopModule();
|
||||||
|
//assert(masterModule);
|
||||||
|
oaScalarName scInstName(ns, getString(instance->getName()).c_str());
|
||||||
|
//oaModScalarInst* modInst = oaModScalarInst::create(masterModule, masterDesign, scInstName);
|
||||||
|
|
||||||
|
oaTransform transform;
|
||||||
|
getOATransformFromTransformation(transform, instance->getTransformation());
|
||||||
|
oaScalarInst* blockInst = oaScalarInst::create(block, masterDesign, scInstName, transform);
|
||||||
|
_instance2OAInstMap[instance] = blockInst;
|
||||||
|
end_for;
|
||||||
|
}
|
||||||
|
|
||||||
|
for_each_net(net, cell->getNets()) {
|
||||||
|
oaScalarName scNetName(ns, getString(net->getName()).c_str());
|
||||||
|
//oaModNet* modNet = oaModScalarNet::create(module, scNetName, oacAnalogSigType);
|
||||||
|
oaScalarNet* blockNet = oaScalarNet::create(block, scNetName, oacAnalogSigType);
|
||||||
|
if (net->isExternal()) {
|
||||||
|
oaTerm* term = oaTerm::create(blockNet, scNetName, getOATermType(net->getDirection()));
|
||||||
|
oaPin* pin = oaPin::create(term);
|
||||||
|
oaTech* tech = oaTech::find(lib);
|
||||||
|
assert(tech);
|
||||||
|
Components externalComponents = NetExternalComponents::get(net);
|
||||||
|
for_each_component(component, externalComponents) {
|
||||||
|
oaBox box;
|
||||||
|
getOABoxForBox(box, component->getBoundingBox());
|
||||||
|
oaRect* rect = oaRect::create(block, 0,
|
||||||
|
oaPurpose::get(tech, oacDrawingPurposeType)->getNumber(),
|
||||||
|
box);
|
||||||
|
rect->addToPin(pin);
|
||||||
|
end_for;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for_each_plug(plug, net->getPlugs()) {
|
||||||
|
Instance* instance = plug->getInstance();
|
||||||
|
Instance2OAInstsMap::iterator it = _instance2OAInstMap.find(instance);
|
||||||
|
assert(it != _instance2OAInstMap.end());
|
||||||
|
//oaModInst* modInst = it->second.first;
|
||||||
|
oaInst* blockInst = it->second;
|
||||||
|
//oaModInstTerm* modInstTerm = getModInstTerm(modInst, plug);
|
||||||
|
oaInstTerm* instTerm = getInstTerm(blockInst, plug);
|
||||||
|
//modInstTerm->addToNet(modNet);
|
||||||
|
instTerm->addToNet(blockNet);
|
||||||
|
end_for;
|
||||||
|
}
|
||||||
|
|
||||||
|
for_each_component(component, net->getComponents()) {
|
||||||
|
end_for;
|
||||||
|
}
|
||||||
|
end_for;
|
||||||
|
}
|
||||||
|
|
||||||
|
_cell2OADesignMap[cell] = design;
|
||||||
|
return design;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace CRL {
|
||||||
|
|
||||||
|
void OpenAccessWrapper::oaLibLoader(const string& libPath, Library *lib, Catalog &catalog) {
|
||||||
|
cerr << "\nDummy OpenAccess lib loader call for " << libPath << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OpenAccessWrapper::oaDesignLoader(const string& path, Cell* cell) {
|
||||||
|
cerr << "\nDummy OpenAccess design loader call for " << path << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OpenAccessWrapper::oaDriver(const string& path, Cell* cell, unsigned int& saveState) {
|
||||||
|
#ifdef HAVE_OPENACCESS
|
||||||
|
//for the moment a driver for hurricaneAMS
|
||||||
|
//save the Cell and all used Cells
|
||||||
|
cerr << "Saving " << cell << " in " << path << endl;
|
||||||
|
try {
|
||||||
|
|
||||||
|
oaDesignInit(
|
||||||
|
oacAPIMajorRevNumber,
|
||||||
|
oacAPIMinorRevNumber,
|
||||||
|
oacDataModelRevNumber);
|
||||||
|
|
||||||
|
Library* library = cell->getLibrary();
|
||||||
|
string pathLib = path + "/" + getString(library->getName());
|
||||||
|
|
||||||
|
const char* strPathLib = pathLib.c_str();
|
||||||
|
|
||||||
|
// if (oaLib::exists(strPathLib)) {
|
||||||
|
// throw Error("impossible to drive Cell, there is an existing OpenAccess db");
|
||||||
|
// }
|
||||||
|
|
||||||
|
OADriver oaDriver(pathLib);
|
||||||
|
oaDesign* design = oaDriver.getOADesignForCell(cell);
|
||||||
|
|
||||||
|
} catch (oaException &excp) {
|
||||||
|
cerr << "ERROR: " << excp.getMsg() << endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
cerr << "\nDummy OpenAccess driver call for " << path << endl;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
// x-----------------------------------------------------------------x
|
||||||
|
// | This file is part of the hurricaneAMS Software. |
|
||||||
|
// | Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved |
|
||||||
|
// | =============================================================== |
|
||||||
|
// | Author : Chistophe Alexandre |
|
||||||
|
// | E-mail : Christophe.Alexandre@asim.lip6.fr |
|
||||||
|
// x-----------------------------------------------------------------x
|
||||||
|
#ifndef __OPENACCESSWRAPPER_H
|
||||||
|
#define __OPENACCESSWRAPPER_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
namespace Hurricane {
|
||||||
|
class Library;
|
||||||
|
class Cell;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace CRL {
|
||||||
|
|
||||||
|
class Catalog;
|
||||||
|
|
||||||
|
class OpenAccessWrapper {
|
||||||
|
public:
|
||||||
|
static void oaLibLoader(const string& libPath, Hurricane::Library* lib, Catalog& catalog);
|
||||||
|
static void oaDesignLoader(const string& path, Hurricane::Cell* cell);
|
||||||
|
static void oaDriver(const string& cellPath, Cell* cell, unsigned int& saveState);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /*__OPENACCESSWRAPPER_H */
|
|
@ -0,0 +1,20 @@
|
||||||
|
PROJECT(testOAWrapper)
|
||||||
|
|
||||||
|
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.0)
|
||||||
|
|
||||||
|
SET(CMAKE_MODULE_PATH "$ENV{CORIOLIS_USER_TOP}/share/cmake/Modules/"
|
||||||
|
"$ENV{CORIOLIS_TOP}/share/cmake/Modules/"
|
||||||
|
"$ENV{IO_USER_TOP}/share/cmake/Modules/"
|
||||||
|
"$ENV{IO_TOP}/share/cmake/Modules/"
|
||||||
|
"$ENV{CHAMS_USER_TOP}/share/cmake/Modules/"
|
||||||
|
"$ENV{CHAMS_TOP}/share/cmake/Modules/")
|
||||||
|
|
||||||
|
FIND_PACKAGE(HURRICANE REQUIRED)
|
||||||
|
FIND_PACKAGE(CORIOLIS REQUIRED)
|
||||||
|
FIND_PACKAGE(VLSISAPD REQUIRED)
|
||||||
|
FIND_PACKAGE(HURRICANEAMS REQUIRED)
|
||||||
|
FIND_PACKAGE(AMSCORE REQUIRED)
|
||||||
|
FIND_PACKAGE(LibXml2 REQUIRED)
|
||||||
|
FIND_PACKAGE(PythonLibs REQUIRED)
|
||||||
|
|
||||||
|
ADD_SUBDIRECTORY(src)
|
|
@ -0,0 +1,10 @@
|
||||||
|
|
||||||
|
|
||||||
|
all:
|
||||||
|
./compile.sh
|
||||||
|
|
||||||
|
run:
|
||||||
|
cd x86_64/usr/local/bin && ./testOAWrapper /asim/chams/etc/chams/config.freePDK45.xml
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf x86_64
|
|
@ -0,0 +1,14 @@
|
||||||
|
#!/bin/bash
|
||||||
|
ARCH=`uname -m`
|
||||||
|
|
||||||
|
if [ ! -e "./compile.sh" ]; then
|
||||||
|
echo "You must run compile.sh in its own direcotry : ./compile.sh"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d "$ARCH/build" ]; then
|
||||||
|
echo "Creating build directory"
|
||||||
|
mkdir -p $ARCH/build
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd $ARCH/build && cmake ../.. && make DESTDIR=.. -j2 install
|
|
@ -0,0 +1,24 @@
|
||||||
|
|
||||||
|
INCLUDE_DIRECTORIES ( ${HURRICANE_INCLUDE_DIR}
|
||||||
|
${CORIOLIS_INCLUDE_DIR}
|
||||||
|
${HURRICANEAMS_INCLUDE_DIR}
|
||||||
|
${HURRICANEAMS_GRAPHICAL_INCLUDE_DIR}
|
||||||
|
${AMSCORE_INCLUDE_DIR}
|
||||||
|
${SCHEMATIC_SOURCE_DIR}/src
|
||||||
|
)
|
||||||
|
|
||||||
|
SET ( CPPS main.cpp )
|
||||||
|
|
||||||
|
SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
|
||||||
|
ADD_EXECUTABLE(testOAWrapper ${QRCS_SRCS} ${MOCS} ${CPPS} ${QRCS})
|
||||||
|
TARGET_LINK_LIBRARIES(testOAWrapper ${HURRICANE_LIBRARIES}
|
||||||
|
${HURRICANE_PYTHON_LIBRARIES}
|
||||||
|
${OPENCHAMS_LIBRARY}
|
||||||
|
${CIF_LIBRARY}
|
||||||
|
${AGDS_LIBRARY}
|
||||||
|
${CORIOLIS_LIBRARIES}
|
||||||
|
${HURRICANEAMS_LIBRARIES}
|
||||||
|
${AMSCORE_LIBRARIES}
|
||||||
|
${OA_LIBRARIES} )
|
||||||
|
INSTALL(TARGETS testOAWrapper DESTINATION bin)
|
||||||
|
|
|
@ -0,0 +1,88 @@
|
||||||
|
// -*-compile-command:"cd .. && make"-*-
|
||||||
|
// x-----------------------------------------------------------------x
|
||||||
|
// | This file is part of |
|
||||||
|
// | Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved |
|
||||||
|
// | =============================================================== |
|
||||||
|
// | Author : Jean-Manuel Caba |
|
||||||
|
// | E-mail : Jean-Manuel.Caba@asim.lip6.fr |
|
||||||
|
// x-----------------------------------------------------------------x
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
#include "hurricane/Cell.h"
|
||||||
|
#include "hurricane/Library.h"
|
||||||
|
#include "hurricane/DataBase.h"
|
||||||
|
|
||||||
|
using namespace Hurricane;
|
||||||
|
|
||||||
|
#include "crlcore/Catalog.h"
|
||||||
|
#include "crlcore/AllianceFramework.h"
|
||||||
|
|
||||||
|
#include "hurricaneAMS/environment/AnalogEnv.h"
|
||||||
|
#include "hurricaneAMS/devices/SimpleCurrentMirror.h"
|
||||||
|
|
||||||
|
#include "crlcore/GdsDriver.h"
|
||||||
|
#include "crlcore/OADriver.h"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
static string designName = "design";
|
||||||
|
static string libName = "WorkLibrary";
|
||||||
|
};
|
||||||
|
|
||||||
|
void testCell(Cell* dev){
|
||||||
|
if(dev)
|
||||||
|
cout << "Cell created" << endl;
|
||||||
|
|
||||||
|
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;
|
||||||
|
DataBase* db = DataBase::getDB();
|
||||||
|
assert(db != NULL);
|
||||||
|
Library* rootLib = db->getRootLibrary();
|
||||||
|
if(!rootLib){
|
||||||
|
Library::create(db, "RootLibrary");
|
||||||
|
rootLib = db->getRootLibrary();
|
||||||
|
}
|
||||||
|
assert(rootLib != NULL);
|
||||||
|
|
||||||
|
Library* workLibrary = rootLib->getLibrary(libName);
|
||||||
|
if(!workLibrary)
|
||||||
|
workLibrary = Library::create(rootLib, libName);
|
||||||
|
assert(workLibrary != NULL);
|
||||||
|
|
||||||
|
Cell* design = workLibrary->getCell(designName);
|
||||||
|
if(!design)
|
||||||
|
design = Cell::create(workLibrary, designName);
|
||||||
|
assert(design != NULL);
|
||||||
|
|
||||||
|
cout << "creating cell myCM" << endl;
|
||||||
|
|
||||||
|
bool bulkConnected = true;//bulk connected to source
|
||||||
|
Cell* dev = SimpleCurrentMirror::create(workLibrary, Name("myCM"),
|
||||||
|
TransistorFamily::NMOS,
|
||||||
|
bulkConnected);
|
||||||
|
|
||||||
|
cout << "testing cell myCM" << endl;
|
||||||
|
|
||||||
|
testCell(dev);
|
||||||
|
|
||||||
|
// cout << "creating and testing cell from sxlib inv_x1" << endl;
|
||||||
|
|
||||||
|
// testCell(CRL::AllianceFramework::get()->getCell( "inv_x1", CRL::Catalog::State::Views ));
|
||||||
|
|
||||||
|
cout << "ending normally" << endl;
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue