cleaning ...

This commit is contained in:
Jean-Manuel Caba 2010-08-05 23:58:15 +00:00
parent 9505e8779a
commit a9a9bc2a20
4 changed files with 712 additions and 868 deletions

View File

@ -1,5 +1,5 @@
// -*-compile-command:"cd ../../../../.. && make"-*-
// Time-stamp: "2010-07-26 16:16:41" - OpenAccess.h
// Time-stamp: "2010-08-05 20:13:03" - OpenAccess.h
// x-----------------------------------------------------------------x
// | This file is part of the hurricaneAMS Software. |
// | Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved |
@ -21,22 +21,12 @@ namespace Hurricane {
class Cell;
}
#ifdef HAVE_OPENACCESS
#include "oa/oaDesignDB.h"
using namespace oa;
#else
namespace oa {
class oaCell;
class oaLib;
}
#endif
namespace CRL {
class OpenAccess {
public:
static Hurricane::Cell* oaCellParser(oa::oaCell* cell);
static Hurricane::Library* oaLibParser(oa::oaLib* lib);
static oa::oaCell* oaDriver(const std::string& libPath, Hurricane::Cell* cell);
static void oaDriver(const std::string& libPath, Hurricane::Cell* cell);
static Hurricane::Cell* oaCellParser(const std::string& libPath,
const std::string& libName, const std::string& cellName);
};
}//namespace CRL

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
// -*-compile-command:"cd ../../../../.. && make"-*-
// Time-stamp: "2010-08-04 16:57:08" - OpenAccessDriver.cpp
// Time-stamp: "2010-08-06 01:22:51" - OpenAccessDriver.cpp
// x-----------------------------------------------------------------x
// | This file is part of the hurricaneAMS Software. |
// | Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved |
@ -32,7 +32,7 @@ using namespace Hurricane;
#include "OpenAccessCommon.h"
namespace {
using namespace CRL_OA;
#ifdef HAVE_OPENACCESS
/**
@ -89,7 +89,7 @@ namespace {
if (!_technology) {
throw Error("no technology");
}
realPath(_path);
oaFuncs::realPath(_path);
cerr << "realpath: " << _path << endl;
}
@ -97,13 +97,13 @@ namespace {
cerr << "SAVING ALL" << endl;
_oaTech->save();
_oaTech->close();
saveDesignsInMap(_cell2OADesign4Netlist);
oaFuncs::saveOADesignsInMap(_cell2OADesign4Netlist);
_cell2OADesign4Netlist.clear();
saveDesignsInMap(_cell2OADesign4Schematic);
oaFuncs::saveOADesignsInMap(_cell2OADesign4Schematic);
_cell2OADesign4Schematic.clear();
saveDesignsInMap(_cell2OADesign4Symbolic);
oaFuncs::saveOADesignsInMap(_cell2OADesign4Symbolic);
_cell2OADesign4Symbolic.clear();
saveDesignsInMap(_cell2OADesign4Layout);
oaFuncs::saveOADesignsInMap(_cell2OADesign4Layout);
_cell2OADesign4Layout.clear();
for (Library2OALibMap::iterator it = _library2OALib.begin();
it != _library2OALib.end();
@ -128,9 +128,9 @@ namespace {
// 1) create or open library
cerr << "lib path : " << _path << endl;
pair<oaScalarName,string> infos=libInfos(_path,
getString(library->getName()));
oaLib *lib = openOALib(infos);
pair<oaScalarName,string> infos = oaFuncs::libInfos(_path,
getString(library->getName()));
oaLib *lib = oaFuncs::openOALib(infos);
_library2OALib[library] = lib;
#if 0
@ -147,7 +147,7 @@ namespace {
}
#endif
// 4) create, update library list file
createCDS(infos,_path);
oaFuncs::createCDS(infos,_path);
infos.second.clear();
return lib;
@ -203,7 +203,7 @@ namespace {
}
BasicLayer* bLayer = dynamic_cast<BasicLayer*>(layer);
aOALayer = oaPhysicalLayer::create(theOATech, layerName, generateLayerID(bLayer),
bLayer ? getOAMaterial(bLayer->getMaterial())
bLayer ? oaFuncs::getOAMaterialFromMaterial(bLayer->getMaterial())
: oaMaterial(oacOtherMaterial));
assert(aOALayer);
@ -345,7 +345,7 @@ namespace {
cerr << "STD:" << e.what() << endl;
exit(-1);
}
printOALayers(theOATech);
oaFuncs::printOALayers(theOATech);
return theOATech;
}
@ -379,8 +379,7 @@ namespace {
oaScalarInst* blockInst = oaScalarInst::find(topBlock,
scInstName);
if(!blockInst){
oaTransform transform;
getOATransformFromTransformation(transform, instance->getTransformation());
oaTransform transform = oaFuncs::getOATransformFromTransformation(instance->getTransformation());
blockInst = oaScalarInst::create(topBlock, masterDesign, scInstName, transform);
}
_instance2OAInst[instance] = blockInst;
@ -399,7 +398,7 @@ namespace {
Instance2OAInstsMap::iterator it = _instance2OAInst.find(instance);
assert(it != _instance2OAInst.end());
oaInst* blockInst = it->second;
oaInstTerm* instTerm = getInstTerm(blockInst, plug,net);
oaInstTerm* instTerm = oaFuncs::getOAInstTermFromOAInst(blockInst, plug,net);
assert(instTerm);
return instTerm;
}
@ -423,8 +422,7 @@ namespace {
cerr << "getOARectFromComponent" << endl;
assert(component);
assert(topBlock);
oaBox box;
getOABoxForBox(box, component->getBoundingBox());
oaBox box = oaFuncs::getOABoxFromBox(component->getBoundingBox());
Layer* layer = (Layer*) component->getLayer();
assert(layer);
oaPhysicalLayer* physLayer = getOALayerFromLayer(layer,_oaTech);
@ -451,15 +449,15 @@ namespace {
if(blockNet)
return blockNet;
assert(!blockNet);
blockNet = oaScalarNet::create(topBlock, scNetName, getOASigType(net->getType()));
blockNet = oaScalarNet::create(topBlock, scNetName, oaFuncs::getOASigTypeFromNetType(net->getType()));
assert(blockNet);
oaScalarTerm::create(blockNet, scNetName, getOATermType(net->getDirection()));
oaScalarTerm::create(blockNet, scNetName, oaFuncs::getOATermTypeFromNetDirection(net->getDirection()));
if (net->isExternal()) {
oaPin* pin = getOAPinFromNet(net,blockNet);
Components externalComponents = NetExternalComponents::get(net);
for_each_component(component, externalComponents) {
oaRect* rect = getOARectFromComponent(component,topBlock);
// rect->addToPin(pin);
rect->addToPin(pin);
end_for;
}
}
@ -651,6 +649,9 @@ namespace {
getOARectFromSlice(slice,topBlock);
end_for;
}
//get and update boundingBox
oaBox boundingBox;
topBlock->getBBox(boundingBox);
return designCellView;
}
@ -670,25 +671,25 @@ namespace {
oaDesign* netlistView = createOAasNetlist(cell);
assert(netlistView);
oaCell* c1 = OADesignToOACell(netlistView);
oaCell* c1 = oaFuncs::getOACellFromOADesign(netlistView);
assert(c1);
oaDesign* symbolicView = addSymbol(cell,netlistView);
assert(symbolicView);
oaCell* c2 = OADesignToOACell(symbolicView);
oaCell* c2 = oaFuncs::getOACellFromOADesign(symbolicView);
assert(c2);
oaDesign* schematicView = addSchematic(cell,symbolicView);
assert(schematicView);
oaCell* c3 = OADesignToOACell(schematicView);
oaCell* c3 = oaFuncs::getOACellFromOADesign(schematicView);
assert(c3);
oaDesign* layoutView = addLayout(cell,schematicView);
assert(layoutView);
oaCell* c4 = OADesignToOACell(layoutView);
oaCell* c4 = oaFuncs::getOACellFromOADesign(layoutView);
assert(c4);
//3) we check it's the same oaCell for all designs
@ -698,14 +699,14 @@ namespace {
}
oaCell* getOACellForCell(const Cell* cell) {
return OADesignToOACell( getOADesignForCell(cell) );
return oaFuncs::getOACellFromOADesign( getOADesignForCell(cell) );
}
};//OADriver class
#endif
}//namespace
}//namespace CRL_OA
namespace CRL {
oaCell* OpenAccess::oaDriver(const string& path, Cell* cell) {
void OpenAccess::oaDriver(const string& path, Cell* cell) {
oaCell* convertedCell = NULL;
#ifdef HAVE_OPENACCESS
//for the moment a driver for hurricaneAMS
@ -715,7 +716,7 @@ namespace CRL {
oaDesignInit(oacAPIMajorRevNumber,
oacAPIMinorRevNumber,
oacDataModelRevNumber);
OADriver oaDriver(path);
convertedCell = oaDriver.getOACellForCell(cell);
}catch (oaException &e) {
@ -728,6 +729,6 @@ namespace CRL {
#else
cerr << "\nDummy OpenAccess driver call for " << path << endl;
#endif
return convertedCell;
return;
}
}

View File

@ -1,5 +1,5 @@
// -*-compile-command:"cd ../../../../.. && make"-*-
// Time-stamp: "2010-08-04 15:45:06" - OpenAccessParser.cpp
// Time-stamp: "2010-08-06 01:40:58" - OpenAccessParser.cpp
// x-----------------------------------------------------------------x
// | This file is part of the hurricaneAMS Software. |
// | Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved |
@ -28,7 +28,7 @@ using namespace Hurricane;
#include "OpenAccessCommon.h"
namespace {
using namespace CRL_OA;
#ifdef HAVE_OPENACCESS
class OAParser{
private:
@ -77,7 +77,7 @@ namespace {
return NULL;
}
Name cellName(cellNameStr);
Cell* cell = findCellInLibraries(getOADesignLibraries(), cellName);
Cell* cell = oaFuncs::findCellInLibraries(oaFuncs::getOADesignLibraries(), cellName);
if (!cell) {
return NULL;
}
@ -96,22 +96,27 @@ namespace {
return cell;
}
void loadOALib(const string& libNameStr, const string& libPathStr, bool asDesignLibrary) {
/**
heart of the parser algorithm
*/
oaLib* loadOALib(const string& libNameStr, const string& libPathStr, bool asDesignLibrary) {
oaNativeNS oaNS;
oaString libNameOAStr(libNameStr.c_str());
oaScalarName libOAName(oaNS, libNameOAStr);
Name libName(libNameStr);
Name2LibMap::const_iterator nit = _name2LibMap.find(libName);
if (nit != _name2LibMap.end()) {
Library* library = nit->second;
//verify that it's the same library : name and path
cerr << "already loaded" << endl;
return;
return oaLib::find(libOAName);
}
oaNativeNS oaNS;
oaString libNameOAStr(libNameStr.c_str());
oaScalarName libOAName(oaNS, libNameOAStr);
oaLib* oaLibrary = NULL;
try {
oaLib* oaLibrary = oaLib::open(libOAName, libPathStr.c_str());
oaLibrary = oaLib::open(libOAName, libPathStr.c_str());
if (oaLibrary->isReadable()) {
if (!oaLibrary->getAccess(oacReadLibAccess)) {
cout << "\n***Quitting. Cannot get LibAccess\n" ;
@ -127,16 +132,16 @@ namespace {
cerr << "No DataBase" << endl;
exit(8);
}
if (findLibraryByNameInDB(db, libraryName)) {
if (oaFuncs::findLibraryByNameInDB(db, libraryName)) {
cerr << "ERROR" << endl;
exit(8);
}
Library* library;
if (asDesignLibrary) {
library = Library::create(getOADesignLibraries(), Name(libNameStr));
library = Library::create(oaFuncs::getOADesignLibraries(), Name(libNameStr));
} else {
library = Library::create(getOACellLibraries(), Name(libNameStr));
library = Library::create(oaFuncs::getOACellLibraries(), Name(libNameStr));
}
cerr << library << endl;
@ -151,7 +156,7 @@ namespace {
cerr << cellNameString << endl;
oaDesign* cellDesign = openDesign(oaNS, cell);
oaDesign* cellDesign = oaFuncs::openOADesign(cell);
if (cellDesign != NULL) {
Cell* hCell = NULL;
//logic part
@ -288,9 +293,12 @@ namespace {
cout << "ERROR: " << excp.getMsg() << endl;
exit(1);
}
return oaLibrary;
}
/**
heart of the parser algorithm
*/
void oaTechnology2Technology(oaLib* oaLibrary) {
try {
oaTech* tech = oaTech::open(oaLibrary);
@ -338,29 +346,182 @@ namespace {
}
void getDesigns(set<Cell*>& designCellSet) {
getAllCells(getOADesignLibraries(), designCellSet);
oaFuncs::getAllCells(oaFuncs::getOADesignLibraries(), designCellSet);
}
/**
heart of the parser algorithm
*/
static void loadOACellInCell(oaCell* oa_Cell, Cell* cell) {
oaNativeNS oaNS;
oaDesign* cellDesign = oaFuncs::openOADesign(oa_Cell);
if (cellDesign != NULL) {
oaModule* module = cellDesign->getTopModule();
oaCollection<oaModInst, oaModule> oaModInsts = module->getInsts();
oaIter<oaModInst> modInstIter(oaModInsts);
while (oaModInst* modInst = modInstIter.getNext()) {
oaString oaModInstStr;
modInst->getName(oaNS, oaModInstStr);
//cerr << "inst : " << oaModInstStr << endl;
oaModule* masterModule = modInst->getMasterModule();
if (masterModule) {
oaString oaModuleStr;
masterModule->getName(oaNS, oaModuleStr);
//cerr << "master : " << oaModuleStr << endl;
//find hurricane Cell
Cell* masterCell = oaFuncs::findCellInLibraries(oaFuncs::getRootLibrary(), Name(oaModuleStr));
if (!masterCell) {
cout << "\n***Quitting. Cannot get MasterCell :" ;
cout << oaModuleStr << endl;
exit(8);
}
Instance* instance = Instance::create(cell, Name(oaModInstStr) ,masterCell);
//cerr << instance << endl;
} else {
cerr << "master : NULL" << endl;
}
}//end while
//now treat nets
oaCollection<oaModNet, oaModule> oaModNets = module->getNets();
oaIter<oaModNet> oaModNetIter(oaModNets);
while (oaModNet* oa_ModNet = oaModNetIter.getNext()) {
oaString oaModNetStr;
oa_ModNet->getName(oaNS, oaModNetStr);
//cerr << oaModNetStr << endl;
Net* net = cell->getNet(Name(oaModNetStr));
if (!net) {
net = Net::create(cell, Name(oaModNetStr));
}
oaCollection<oaModInstTerm, oaModNet> oaModInstTerms = oa_ModNet->getInstTerms();
oaIter<oaModInstTerm> oaModInstTermIter(oaModInstTerms);
while (oaModInstTerm* oa_ModInstTerm = oaModInstTermIter.getNext()) {
oaModInst* modInst = oa_ModInstTerm->getInst();
oaString oaModInstStr;
modInst->getName(oaNS, oaModInstStr);
//find hurricane instance
Instance* instance = cell->getInstance(Name(oaModInstStr));
if (!instance) {
cout << "\n***Quitting. Cannot get Instance :" ;
cout << oaModInstStr << endl;
exit(8);
}
oaModTerm* oa_ModTerm = oa_ModInstTerm->getTerm();
oaString oaModTermStr;
oa_ModTerm->getName(oaNS, oaModTermStr);
Net* masterNet = instance->getMasterCell()->getNet(Name(oaModTermStr));
if (!masterNet) {
cout << "\n***Quitting. Cannot get Master Net :" ;
cout << oaModTermStr << endl;
exit(8);
}
Plug* plug = instance->getPlug(masterNet);
plug->setNet(net);
//cerr << plug << endl;
}
//cerr << net << endl;
}
oaScalarName cellName;
oa_Cell->getName(cellName);
oaString cellNameString;
cellName.get(cellNameString);
cell->setName(Name(cellNameString));
cell->setTerminal(false);
//physical part
oaBlock* block = cellDesign->getTopBlock();
if (block) {
oaBox oa_box;
block->getBBox(oa_box);
Point lowerLeft(DbU::db(oa_box.lowerLeft().x()), DbU::db(oa_box.lowerLeft().y()));
Point upperRight(DbU::db(oa_box.upperRight().x()), DbU::db(oa_box.upperRight().y()));
cell->setAbutmentBox(Box(lowerLeft, upperRight));
oaCollection<oaInst, oaBlock> oaInsts = block->getInsts();
oaIter<oaInst> oaInstIter(oaInsts);
while (oaInst* oa_Inst = oaInstIter.getNext()) {
oaString oaInstStr;
oa_Inst->getName(oaNS, oaInstStr);
Instance* instance = cell->getInstance(Name(oaInstStr));
if (instance) {
//cerr << "found " << instance << endl;
oaPlacementStatus placementStatus= oa_Inst->getPlacementStatus();
switch (placementStatus) {
case oacNonePlacementStatus :
cerr << " none" << endl;
break;
case oacUnplacedPlacementStatus :
cerr << " unplaced" << endl;
break;
case oacPlacedPlacementStatus :
cerr << " placed" << endl;
break;
case oacFixedPlacementStatus :
cerr << " fixed" << endl;
break;
default :
cerr << "other" << endl;
}
oaPoint instOrigin;
oa_Inst->getOrigin(instOrigin);
cerr << instOrigin.x() << " " << instOrigin.y() << endl;
} else {
cerr << "cannot find " << oaInstStr << endl;
}
}
oaSitePattern sitePattern;
block->getSitePattern(sitePattern);
for (int i = 0; i < sitePattern.getNumElements(); i++) {
const oaSiteRef& siteRef = sitePattern.get(i);
cerr << "site : " << siteRef.siteName() << endl;
}
oaCollection<oaRow, oaBlock> oaRows = block->getRows();
oaIter<oaRow> oaRowIter(oaRows);
while (oaRow* oa_Row = oaRowIter.getNext()) {
cerr << "row" << endl;
oaString siteName;
oa_Row->getSiteDefName(siteName);
cerr << siteName << endl;
}
oaCollection<oaAreaBoundary, oaBlock> oaAreaBoundaries = block->getBoundaries();
oaIter<oaBoundary> oaBoundaryIter(oaAreaBoundaries);
while (oaBoundary* oa_Boundary = oaBoundaryIter.getNext()) {
cerr << "boundary" << endl;
}
} else {
cerr << "no block view " << endl;
}
}//end if (cellDesign != NULL)
}//end loadOACellInCell
};//OAParser class
#endif
}//namespace
using namespace oa;
namespace CRL {
Cell* OpenAccess::oaCellParser(oaCell* cell){
Cell* OpenAccess::oaCellParser(const std::string& libPath,
const std::string& libName, const std::string& cellName) {
Cell* convertedCell = NULL;
if(!cell)
return NULL;
#ifdef HAVE_OPENACCESS
try {
oaDesignInit(oacAPIMajorRevNumber,
oacAPIMinorRevNumber,
oacDataModelRevNumber);
OAParser oaParser;
oaScalarName scalarCellName;
oaString cellName;
cell->getName(scalarCellName);
convertedCell = oaParser.getCell(static_cast<const char*>(cellName));
oaScalarName scalarCellName(oaNativeNS(),cellName.c_str());
oaLib* oaLibrary = oaParser.loadOALib(libName, libPath, true);
Cell* hcell = oaParser.getCell(cellName);
oaCell* cell = oaCell::find(oaLibrary,scalarCellName);
oaParser.loadOACellInCell(cell,hcell);
}catch (oaException &e) {
cerr << "OA::ERROR => " << e.getMsg() << endl;
exit(1);
@ -373,14 +534,5 @@ namespace CRL {
#endif
return convertedCell;
}
Library* OpenAccess::oaLibParser(oaLib* lib){
#ifdef HAVE_OPENACCESS
cerr << "\nto implement ... " << endl;
#else
cerr << "\nDummy OpenAccess driver call for " << path << endl;
#endif
return NULL;
}
}