correct bug: when loading an already existing OA design ...

This commit is contained in:
Jean-Manuel Caba 2010-07-22 14:27:56 +00:00
parent a516708ed4
commit 6b1613c990
1 changed files with 110 additions and 77 deletions

View File

@ -1,5 +1,5 @@
// -*-compile-command:"cd ../../../../.. && make"-*- // -*-compile-command:"cd ../../../../.. && make"-*-
// Time-stamp: "2010-07-21 19:21:12" - OpenAccessWrapper.cpp // Time-stamp: "2010-07-22 15:38:03" - 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 |
@ -46,7 +46,6 @@ namespace {
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;
typedef pair<oaModInst*, oaInst*> OAInstPair;
typedef map<Instance*, oaInst*> Instance2OAInstsMap; typedef map<Instance*, oaInst*> Instance2OAInstsMap;
typedef map<Layer*, oaPhysicalLayer*> Layer2OAPhysicalLayerMap; typedef map<Layer*, oaPhysicalLayer*> Layer2OAPhysicalLayerMap;
@ -143,6 +142,7 @@ namespace {
assert(lib->isValid()); assert(lib->isValid());
_library2OALib[library] = lib; _library2OALib[library] = lib;
#if 0
// 2) for each cell convert them too : if it's a standard cell library for example // 2) for each cell convert them too : if it's a standard cell library for example
for_each_cell(c ,library->getCells()){ for_each_cell(c ,library->getCells()){
getOADesignForCell(c); getOADesignForCell(c);
@ -154,7 +154,7 @@ namespace {
getOALibForLibrary(l); getOALibForLibrary(l);
end_for; end_for;
} }
#endif
// 4) create, update library list file // 4) create, update library list file
try{ try{
cerr << "Overwriting cds.lib file begin" << endl; cerr << "Overwriting cds.lib file begin" << endl;
@ -162,7 +162,8 @@ namespace {
oaLibDefList* ldl = oaLibDefList::get( cdsPath.c_str(), 'a'); oaLibDefList* ldl = oaLibDefList::get( cdsPath.c_str(), 'a');
assert(ldl); assert(ldl);
assert(ldl->isValid()); assert(ldl->isValid());
oaLibDef::create( ldl, scNameLib, strPathLib.c_str() ); if(!oaLibDef::find(ldl, scNameLib))
oaLibDef::create(ldl, scNameLib, strPathLib.c_str());
ldl->save(); ldl->save();
ldl->destroy();//claim memory ldl->destroy();//claim memory
ldl = NULL; ldl = NULL;
@ -170,9 +171,6 @@ namespace {
}catch(oaException& e){ }catch(oaException& e){
cerr << "ERROR cds: " << e.getMsg() << endl; cerr << "ERROR cds: " << e.getMsg() << endl;
exit(-2); exit(-2);
}catch(...){
cerr << "ERROR cds: [UNKNOWN]" << endl;
exit(-1);
} }
return lib; return lib;
@ -184,9 +182,20 @@ namespace {
oaLayer* getOALayerFromLayer(Layer* layer,oaTech* theOATech) { oaLayer* getOALayerFromLayer(Layer* layer,oaTech* theOATech) {
cerr << "getOALayerFromLayer" << endl; cerr << "getOALayerFromLayer" << endl;
assert(layer); assert(layer);
Layer2OAPhysicalLayerMap::iterator it = _layer2OAPhysicalLayer.find(layer);
if (it != _layer2OAPhysicalLayer.end()) {
return it->second;
}
assert(theOATech); assert(theOATech);
// 1) get or create layer
oaString layerName = getString(layer->getName()).c_str(); oaString layerName = getString(layer->getName()).c_str();
oaPhysicalLayer* aOALayer = NULL; oaPhysicalLayer* aOALayer = NULL;
aOALayer = oaPhysicalLayer::find(theOATech, layerName, true);
if(aOALayer){
_layer2OAPhysicalLayer[layer] = aOALayer;
return aOALayer;
}
BasicLayer* bLayer = dynamic_cast<BasicLayer*>(layer); BasicLayer* bLayer = dynamic_cast<BasicLayer*>(layer);
if(bLayer) if(bLayer)
aOALayer = oaPhysicalLayer::create(theOATech, layerName, _layerID++,getOAMaterial(bLayer->getMaterial())); aOALayer = oaPhysicalLayer::create(theOATech, layerName, _layerID++,getOAMaterial(bLayer->getMaterial()));
@ -202,7 +211,7 @@ namespace {
long minSpace = Hurricane::DbU::getDb(layer->getMinimalSpacing()); long minSpace = Hurricane::DbU::getDb(layer->getMinimalSpacing());
long pitch = Hurricane::DbU::getDb(layer->getPitch()); long pitch = Hurricane::DbU::getDb(layer->getPitch());
/* #if 0
cerr << " o create constraint for min size : " << pitch << endl; cerr << " o create constraint for min size : " << pitch << endl;
oaLayerConstraint* cMinSize = NULL; oaLayerConstraint* cMinSize = NULL;
try{ try{
@ -233,7 +242,7 @@ namespace {
oaLayerConstraintDef::get(oacVerticalRouteGridPitch), oaLayerConstraintDef::get(oacVerticalRouteGridPitch),
oaIntValue::create(theOATech->getLib(),pitch)); oaIntValue::create(theOATech->getLib(),pitch));
assert(cPitchV); assert(cPitchV);
*/ #endif
if(bLayer){ if(bLayer){
unsigned gdsIInumber = bLayer->getExtractNumber(); unsigned gdsIInumber = bLayer->getExtractNumber();
} }
@ -247,18 +256,17 @@ namespace {
@todo complete with technology info for layers @todo complete with technology info for layers
@see getOALibForLibrary @see getOALibForLibrary
*/ */
oaTech* getOATechForTechnology(const Technology* technology) { oaTech* getOATechForTechnology(const Technology* technology,const Library* lib) {
cerr << "createOATechForTechnology" << endl; cerr << "createOATechForTechnology" << endl;
assert(technology); assert(technology);
//get or create Library for the techno // 1) get or create Library for the techno
DataBase* db = technology->getDataBase();
assert(db);
Library* lib = db->getRootLibrary();
assert(lib); assert(lib);
oaLib* techOAlib = getOALibForLibrary(lib); oaLib* techOAlib = getOALibForLibrary(lib);
assert(techOAlib); assert(techOAlib);
// 2) get or create oaTech container
bool created = false;
cerr << "oaTech::find" << endl; cerr << "oaTech::find" << endl;
oaTech* theOATech = oaTech::find(techOAlib); oaTech* theOATech = oaTech::find(techOAlib);
if(!theOATech){ if(!theOATech){
@ -269,13 +277,11 @@ namespace {
if(!theOATech){ if(!theOATech){
cerr << "oaTech::create" << endl; cerr << "oaTech::create" << endl;
theOATech = oaTech::create(techOAlib); theOATech = oaTech::create(techOAlib);
}else{ created = true;
return theOATech;
} }
}else{
return theOATech;
} }
assert(techOAlib); assert(techOAlib);
if(created){
theOATech->setDefaultManufacturingGrid(10); theOATech->setDefaultManufacturingGrid(10);
theOATech->setDBUPerUU(oaViewType::get(oacMaskLayout), 2000); theOATech->setDBUPerUU(oaViewType::get(oacMaskLayout), 2000);
@ -283,19 +289,24 @@ namespace {
//and add oaSimpleConstraintType too //and add oaSimpleConstraintType too
oaConstraintGroup *cgFoundry = theOATech->getFoundryRules(); oaConstraintGroup *cgFoundry = theOATech->getFoundryRules();
/*
add the constraint group LEFDefaultRouteSpec for oa2lef
*/
//TODO: add this layer //TODO: add this layer
//first create "utility" layers //first create "utility" layers
//strLayerDev ( "device" ); //strLayerDev ( "device" );
//strLayerText( "text" ); //strLayerText( "text" );
//strLayerPin ( "pin" ); //strLayerPin ( "pin" );
//strLayerWire( "wire" ); //strLayerWire( "wire" );
}
// get or create physical layer
//create physical layer
for_each_layer(layer, technology->getLayers()) { for_each_layer(layer, technology->getLayers()) {
getOALayerFromLayer(layer,theOATech); getOALayerFromLayer(layer,theOATech);
end_for; end_for;
} }
printOALayers(theOATech); printOALayers(theOATech);
return theOATech; return theOATech;
@ -361,12 +372,13 @@ namespace {
assert(term); assert(term);
oaPin* pin = oaPin::create(term); oaPin* pin = oaPin::create(term);
assert(pin); assert(pin);
/*
#if 0
oaLayerNum layer; oaLayerNum layer;
oaPurposeNum purpose; oaPurposeNum purpose;
getLayerPurpose(block->getDesign(), "pin", "drawing", layer, purpose); getLayerPurpose(block->getDesign(), "pin", "drawing", layer, purpose);
oaPinFig *fig = oaPolygon::create(block, layer, purpose, points); oaPinFig *fig = oaPolygon::create(block, layer, purpose, points);
*/ #endif
return pin; return pin;
} }
@ -401,7 +413,12 @@ namespace {
assert(net); assert(net);
oaNativeNS ns; oaNativeNS ns;
oaScalarName scNetName(ns, getString(net->getName()).c_str()); oaScalarName scNetName(ns, getString(net->getName()).c_str());
oaScalarNet* blockNet = oaScalarNet::create(topBlock, scNetName, getOASigType(net->getType())); oaScalarNet* blockNet = NULL;
blockNet = oaScalarNet::find(topBlock, scNetName);
if(blockNet)
return blockNet;
assert(!blockNet);
blockNet = oaScalarNet::create(topBlock, scNetName, getOASigType(net->getType()));
assert(blockNet); assert(blockNet);
if (net->isExternal()) { if (net->isExternal()) {
oaPin* pin = getOAPinFromNet(net,blockNet); oaPin* pin = getOAPinFromNet(net,blockNet);
@ -459,8 +476,11 @@ namespace {
_cell2OADesign4Netlist[cell] = designCellView; _cell2OADesign4Netlist[cell] = designCellView;
// 3) create oaBlock singleton where we will do all the work // 3) create oaBlock singleton where we will do all the work
oaBlock* topBlock = designCellView->getTopBlock();
if(!topBlock){
cerr << "oaBlock::create for netlist view" << endl; cerr << "oaBlock::create for netlist view" << endl;
oaBlock* topBlock = oaBlock::create(designCellView); topBlock = oaBlock::create(designCellView);
}
assert(topBlock); assert(topBlock);
// 4) convert each OA object // 4) convert each OA object
@ -507,9 +527,13 @@ namespace {
oaDesign* designCellView = oaDesign::open(scNameLib, scNameDesign, scNameView, vType, 'a'); oaDesign* designCellView = oaDesign::open(scNameLib, scNameDesign, scNameView, vType, 'a');
_cell2OADesign4Symbolic[cell] = designCellView; _cell2OADesign4Symbolic[cell] = designCellView;
// embed previous module // get module or embed previous module
oaModule *topMod = oaModule::embed(designCellView, previous); oaModule* topMod = NULL;
topMod = designCellView->getTopModule();
if(!topMod){
topMod = oaModule::embed(designCellView, previous);
designCellView->setTopModule(topMod); designCellView->setTopModule(topMod);
}
oaBlock *topBlock = designCellView->getTopBlock(); oaBlock *topBlock = designCellView->getTopBlock();
assert(topBlock); assert(topBlock);
@ -542,9 +566,13 @@ namespace {
oaDesign* designCellView = oaDesign::open(scNameLib, scNameDesign, scNameView, vType, 'a'); oaDesign* designCellView = oaDesign::open(scNameLib, scNameDesign, scNameView, vType, 'a');
_cell2OADesign4Schematic[cell] = designCellView; _cell2OADesign4Schematic[cell] = designCellView;
// embed previous module // get module or embed previous module
oaModule *topMod = oaModule::embed(designCellView, previous); oaModule* topMod = NULL;
topMod = designCellView->getTopModule();
if(!topMod){
topMod = oaModule::embed(designCellView, previous);
designCellView->setTopModule(topMod); designCellView->setTopModule(topMod);
}
oaBlock *topBlock = designCellView->getTopBlock(); oaBlock *topBlock = designCellView->getTopBlock();
assert(topBlock); assert(topBlock);
@ -577,9 +605,13 @@ namespace {
oaDesign* designCellView = oaDesign::open(scNameLib, scNameDesign, scNameView, vType, 'a'); oaDesign* designCellView = oaDesign::open(scNameLib, scNameDesign, scNameView, vType, 'a');
_cell2OADesign4Layout[cell] = designCellView; _cell2OADesign4Layout[cell] = designCellView;
// embed previous module // get module or embed previous module
oaModule *topMod = oaModule::embed(designCellView, previous); oaModule* topMod = NULL;
topMod = designCellView->getTopModule();
if(!topMod){
topMod = oaModule::embed(designCellView, previous);
designCellView->setTopModule(topMod); designCellView->setTopModule(topMod);
}
oaBlock *topBlock = designCellView->getTopBlock(); oaBlock *topBlock = designCellView->getTopBlock();
assert(topBlock); assert(topBlock);
@ -595,7 +627,7 @@ namespace {
// 1) get technology // 1) get technology
if(!_oaTech) if(!_oaTech)
_oaTech = getOATechForTechnology(_technology); _oaTech = getOATechForTechnology(_technology,cell->getLibrary());
// 2) create OA structure ... // 2) create OA structure ...
oaDesign* netlistView = createOAasNetlist(cell); oaDesign* netlistView = createOAasNetlist(cell);
@ -613,6 +645,7 @@ namespace {
#endif #endif
} }
namespace CRL { namespace CRL {
void OpenAccessWrapper::oaDriver(const string& path, Cell* cell) { void OpenAccessWrapper::oaDriver(const string& path, Cell* cell) {
#ifdef HAVE_OPENACCESS #ifdef HAVE_OPENACCESS