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

View File

@ -12,10 +12,13 @@ namespace Hurricane {
namespace CRL {
class OAParser {
private:
std::string _libPath;
std::string _libName;
std::string _cellLibPath;
std::string _cellLibName;
std::string _techLibPath;
std::string _techLibName;
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);
};
} // End of CRL namespace.

View File

@ -1,5 +1,5 @@
// -*-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
// | This file is part of the hurricaneAMS Software. |
// | Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved |
@ -25,8 +25,8 @@ namespace CRL {
class OpenAccess {
public:
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);
static Hurricane::Cell* oaCellParser(const std::string& cellLibPath, const std::string& cellLibName, const std::string& cellName,
const std::string& techLibPath, const std::string& techLibName);
};
}//namespace CRL

View File

@ -1,5 +1,5 @@
// -*-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
// | This file is part of the hurricaneAMS Software. |
// | Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved |

View File

@ -1,5 +1,5 @@
// -*-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
// | This file is part of the hurricaneAMS Software. |
// | Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved |
@ -45,6 +45,8 @@ namespace {
typedef map<const Cell*, oaCell*> Cell2OACellMap;
typedef map<Instance*, oaInst*> Instance2OAInstsMap;
typedef map<Layer*, oaPhysicalLayer*> Layer2OAPhysicalLayerMap;
typedef map<Pad*, oaRect*> Pad2OARectMap;
typedef map<Component*, oaPathSeg*> Component2OAPathSegMap;
string _path;
oaTech* _oaTech;
@ -56,6 +58,8 @@ namespace {
Cell2OACellMap _cell2OAcell;
Instance2OAInstsMap _instance2OAInst;
Layer2OAPhysicalLayerMap _layer2OAPhysicalLayer;
Pad2OARectMap _pad2OARect;
Component2OAPathSegMap _component2OAPathSeg;
set<int> _layerIDS;
int _layerID;
oaLayer* _layerDev;
@ -76,6 +80,8 @@ namespace {
_cell2OAcell(),
_instance2OAInst(),
_layer2OAPhysicalLayer(),
_pad2OARect(),
_component2OAPathSeg(),
_layerIDS(),
_layerID(0),
_layerDev(NULL),
@ -459,9 +465,7 @@ namespace {
assert(it != _instance2OAInst.end());
oaInst* blockInst = it->second;
oaNativeNS ns;
oaScalarName scPlugName(ns, getString(plug->getMasterNet()->getName()).c_str());
oaName instTermName(scPlugName);
oaName instTermName(toOAName( getString(plug->getMasterNet()->getName()) ));
oaInstTerm* instTerm = oaInstTerm::find(blockInst, instTermName);
if (instTerm)
return instTerm;
@ -481,22 +485,19 @@ namespace {
return instTerm;
}
/**
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);
static oaName toOAName(const Name& n){
oaNativeNS ns;
oaScalarName scNetName(ns, getString(net->getName()).c_str());
oaTerm* term = oaTerm::find(blockNet->getBlock(), scNetName);
assert(term);
oaPin* pin = oaPin::create(term);
oaScalarName scN(ns, getString(n).c_str());
return oaName(scN);
}
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());
return box;
}
oaRect* toOARect(Component* component,oaBlock* topBlock){
oaRect* toOARect(Pad* component,oaBlock* topBlock){
cerr << "toOARect" << endl;
assert(component);
assert(topBlock);
Pad2OARectMap::iterator it = _pad2OARect.find(component);
if (it != _pad2OARect.end())
return it->second;
oaBox box = toOABox(component->getBoundingBox());
Layer* layer = (Layer*) component->getLayer();
assert(layer);
@ -525,6 +531,59 @@ namespace {
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 ...
@todo verify
@ -584,27 +643,40 @@ namespace {
blockNet = oaScalarNet::create(topBlock, scNetName, toOASigType(net->getType()));
assert(blockNet);
oaScalarTerm::create(blockNet, scNetName, toOATermType(net->getDirection()));
if (net->isExternal()) {
oaPin* pin = toOAPin(net,blockNet);
Components externalComponents = NetExternalComponents::get(net);
for_each_component(component, externalComponents) {
oaRect* rect = toOARect(component,topBlock);
rect->addToPin(pin);
end_for;
}
}else{
for_each_component(component, net->getComponents()) {
oaRect* rect = toOARect(component,topBlock);
rect->addToNet(blockNet);
end_for;
}
}
blockNet->setGlobal(net->isGlobal());
blockNet->scalarize();//ensure we can add shape ..
#if 0
//logical part
cerr << " o transformation of plugs" << endl;
for_each_plug(plug, net->getPlugs()) {
toOAInstTerm(plug,blockNet);
InstTerm* term = toOAInstTerm(plug, blockNet);
term->addToNet(blockNet);
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;
}
@ -693,9 +765,8 @@ namespace {
assert(cell);
assert(previous);
Cell2OADesignMap::iterator it = _cell2OADesign4Schematic.find(cell);
if (it != _cell2OADesign4Schematic.end()) {
if (it != _cell2OADesign4Schematic.end())
return it->second;
}
oaNativeNS ns;
oaLib* lib = toOALib(cell->getLibrary());
@ -769,27 +840,13 @@ namespace {
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
Box bBox = cell->getBoundingBox();
cerr << "Hurricane bounding box" << bBox << " in cell " << cell << endl;
Box aBox = cell->getAbutmentBox();
cerr << "Hurricane abutment box" << aBox << " in cell " << cell << endl;
// creat abutment in oa
// create abutment in oa
if(!aBox.isEmpty())
if(!oaSnapBoundary::find(topBlock))
oaSnapBoundary::create(topBlock, toOABox(aBox));

View File

@ -1,5 +1,5 @@
// -*-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
// | This file is part of the hurricaneAMS Software. |
// | Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved |
@ -101,47 +101,43 @@ namespace {
*/
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()) {
if (nit != _name2LibMap.end())
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;
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->getAccess(oacReadLibAccess)) {
cout << "\n***Quitting. Cannot get LibAccess\n" ;
exit(8);
}
cerr << "TITI" << endl;
oaTechnology2Technology(oaLibrary);
//create Hurricane library
Name libraryName = Name(libNameStr);
DataBase* db = DataBase::getDB();
if (!db) {
cerr << "No DataBase" << endl;
exit(8);
}
if (oaFuncs::findLibraryByNameInDB(db, libraryName)) {
if (oaFuncs::findLibraryByNameInDB(db, libName)) {
cerr << "ERROR_PARSER(1)" << endl;
exit(8);
}
Library* library;
if (asDesignLibrary) {
library = Library::create(oaFuncs::getOADesignLibraries(), Name(libNameStr));
library = Library::create(oaFuncs::getOADesignLibraries(), libName);
} else {
library = Library::create(oaFuncs::getOACellLibraries(), Name(libNameStr));
library = Library::create(oaFuncs::getOACellLibraries(), libName);
}
cerr << library << endl;
@ -164,13 +160,12 @@ namespace {
if (module) {
hCell = Cell::create(library, Name(cellNameString));
hCell->setTerminal(false);
if (!asDesignLibrary) {
if (!asDesignLibrary)
hCell->setFlattenLeaf(true);
}
cerr << hCell << endl;
if (asDesignLibrary) {
if (asDesignLibrary)
_cell2OACellMap[hCell] = cell;
}
oaCollection<oaModTerm, oaModule> oaModTerms = module->getTerms();
oaIter<oaModTerm> oaModTermIter(oaModTerms);
while (oaModTerm* modTerm = oaModTermIter.getNext()) {
@ -276,7 +271,7 @@ namespace {
}
}
}
} else {
} else {//if not a net
//TODO
}
}
@ -300,8 +295,10 @@ namespace {
heart of the parser algorithm
*/
void oaTechnology2Technology(oaLib* oaLibrary) {
assert(oaLibrary);
try {
oaTech* tech = oaTech::open(oaLibrary);
cout << "TOTO:" << endl;
if (!tech) {
cout << "ERROR_PARSER(3):" << endl;
@ -424,7 +421,6 @@ namespace {
//cerr << net << endl;
}
oaScalarName cellName;
oa_Cell->getName(cellName);
oaString cellNameString;
@ -435,6 +431,7 @@ namespace {
//physical part
oaBlock* block = cellDesign->getTopBlock();
if (block) {
//ici on approxime l'abutment box avec la boundingBox
oaBox oa_box;
block->getBBox(oa_box);
Point lowerLeft(DbU::db(oa_box.lowerLeft().x()), DbU::db(oa_box.lowerLeft().y()));
@ -505,8 +502,8 @@ namespace {
}//namespace
namespace CRL {
Cell* OpenAccess::oaCellParser(const std::string& libPath,
const std::string& libName, const std::string& cellName) {
Cell* OpenAccess::oaCellParser(const std::string& cellLibPath, const std::string& cellLibName, const std::string& cellName,
const std::string& techLibPath, const std::string& techLibName) {
Cell* convertedCell = NULL;
#ifdef HAVE_OPENACCESS
try {
@ -517,7 +514,8 @@ namespace CRL {
OAParser oaParser;
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);
oaCell* cell = oaCell::find(oaLibrary,scalarCellName);
oaParser.loadOACellInCell(cell,hcell);
@ -534,5 +532,4 @@ namespace CRL {
#endif
return convertedCell;
}
}

View File

@ -7,7 +7,11 @@ compile:
./compile.sh
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
rm -rf *.log .cadence

View File

@ -33,11 +33,15 @@ using namespace CRL;
int main(int argc,char** argv) {
int returnCode=0;
if(argc!=5)
return -1;
dbo_ptr<AllianceFramework> af(AllianceFramework::create());
auto_ptr<DataBase> sys(DataBase::getDB());
// 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));
#if (QT_VERSION >= QT_VERSION_CHECK(4,5,0)) and not defined (__APPLE__)