convert Components in the correct oaLayer ... embed schematic view in layout ...
This commit is contained in:
parent
4d9b6b465c
commit
09cd76f80f
|
@ -1,5 +1,5 @@
|
||||||
// -*-compile-command:"cd ../../../../.. && make"-*-
|
// -*-compile-command:"cd ../../../../.. && make"-*-
|
||||||
// Time-stamp: "2010-07-06 17:24:31" - OpenAccessWrapper.cpp
|
// Time-stamp: "2010-07-07 16:25:24" - 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 |
|
||||||
|
@ -11,6 +11,11 @@
|
||||||
// | E-mail : Jean-Manuel.Caba@asim.lip6.fr |
|
// | E-mail : Jean-Manuel.Caba@asim.lip6.fr |
|
||||||
// x-----------------------------------------------------------------x
|
// x-----------------------------------------------------------------x
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <algorithm>
|
||||||
|
#include <vector>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
#ifdef HAVE_OPENACCESS
|
#ifdef HAVE_OPENACCESS
|
||||||
#include "oa/oaDesignDB.h"
|
#include "oa/oaDesignDB.h"
|
||||||
using namespace oa;
|
using namespace oa;
|
||||||
|
@ -28,9 +33,9 @@ using namespace Hurricane;
|
||||||
|
|
||||||
#include "OpenAccessWrapper.h"
|
#include "OpenAccessWrapper.h"
|
||||||
|
|
||||||
#define assert(cond) if (! (cond) ) throw Error("assertion failed")
|
#define assert(cond) if (! (cond) ) throw Error("assertion failed : " + string( #cond ) )
|
||||||
//#define assert(cond)
|
//#define assert(cond)
|
||||||
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -64,7 +69,7 @@ namespace {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@todo verify
|
@todo verify
|
||||||
*/
|
*/
|
||||||
oaMaterial getOAMaterial(const BasicLayer::Material& material) {
|
oaMaterial getOAMaterial(const BasicLayer::Material& material) {
|
||||||
cerr << "getOAMaterial" << endl;
|
cerr << "getOAMaterial" << endl;
|
||||||
|
@ -83,9 +88,9 @@ namespace {
|
||||||
throw Error("Unrecognized material");
|
throw Error("Unrecognized material");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@todo verify
|
@todo verify
|
||||||
*/
|
*/
|
||||||
oaTermType getOATermType(const Net::Direction& direction) {
|
oaTermType getOATermType(const Net::Direction& direction) {
|
||||||
cerr << "getOATermType" << endl;
|
cerr << "getOATermType" << endl;
|
||||||
|
@ -106,7 +111,7 @@ namespace {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@todo verify
|
@todo verify
|
||||||
*/
|
*/
|
||||||
oaSigType getOASigType(const Net::Type& type) {
|
oaSigType getOASigType(const Net::Type& type) {
|
||||||
cerr << "getOASigType" << endl;
|
cerr << "getOASigType" << endl;
|
||||||
|
@ -223,7 +228,9 @@ namespace {
|
||||||
}
|
}
|
||||||
|
|
||||||
~OADriver() {
|
~OADriver() {
|
||||||
cerr << "SAVING ALL" << endl;
|
cerr << "SAVING ALL" << endl;
|
||||||
|
_oaTech->save();
|
||||||
|
_oaTech->close();
|
||||||
for (Cell2OADesignMap::iterator it = _cell2OADesign4SchematicMap.begin();
|
for (Cell2OADesignMap::iterator it = _cell2OADesign4SchematicMap.begin();
|
||||||
it != _cell2OADesign4SchematicMap.end();
|
it != _cell2OADesign4SchematicMap.end();
|
||||||
++it) {
|
++it) {
|
||||||
|
@ -240,8 +247,7 @@ namespace {
|
||||||
design->save();
|
design->save();
|
||||||
design->close();
|
design->close();
|
||||||
}
|
}
|
||||||
_oaTech->save();
|
|
||||||
_oaTech->close();
|
|
||||||
for (Library2OALibMap::iterator it = _library2OALibMap.begin();
|
for (Library2OALibMap::iterator it = _library2OALibMap.begin();
|
||||||
it != _library2OALibMap.end();
|
it != _library2OALibMap.end();
|
||||||
++it) {
|
++it) {
|
||||||
|
@ -268,48 +274,48 @@ namespace {
|
||||||
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;
|
||||||
|
|
||||||
oaLib *lib = oaLib::find(scNameLib);
|
oaLib *lib = NULL;//oaLib::find(scNameLib);
|
||||||
if (!lib) {
|
// if (!lib) {
|
||||||
if (oaLib::exists(strPathLib.c_str())){
|
// if (oaLib::exists(strPathLib.c_str())){
|
||||||
lib = oaLib::open(scNameLib, strPathLib.c_str());
|
// lib = oaLib::open(scNameLib, strPathLib.c_str());
|
||||||
}
|
// }
|
||||||
// string cmd = "rm -rf "+strPathLib+"; mkdir -p "+strPathLib;
|
string cmd = "rm -rf "+strPathLib+"; mkdir -p "+strPathLib;
|
||||||
// system(cmd.c_str());
|
system(cmd.c_str());
|
||||||
// oaLib* lib = oaLib::create(scNameLib, strPathLib.c_str(), oacSharedLibMode, "oaDMFileSys");
|
// oaLib* lib = oaLib::create(scNameLib, strPathLib.c_str(), oacSharedLibMode, "oaDMFileSys");
|
||||||
if(!lib)
|
// if(!lib)
|
||||||
lib = oaLib::create(scNameLib, strPathLib.c_str());
|
lib = oaLib::create(scNameLib, strPathLib.c_str());
|
||||||
}
|
// }
|
||||||
|
|
||||||
assert(lib);
|
assert(lib);
|
||||||
assert(lib->isValid());
|
assert(lib->isValid());
|
||||||
|
|
||||||
if(!_oaTech)
|
if(!_oaTech)
|
||||||
_oaTech = createOATechForTechnology(_technology,lib);
|
_oaTech = createOATechForTechnology(_technology,lib);
|
||||||
|
|
||||||
assert(_oaTech);
|
|
||||||
|
|
||||||
_library2OALibMap[library] = lib;
|
assert(_oaTech);
|
||||||
return lib;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
_library2OALibMap[library] = lib;
|
||||||
@todo complete with technology info for layers
|
return lib;
|
||||||
*/
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@todo complete with technology info for layers
|
||||||
|
*/
|
||||||
oaTech* createOATechForTechnology(const Technology* technology,oaLib* lib) {
|
oaTech* createOATechForTechnology(const Technology* technology,oaLib* lib) {
|
||||||
cerr << "createOATechForTechnology" << endl;
|
cerr << "createOATechForTechnology" << endl;
|
||||||
oaTech* theOATech = oaTech::create(lib);
|
oaTech* theOATech = oaTech::create(lib);
|
||||||
theOATech->setDefaultManufacturingGrid(10);
|
theOATech->setDefaultManufacturingGrid(10);
|
||||||
theOATech->setDBUPerUU(oaViewType::get(oacMaskLayout), 1000);
|
theOATech->setDBUPerUU(oaViewType::get(oacMaskLayout), 1000);
|
||||||
|
|
||||||
int layerID=0;
|
int layerID=0;
|
||||||
for_each_layer(layer, technology->getLayers()) {
|
for_each_layer(layer, technology->getLayers()) {
|
||||||
oaString layerName = getString(layer->getName()).c_str();
|
oaString layerName = getString(layer->getName()).c_str();
|
||||||
oaPhysicalLayer* aOALayer = NULL;
|
oaPhysicalLayer* aOALayer = NULL;
|
||||||
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()));
|
||||||
else
|
else
|
||||||
aOALayer = oaPhysicalLayer::create(theOATech, layerName, layerID++);
|
aOALayer = oaPhysicalLayer::create(theOATech, layerName, layerID++);
|
||||||
assert(aOALayer);
|
assert(aOALayer);
|
||||||
|
|
||||||
_layer2OAPhysicalLayerMap[layer] = aOALayer;
|
_layer2OAPhysicalLayerMap[layer] = aOALayer;
|
||||||
|
@ -318,7 +324,7 @@ namespace {
|
||||||
DbU::Unit pitch = layer->getPitch();
|
DbU::Unit pitch = layer->getPitch();
|
||||||
end_for;
|
end_for;
|
||||||
}
|
}
|
||||||
|
|
||||||
for_each_basic_layer(basicLayer, technology->getBasicLayers()) {
|
for_each_basic_layer(basicLayer, technology->getBasicLayers()) {
|
||||||
Layer2OAPhysicalLayerMap::iterator it = _layer2OAPhysicalLayerMap.find((Layer*)(basicLayer));
|
Layer2OAPhysicalLayerMap::iterator it = _layer2OAPhysicalLayerMap.find((Layer*)(basicLayer));
|
||||||
if (it != _layer2OAPhysicalLayerMap.end()) {
|
if (it != _layer2OAPhysicalLayerMap.end()) {
|
||||||
|
@ -327,7 +333,7 @@ namespace {
|
||||||
}
|
}
|
||||||
end_for;
|
end_for;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(theOATech != NULL);
|
assert(theOATech != NULL);
|
||||||
oaIter<oaLayer> lIter(theOATech->getLayers());
|
oaIter<oaLayer> lIter(theOATech->getLayers());
|
||||||
while(oaLayer* l = lIter.getNext()){
|
while(oaLayer* l = lIter.getNext()){
|
||||||
|
@ -338,85 +344,110 @@ namespace {
|
||||||
return theOATech;
|
return theOATech;
|
||||||
}
|
}
|
||||||
|
|
||||||
oaDesign* getOADesignForCell(const Cell* cell) {
|
oaDesign* getOADesignForCell(const Cell* cell) {
|
||||||
cerr << "getOADesignForCell " << cell << endl;
|
cerr << "getOADesignForCell " << cell << endl;
|
||||||
assert(cell);
|
assert(cell);
|
||||||
Cell2OADesignMap::iterator it = _cell2OADesign4SchematicMap.find(cell);
|
Cell2OADesignMap::iterator it = _cell2OADesign4SchematicMap.find(cell);
|
||||||
if (it != _cell2OADesign4SchematicMap.end()) {
|
if (it != _cell2OADesign4SchematicMap.end()) {
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
oaNativeNS ns;
|
oaNativeNS ns;
|
||||||
oaLib* lib = getOALibForLibrary(cell->getLibrary());
|
oaLib* lib = getOALibForLibrary(cell->getLibrary());
|
||||||
assert(lib);
|
assert(lib);
|
||||||
assert(_oaTech);
|
assert(_oaTech);
|
||||||
oaScalarName scNameDesign(ns, getString(cell->getName()).c_str());
|
oaScalarName scNameDesign(ns, getString(cell->getName()).c_str());
|
||||||
oaScalarName scNameViewSchematic(ns, "schematic");
|
oaScalarName scNameViewSchematic(ns, "schematic");
|
||||||
oaScalarName scNameViewLayout(ns, "layout");
|
oaScalarName scNameViewLayout(ns, "layout");
|
||||||
oaScalarName scNameLib;
|
oaScalarName scNameLib;
|
||||||
lib->getName(scNameLib);
|
lib->getName(scNameLib);
|
||||||
|
|
||||||
oaDesign* design4Schematic = oaDesign::open(scNameLib, scNameDesign, scNameViewSchematic, oaViewType::get(oacSchematic), 'w');
|
// create a Schematic CellView of the design
|
||||||
_cell2OADesign4SchematicMap[cell] = design4Schematic;
|
oaDesign* schematicView = oaDesign::open(scNameLib, scNameDesign, scNameViewSchematic, oaViewType::get(oacSchematic), 'w');
|
||||||
oaBlock* designBlock4Layout = oaBlock::create(design4Schematic);
|
_cell2OADesign4SchematicMap[cell] = schematicView;
|
||||||
|
oaModule::create(schematicView);
|
||||||
|
oaBlock::create(schematicView);
|
||||||
|
// create a Layout CellView of the design
|
||||||
|
oaDesign* layoutView = oaDesign::open(scNameLib, scNameDesign, scNameViewLayout, oaViewType::get(oacMaskLayout), 'w');
|
||||||
|
_cell2OADesign4LayoutMap[cell] = layoutView;
|
||||||
|
|
||||||
cerr << "transformation of instances" << endl;
|
//embed "module" domain in block domain
|
||||||
for_each_instance(instance, cell->getInstances()) {
|
oaModule* topModule = oaModule::embed(layoutView,schematicView);
|
||||||
Cell* masterCell = instance->getMasterCell();
|
layoutView->setTopModule(topModule);
|
||||||
oaDesign* masterDesign = getOADesignForCell(masterCell);
|
oaBlock* topBlock = layoutView->getTopBlock();
|
||||||
oaScalarName scMasterName;
|
assert(topBlock);
|
||||||
masterDesign->getCellName(scMasterName);
|
|
||||||
oaString strMasterName;
|
|
||||||
scMasterName.get(strMasterName);
|
|
||||||
oaScalarName scInstName(ns, getString(instance->getName()).c_str());
|
|
||||||
|
|
||||||
oaTransform transform;
|
/// fail because the AbutmentBox is empty
|
||||||
getOATransformFromTransformation(transform, instance->getTransformation());
|
// oaBox box;
|
||||||
oaScalarInst* blockInst = oaScalarInst::create(designBlock4Layout, masterDesign, scInstName, transform);
|
// getOABoxForBox(box, cell->getAbutmentBox());
|
||||||
_instance2OAInstMap[instance] = blockInst;
|
// cerr << cell << " " << cell->getAbutmentBox() << endl;
|
||||||
end_for;
|
// oaRect::create(topBlock, 0, oaPurpose::get(_oaTech, oacDrawingPurposeType)->getNumber(), box);
|
||||||
}
|
|
||||||
cerr << "transformation of nets" << endl;
|
cerr << "transformation of instances" << endl;
|
||||||
for_each_net(net, cell->getNets()) {
|
for_each_instance(instance, cell->getInstances()) {
|
||||||
oaScalarName scNetName(ns, getString(net->getName()).c_str());
|
Cell* masterCell = instance->getMasterCell();
|
||||||
oaScalarNet* blockNet = oaScalarNet::create(designBlock4Layout, scNetName, getOASigType(net->getType()));
|
oaDesign* masterDesign = getOADesignForCell(masterCell);
|
||||||
if (net->isExternal()) {
|
oaScalarName scMasterName;
|
||||||
oaTerm* term = oaTerm::create(blockNet, scNetName, getOATermType(net->getDirection()));
|
masterDesign->getCellName(scMasterName);
|
||||||
oaPin* pin = oaPin::create(term);
|
oaString strMasterName;
|
||||||
Components externalComponents = NetExternalComponents::get(net);
|
scMasterName.get(strMasterName);
|
||||||
for_each_component(component, externalComponents) {
|
oaScalarName scInstName(ns, getString(instance->getName()).c_str());
|
||||||
oaBox box;
|
|
||||||
getOABoxForBox(box, component->getBoundingBox());
|
oaTransform transform;
|
||||||
oaRect* rect = oaRect::create(designBlock4Layout, 0,
|
getOATransformFromTransformation(transform, instance->getTransformation());
|
||||||
oaPurpose::get(_oaTech, oacDrawingPurposeType)->getNumber(),
|
oaScalarInst* blockInst = oaScalarInst::create(topBlock, masterDesign, scInstName, transform);
|
||||||
box);
|
_instance2OAInstMap[instance] = blockInst;
|
||||||
rect->addToPin(pin);
|
end_for;
|
||||||
end_for;
|
}
|
||||||
|
cerr << "transformation of nets" << endl;
|
||||||
|
for_each_net(net, cell->getNets()) {
|
||||||
|
oaScalarName scNetName(ns, getString(net->getName()).c_str());
|
||||||
|
oaScalarNet* blockNet = oaScalarNet::create(topBlock, scNetName, getOASigType(net->getType()));
|
||||||
|
assert(blockNet);
|
||||||
|
oaOccNet* occNet = blockNet->getOccNet();
|
||||||
|
assert(occNet);
|
||||||
|
assert(blockNet == occNet->getNet());
|
||||||
|
oaModNet* moduleNet = occNet->getModNet();
|
||||||
|
assert(moduleNet);
|
||||||
|
if (net->isExternal()) {
|
||||||
|
oaTerm* term = oaTerm::create(blockNet, scNetName, getOATermType(net->getDirection()));
|
||||||
|
oaPin* pin = oaPin::create(term);
|
||||||
|
Components externalComponents = NetExternalComponents::get(net);
|
||||||
|
for_each_component(component, externalComponents) {
|
||||||
|
oaBox box;
|
||||||
|
getOABoxForBox(box, component->getBoundingBox());
|
||||||
|
Layer* layer = (Layer*) component->getLayer();
|
||||||
|
assert(layer);
|
||||||
|
oaPhysicalLayer* physLayer = NULL;
|
||||||
|
Layer2OAPhysicalLayerMap::iterator it = _layer2OAPhysicalLayerMap.find(layer);
|
||||||
|
if (it != _layer2OAPhysicalLayerMap.end()) {
|
||||||
|
physLayer = it->second;
|
||||||
}
|
}
|
||||||
}
|
assert(physLayer);
|
||||||
cerr << " o transformation of plugs" << endl;
|
oaLayerNum layerNum = physLayer->getNumber();
|
||||||
for_each_plug(plug, net->getPlugs()) {
|
oaRect* rect = oaRect::create(topBlock, layerNum,
|
||||||
Instance* instance = plug->getInstance();
|
oaPurpose::get(_oaTech, oacDrawingPurposeType)->getNumber(),
|
||||||
Instance2OAInstsMap::iterator it = _instance2OAInstMap.find(instance);
|
box);
|
||||||
assert(it != _instance2OAInstMap.end());
|
rect->addToPin(pin);
|
||||||
oaInst* blockInst = it->second;
|
|
||||||
oaInstTerm* instTerm = getInstTerm(blockInst, plug);
|
|
||||||
assert(instTerm);
|
|
||||||
instTerm->addToNet(blockNet);
|
|
||||||
end_for;
|
end_for;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
cerr << " o transformation of plugs" << endl;
|
||||||
|
for_each_plug(plug, net->getPlugs()) {
|
||||||
|
Instance* instance = plug->getInstance();
|
||||||
|
Instance2OAInstsMap::iterator it = _instance2OAInstMap.find(instance);
|
||||||
|
assert(it != _instance2OAInstMap.end());
|
||||||
|
oaInst* blockInst = it->second;
|
||||||
|
oaInstTerm* instTerm = getInstTerm(blockInst, plug);
|
||||||
|
assert(instTerm);
|
||||||
|
instTerm->addToNet(blockNet);
|
||||||
end_for;
|
end_for;
|
||||||
}
|
}
|
||||||
// create a Layout View of the design
|
end_for;
|
||||||
oaDesign* design4Layout = oaDesign::open(scNameLib, scNameDesign, scNameViewLayout, oaViewType::get(oacMaskLayout), 'w');
|
|
||||||
_cell2OADesign4LayoutMap[cell] = design4Layout;
|
|
||||||
if(design4Layout == design4Schematic)
|
|
||||||
cerr << "design4Layout == design4Schematic" << endl;
|
|
||||||
else
|
|
||||||
cerr << "design4Layout != design4Schematic" << endl;
|
|
||||||
return design4Schematic;
|
|
||||||
}
|
}
|
||||||
};
|
return layoutView;
|
||||||
|
}
|
||||||
|
};
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -427,10 +458,10 @@ namespace CRL {
|
||||||
//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,
|
// oaDesignInit(oacAPIMajorRevNumber,
|
||||||
oacAPIMinorRevNumber,
|
// oacAPIMinorRevNumber,
|
||||||
oacDataModelRevNumber);
|
// oacDataModelRevNumber);
|
||||||
|
|
||||||
OADriver oaDriver(path);
|
OADriver oaDriver(path);
|
||||||
oaDesign* design = oaDriver.getOADesignForCell(cell);
|
oaDesign* design = oaDriver.getOADesignForCell(cell);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// -*-compile-command:"cd ../../../../.. && make"-*-
|
// -*-compile-command:"cd ../../../../.. && make"-*-
|
||||||
// Time-stamp: "2010-07-01 15:34:45" - OpenAccessWrapper.h
|
// Time-stamp: "2010-07-07 13:37:14" - 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 |
|
||||||
|
@ -15,7 +15,6 @@
|
||||||
#define __OPENACCESSWRAPPER_H__
|
#define __OPENACCESSWRAPPER_H__
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
namespace Hurricane {
|
namespace Hurricane {
|
||||||
class Library;
|
class Library;
|
||||||
|
@ -25,7 +24,7 @@ namespace Hurricane {
|
||||||
namespace CRL {
|
namespace CRL {
|
||||||
class OpenAccessWrapper {
|
class OpenAccessWrapper {
|
||||||
public:
|
public:
|
||||||
static void oaDriver(const string& cellPath, Cell* cell);
|
static void oaDriver(const std::string& cellPath, Cell* cell);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue