+ correct parser to handle tech in another lib than the cell (for example with a tech from a kit in one lib and the developer designs in an other lib )

This commit is contained in:
Jean-Manuel Caba 2010-08-12 22:30:57 +00:00
parent fb81cfce94
commit c261412fc8
8 changed files with 159 additions and 92 deletions

View File

@ -9,17 +9,19 @@ 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& filePath) {
CRL::OpenAccess::oaDriver(filePath, _cell); CRL::OpenAccess::oaDriver(filePath, _cell);
} }
OAParser::OAParser(const std::string& libPath,const std::string& libName) OAParser::OAParser(const std::string& cellLibPath,const std::string& cellLibName,
: _libPath(libPath), _libName(libName) {} const std::string& techLibPath,const std::string& techLibName)
: _cellLibPath(cellLibPath), _cellLibName(cellLibName),
_techLibPath(techLibPath), _techLibName(techLibName) {}
Cell* OAParser::open(const std::string& cellName) { Cell* OAParser::open(const std::string& cellName) {
return CRL::OpenAccess::oaCellParser(_libPath, return CRL::OpenAccess::oaCellParser(_cellLibPath, _cellLibName, cellName,
_libName, cellName); _techLibPath,_techLibName);
} }
}// namespace CRL }// namespace CRL

View File

@ -12,10 +12,13 @@ namespace Hurricane {
namespace CRL { namespace CRL {
class OAParser { class OAParser {
private: private:
std::string _libPath; std::string _cellLibPath;
std::string _libName; std::string _cellLibName;
std::string _techLibPath;
std::string _techLibName;
public: public:
OAParser(const std::string& libPath,const std::string& libName); OAParser(const std::string& cellLibPath, const std::string& cellLibName,
const std::string& techLibPath,const std::string& techLibName);
Hurricane::Cell* open(const std::string& cellName); Hurricane::Cell* open(const std::string& cellName);
}; };
} // End of CRL namespace. } // End of CRL namespace.

View File

@ -1,5 +1,5 @@
// -*-compile-command:"cd ../../../../.. && make"-*- // -*-compile-command:"cd ../../../../.. && make"-*-
// Time-stamp: "2010-08-12 13:50:46" - OpenAccess.h // Time-stamp: "2010-08-12 19:28:37" - 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 |
@ -25,8 +25,8 @@ namespace CRL {
class OpenAccess { class OpenAccess {
public: public:
static void 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, static Hurricane::Cell* oaCellParser(const std::string& cellLibPath, const std::string& cellLibName, const std::string& cellName,
const std::string& libName, const std::string& cellName); const std::string& techLibPath, const std::string& techLibName);
}; };
}//namespace CRL }//namespace CRL

View File

@ -1,5 +1,5 @@
// -*-compile-command:"cd ../../../../.. && make"-*- // -*-compile-command:"cd ../../../../.. && make"-*-
// Time-stamp: "2010-08-11 01:22:02" - OpenAccessCommon.h // Time-stamp: "2010-08-12 23:50:52" - 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 |

View File

@ -1,5 +1,5 @@
// -*-compile-command:"cd ../../../../.. && make"-*- // -*-compile-command:"cd ../../../../.. && make"-*-
// Time-stamp: "2010-08-12 15:01:27" - OpenAccessDriver.cpp // Time-stamp: "2010-08-12 20:20:45" - 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 |
@ -45,6 +45,8 @@ namespace {
typedef map<const Cell*, oaCell*> Cell2OACellMap; typedef map<const Cell*, oaCell*> Cell2OACellMap;
typedef map<Instance*, oaInst*> Instance2OAInstsMap; typedef map<Instance*, oaInst*> Instance2OAInstsMap;
typedef map<Layer*, oaPhysicalLayer*> Layer2OAPhysicalLayerMap; typedef map<Layer*, oaPhysicalLayer*> Layer2OAPhysicalLayerMap;
typedef map<Pad*, oaRect*> Pad2OARectMap;
typedef map<Component*, oaPathSeg*> Component2OAPathSegMap;
string _path; string _path;
oaTech* _oaTech; oaTech* _oaTech;
@ -56,6 +58,8 @@ namespace {
Cell2OACellMap _cell2OAcell; Cell2OACellMap _cell2OAcell;
Instance2OAInstsMap _instance2OAInst; Instance2OAInstsMap _instance2OAInst;
Layer2OAPhysicalLayerMap _layer2OAPhysicalLayer; Layer2OAPhysicalLayerMap _layer2OAPhysicalLayer;
Pad2OARectMap _pad2OARect;
Component2OAPathSegMap _component2OAPathSeg;
set<int> _layerIDS; set<int> _layerIDS;
int _layerID; int _layerID;
oaLayer* _layerDev; oaLayer* _layerDev;
@ -76,6 +80,8 @@ namespace {
_cell2OAcell(), _cell2OAcell(),
_instance2OAInst(), _instance2OAInst(),
_layer2OAPhysicalLayer(), _layer2OAPhysicalLayer(),
_pad2OARect(),
_component2OAPathSeg(),
_layerIDS(), _layerIDS(),
_layerID(0), _layerID(0),
_layerDev(NULL), _layerDev(NULL),
@ -459,9 +465,7 @@ namespace {
assert(it != _instance2OAInst.end()); assert(it != _instance2OAInst.end());
oaInst* blockInst = it->second; oaInst* blockInst = it->second;
oaNativeNS ns; oaName instTermName(toOAName( getString(plug->getMasterNet()->getName()) ));
oaScalarName scPlugName(ns, getString(plug->getMasterNet()->getName()).c_str());
oaName instTermName(scPlugName);
oaInstTerm* instTerm = oaInstTerm::find(blockInst, instTermName); oaInstTerm* instTerm = oaInstTerm::find(blockInst, instTermName);
if (instTerm) if (instTerm)
return instTerm; return instTerm;
@ -481,22 +485,19 @@ namespace {
return instTerm; return instTerm;
} }
/** static oaName toOAName(const Name& n){
create a Pin for an external net
the net is supposed to be external
*/
oaPin* toOAPin(Net* net,oaNet* blockNet){
cerr << "toOAPin" << endl;
assert(net);
assert(net->isExternal());
assert(blockNet);
oaNativeNS ns; oaNativeNS ns;
oaScalarName scNetName(ns, getString(net->getName()).c_str()); oaScalarName scN(ns, getString(n).c_str());
oaTerm* term = oaTerm::find(blockNet->getBlock(), scNetName); return oaName(scN);
assert(term); }
oaPin* pin = oaPin::create(term);
return pin; /**
convert to OAPoint
*/
static oaPoint toOAPoint(const Point& p) {
oaPoint point;
point.set(p.getX(), p.getY());
return point;
} }
/** /**
@ -507,11 +508,16 @@ namespace {
box.set(b.getXMin(), b.getYMin(), b.getXMax(), b.getYMax()); box.set(b.getXMin(), b.getYMin(), b.getXMax(), b.getYMax());
return box; return box;
} }
oaRect* toOARect(Component* component,oaBlock* topBlock){ oaRect* toOARect(Pad* component,oaBlock* topBlock){
cerr << "toOARect" << endl; cerr << "toOARect" << endl;
assert(component); assert(component);
assert(topBlock); assert(topBlock);
Pad2OARectMap::iterator it = _pad2OARect.find(component);
if (it != _pad2OARect.end())
return it->second;
oaBox box = toOABox(component->getBoundingBox()); oaBox box = toOABox(component->getBoundingBox());
Layer* layer = (Layer*) component->getLayer(); Layer* layer = (Layer*) component->getLayer();
assert(layer); assert(layer);
@ -525,6 +531,59 @@ namespace {
return rect; return rect;
} }
oaPathSeg* toOAPathSeg(Segment* segment,oaNet* blockNet){
#if 0
cerr << "toOAPathSeg" << endl;
assert(component);
assert(blockNet);
Component2OAPathSegMap::iterator it = _component2OAPathSeg.find(component);
if (it != _component2OAPathSeg.end())
return it->second;
oaBox box = toOABox(component->getBoundingBox());
Layer* layer = (Layer*) component->getLayer();
assert(layer);
oaPhysicalLayer* physLayer = toOALayer(layer,_oaTech);
assert(physLayer);
oaLayerNum layerNum = physLayer->getNumber();
oaSegStyle style(, oacTruncateEndStyle, oacTruncateEndStyle);
res = oaPathSeg::created(blockNet->getBlock(),
,
oacDrawingPurposeType,
toOAPoint(),
toOAPoint(),
);
return res;
#endif
return NULL;
}
/**
create a Pin from Pin
*/
oaPin* toOAPin(Pin* hpin,oaNet* blockNet){
cerr << "toOAPin" << endl;
assert(hpin);
assert(blockNet);
oaName pinName;
blockNet->getName(pinName);
oaString sPinName;
pinName.get(sPinName);
oaTerm* term = oaTerm::find(blockNet->getBlock(), pinName);
assert(term);
oaPin* pin = oaPin::find(term, sPinName);
if(!pin)
pin = oaPin::create(term);
return pin;
}
oaVia* toOAVia(Contact* contact,oaNet* blockNet){
//TODO
return NULL;
}
/** /**
Convertion helper for Net convertion ... Convertion helper for Net convertion ...
@todo verify @todo verify
@ -584,27 +643,40 @@ namespace {
blockNet = oaScalarNet::create(topBlock, scNetName, toOASigType(net->getType())); blockNet = oaScalarNet::create(topBlock, scNetName, toOASigType(net->getType()));
assert(blockNet); assert(blockNet);
oaScalarTerm::create(blockNet, scNetName, toOATermType(net->getDirection())); oaScalarTerm::create(blockNet, scNetName, toOATermType(net->getDirection()));
if (net->isExternal()) { blockNet->setGlobal(net->isGlobal());
oaPin* pin = toOAPin(net,blockNet); blockNet->scalarize();//ensure we can add shape ..
Components externalComponents = NetExternalComponents::get(net);
for_each_component(component, externalComponents) { #if 0
oaRect* rect = toOARect(component,topBlock); //logical part
rect->addToPin(pin);
end_for;
}
}else{
for_each_component(component, net->getComponents()) {
oaRect* rect = toOARect(component,topBlock);
rect->addToNet(blockNet);
end_for;
}
}
cerr << " o transformation of plugs" << endl; cerr << " o transformation of plugs" << endl;
for_each_plug(plug, net->getPlugs()) { for_each_plug(plug, net->getPlugs()) {
toOAInstTerm(plug,blockNet); InstTerm* term = toOAInstTerm(plug, blockNet);
term->addToNet(blockNet);
end_for; end_for;
} }
blockNet->scalarize(); cerr << " o transformation of contacts" << endl;
for_each_contact(contact, getContacts()) {
Pin* hPin = dynamic_cast<Pin*>(contact);
oaPin* pin = NULL;
if(hPin)
pin = toOAPin(pin, blockNet);
oaVia* via = toOAVia(contact, blockNet);
via->addToNet(blockNet);
end_for;
}
cerr << " o transformation of pads" << endl;
for_each_pad(pads, getPads()){
oaRect* rect = toOARect(contact, blockNet);
rect->addToNet(blockNet);
end_for;
}
cerr << " o transformation of segments" << endl;
for_each_segments(component, net->getSegments()) {
oaShape* shape = toOAPathSeg(component,blockNet);
shape->addToNet(blockNet);
end_for;
}
#endif
return blockNet; return blockNet;
} }
@ -693,9 +765,8 @@ namespace {
assert(cell); assert(cell);
assert(previous); assert(previous);
Cell2OADesignMap::iterator it = _cell2OADesign4Schematic.find(cell); Cell2OADesignMap::iterator it = _cell2OADesign4Schematic.find(cell);
if (it != _cell2OADesign4Schematic.end()) { if (it != _cell2OADesign4Schematic.end())
return it->second; return it->second;
}
oaNativeNS ns; oaNativeNS ns;
oaLib* lib = toOALib(cell->getLibrary()); oaLib* lib = toOALib(cell->getLibrary());
@ -769,27 +840,13 @@ namespace {
end_for; end_for;
} }
cerr << "transformation of components" << endl;
for_each_component(component, cell->getComponents()) {
toOARect(component,topBlock);
end_for;
}
cerr << "transformation of slices" << endl;
for_each_slice(slice, cell->getSlices()){
for_each_component(component, slice->getComponents()) {
toOARect(component,topBlock);
end_for;
}
end_for;
}
//get and update boundingBox and set abutment box //get and update boundingBox and set abutment box
Box bBox = cell->getBoundingBox(); Box bBox = cell->getBoundingBox();
cerr << "Hurricane bounding box" << bBox << " in cell " << cell << endl; cerr << "Hurricane bounding box" << bBox << " in cell " << cell << endl;
Box aBox = cell->getAbutmentBox(); Box aBox = cell->getAbutmentBox();
cerr << "Hurricane abutment box" << aBox << " in cell " << cell << endl; cerr << "Hurricane abutment box" << aBox << " in cell " << cell << endl;
// creat abutment in oa // create abutment in oa
if(!aBox.isEmpty()) if(!aBox.isEmpty())
if(!oaSnapBoundary::find(topBlock)) if(!oaSnapBoundary::find(topBlock))
oaSnapBoundary::create(topBlock, toOABox(aBox)); oaSnapBoundary::create(topBlock, toOABox(aBox));

View File

@ -1,5 +1,5 @@
// -*-compile-command:"cd ../../../../.. && make"-*- // -*-compile-command:"cd ../../../../.. && make"-*-
// Time-stamp: "2010-08-12 14:07:23" - OpenAccessParser.cpp // Time-stamp: "2010-08-13 00:11:06" - 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 |
@ -101,47 +101,43 @@ namespace {
*/ */
oaLib* loadOALib(const string& libNameStr, const string& libPathStr, bool asDesignLibrary) { oaLib* loadOALib(const string& libNameStr, const string& libPathStr, bool asDesignLibrary) {
oaNativeNS oaNS; oaNativeNS oaNS;
oaString libNameOAStr(libNameStr.c_str());
oaScalarName libOAName(oaNS, libNameOAStr);
Name libName(libNameStr); Name libName(libNameStr);
Name2LibMap::const_iterator nit = _name2LibMap.find(libName); Name2LibMap::const_iterator nit = _name2LibMap.find(libName);
if (nit != _name2LibMap.end()) { if (nit != _name2LibMap.end())
Library* library = nit->second; Library* library = nit->second;
//verify that it's the same library : name and path
cerr << "already loaded" << endl;
return oaLib::find(libOAName);
}
string libPath = libPathStr;
oaFuncs::realPath(libPath);
oaLib* oaLibrary = NULL; oaLib* oaLibrary = NULL;
try { try {
oaLibrary = oaLib::open(libOAName, libPathStr.c_str()); pair<oaScalarName,string> libInfos = oaFuncs::libInfos(libPath, libNameStr);
oaLibrary = oaFuncs::openOALib(libInfos);
if (oaLibrary->isReadable()) { if (oaLibrary->isReadable()) {
if (!oaLibrary->getAccess(oacReadLibAccess)) { if (!oaLibrary->getAccess(oacReadLibAccess)) {
cout << "\n***Quitting. Cannot get LibAccess\n" ; cout << "\n***Quitting. Cannot get LibAccess\n" ;
exit(8); exit(8);
} }
cerr << "TITI" << endl;
oaTechnology2Technology(oaLibrary); oaTechnology2Technology(oaLibrary);
//create Hurricane library //create Hurricane library
Name libraryName = Name(libNameStr);
DataBase* db = DataBase::getDB(); DataBase* db = DataBase::getDB();
if (!db) { if (!db) {
cerr << "No DataBase" << endl; cerr << "No DataBase" << endl;
exit(8); exit(8);
} }
if (oaFuncs::findLibraryByNameInDB(db, libraryName)) { if (oaFuncs::findLibraryByNameInDB(db, libName)) {
cerr << "ERROR_PARSER(1)" << endl; cerr << "ERROR_PARSER(1)" << endl;
exit(8); exit(8);
} }
Library* library; Library* library;
if (asDesignLibrary) { if (asDesignLibrary) {
library = Library::create(oaFuncs::getOADesignLibraries(), Name(libNameStr)); library = Library::create(oaFuncs::getOADesignLibraries(), libName);
} else { } else {
library = Library::create(oaFuncs::getOACellLibraries(), Name(libNameStr)); library = Library::create(oaFuncs::getOACellLibraries(), libName);
} }
cerr << library << endl; cerr << library << endl;
@ -164,13 +160,12 @@ namespace {
if (module) { if (module) {
hCell = Cell::create(library, Name(cellNameString)); hCell = Cell::create(library, Name(cellNameString));
hCell->setTerminal(false); hCell->setTerminal(false);
if (!asDesignLibrary) { if (!asDesignLibrary)
hCell->setFlattenLeaf(true); hCell->setFlattenLeaf(true);
}
cerr << hCell << endl; cerr << hCell << endl;
if (asDesignLibrary) { if (asDesignLibrary)
_cell2OACellMap[hCell] = cell; _cell2OACellMap[hCell] = cell;
}
oaCollection<oaModTerm, oaModule> oaModTerms = module->getTerms(); oaCollection<oaModTerm, oaModule> oaModTerms = module->getTerms();
oaIter<oaModTerm> oaModTermIter(oaModTerms); oaIter<oaModTerm> oaModTermIter(oaModTerms);
while (oaModTerm* modTerm = oaModTermIter.getNext()) { while (oaModTerm* modTerm = oaModTermIter.getNext()) {
@ -276,7 +271,7 @@ namespace {
} }
} }
} }
} else { } else {//if not a net
//TODO //TODO
} }
} }
@ -300,8 +295,10 @@ namespace {
heart of the parser algorithm heart of the parser algorithm
*/ */
void oaTechnology2Technology(oaLib* oaLibrary) { void oaTechnology2Technology(oaLib* oaLibrary) {
assert(oaLibrary);
try { try {
oaTech* tech = oaTech::open(oaLibrary); oaTech* tech = oaTech::open(oaLibrary);
cout << "TOTO:" << endl;
if (!tech) { if (!tech) {
cout << "ERROR_PARSER(3):" << endl; cout << "ERROR_PARSER(3):" << endl;
@ -424,7 +421,6 @@ namespace {
//cerr << net << endl; //cerr << net << endl;
} }
oaScalarName cellName; oaScalarName cellName;
oa_Cell->getName(cellName); oa_Cell->getName(cellName);
oaString cellNameString; oaString cellNameString;
@ -435,6 +431,7 @@ namespace {
//physical part //physical part
oaBlock* block = cellDesign->getTopBlock(); oaBlock* block = cellDesign->getTopBlock();
if (block) { if (block) {
//ici on approxime l'abutment box avec la boundingBox
oaBox oa_box; oaBox oa_box;
block->getBBox(oa_box); block->getBBox(oa_box);
Point lowerLeft(DbU::db(oa_box.lowerLeft().x()), DbU::db(oa_box.lowerLeft().y())); Point lowerLeft(DbU::db(oa_box.lowerLeft().x()), DbU::db(oa_box.lowerLeft().y()));
@ -505,8 +502,8 @@ namespace {
}//namespace }//namespace
namespace CRL { namespace CRL {
Cell* OpenAccess::oaCellParser(const std::string& libPath, Cell* OpenAccess::oaCellParser(const std::string& cellLibPath, const std::string& cellLibName, const std::string& cellName,
const std::string& libName, const std::string& cellName) { const std::string& techLibPath, const std::string& techLibName) {
Cell* convertedCell = NULL; Cell* convertedCell = NULL;
#ifdef HAVE_OPENACCESS #ifdef HAVE_OPENACCESS
try { try {
@ -517,7 +514,8 @@ namespace CRL {
OAParser oaParser; OAParser oaParser;
oaScalarName scalarCellName(oaNativeNS(),cellName.c_str()); oaScalarName scalarCellName(oaNativeNS(),cellName.c_str());
oaLib* oaLibrary = oaParser.loadOALib(libName, libPath, true); oaLib* oaLibraryTech = oaParser.loadOALib(techLibName, techLibPath, true);
oaLib* oaLibrary = oaParser.loadOALib(cellLibName, cellLibPath, true);
Cell* hcell = oaParser.getCell(cellName); Cell* hcell = oaParser.getCell(cellName);
oaCell* cell = oaCell::find(oaLibrary,scalarCellName); oaCell* cell = oaCell::find(oaLibrary,scalarCellName);
oaParser.loadOACellInCell(cell,hcell); oaParser.loadOACellInCell(cell,hcell);
@ -534,5 +532,4 @@ namespace CRL {
#endif #endif
return convertedCell; return convertedCell;
} }
} }

View File

@ -7,7 +7,11 @@ compile:
./compile.sh ./compile.sh
run: run:
./x86_64/usr/local/bin/testOAWrapper ./x86_64/usr/local/bin/testOAWrapper \
"/dsk/l1/misc/caba/OA_BENCHMARKS/NangateOpenCellLibrary_PDKv1_3_v2009_07/openaccess" \
"NangateOpenCellLibrary" \
"/dsk/l1/misc/caba/OA_BENCHMARKS/NangateOpenCellLibrary_PDKv1_3_v2009_07/openaccess" \
"NCSU_FreePDK_45nm"
mrproper: clean mrproper: clean
rm -rf *.log .cadence rm -rf *.log .cadence

View File

@ -33,11 +33,15 @@ using namespace CRL;
int main(int argc,char** argv) { int main(int argc,char** argv) {
int returnCode=0; int returnCode=0;
if(argc!=5)
return -1;
dbo_ptr<AllianceFramework> af(AllianceFramework::create()); dbo_ptr<AllianceFramework> af(AllianceFramework::create());
auto_ptr<DataBase> sys(DataBase::getDB()); auto_ptr<DataBase> sys(DataBase::getDB());
// Cell* cell = af->getCell("inv_x1", Catalog::State::Views ); // Cell* cell = af->getCell("inv_x1", Catalog::State::Views );
Cell* cell = OAParser("/dsk/l1/misc/caba/coriolis-2.x/src/crlcore/src/ccore/openaccess/testParser/NangateOpenCellFreePDK45","NangateOpenCellLibrary").open("INV_X1"); Cell* cell = OAParser(argv[1],argv[2],argv[3],argv[4]).open("INV_X1");
auto_ptr<QApplication> qa(new HApplication(argc,argv)); auto_ptr<QApplication> qa(new HApplication(argc,argv));
#if (QT_VERSION >= QT_VERSION_CHECK(4,5,0)) and not defined (__APPLE__) #if (QT_VERSION >= QT_VERSION_CHECK(4,5,0)) and not defined (__APPLE__)