work in progress: create oaViadef from ViaLayer, more advanced Component convertion ...

This commit is contained in:
Jean-Manuel Caba 2010-08-13 16:05:58 +00:00
parent dd47776631
commit b6048dab6f
2 changed files with 652 additions and 582 deletions

View File

@ -1,5 +1,5 @@
// -*-compile-command:"cd ../../../../.. && make"-*- // -*-compile-command:"cd ../../../../.. && make"-*-
// Time-stamp: "2010-08-12 20:20:45" - OpenAccessDriver.cpp // Time-stamp: "2010-08-13 18:02:10" - 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 |
@ -22,10 +22,21 @@ using namespace std;
#include "hurricane/Library.h" #include "hurricane/Library.h"
#include "hurricane/Cell.h" #include "hurricane/Cell.h"
#include "hurricane/NetExternalComponents.h" #include "hurricane/NetExternalComponents.h"
// Go
#include "hurricane/Instance.h"
#include "hurricane/Component.h"
#include "hurricane/Segment.h" #include "hurricane/Segment.h"
#include "hurricane/Vertical.h"
#include "hurricane/Pad.h" #include "hurricane/Pad.h"
// Layer
#include "hurricane/BasicLayer.h" #include "hurricane/BasicLayer.h"
#include "hurricane/Slice.h" #include "hurricane/ContactLayer.h"
#include "hurricane/ViaLayer.h"
#include "hurricane/TransistorLayer.h"
#include "hurricane/DiffusionLayer.h"
#include "hurricane/RegularLayer.h"
using namespace Hurricane; using namespace Hurricane;
#include "OpenAccess.h" #include "OpenAccess.h"
@ -43,10 +54,11 @@ namespace {
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 map<const Cell*, oaCell*> Cell2OACellMap; typedef map<const Cell*, oaCell*> Cell2OACellMap;
typedef map<Instance*, oaInst*> Instance2OAInstsMap; typedef map<const Instance*, oaInst*> Instance2OAInstsMap;
typedef map<Layer*, oaPhysicalLayer*> Layer2OAPhysicalLayerMap; typedef map<const Layer*, oaLayer*> Layer2OALayerMap;
typedef map<Pad*, oaRect*> Pad2OARectMap; typedef map<const ViaLayer*, oaViaDef*> ViaLayer2OAViaDefMap;
typedef map<Component*, oaPathSeg*> Component2OAPathSegMap; typedef map<const Pad*, oaRect*> Pad2OARectMap;
typedef map<const Component*, oaPathSeg*> Component2OAPathSegMap;
string _path; string _path;
oaTech* _oaTech; oaTech* _oaTech;
@ -57,7 +69,8 @@ namespace {
Cell2OADesignMap _cell2OADesign4Layout; Cell2OADesignMap _cell2OADesign4Layout;
Cell2OACellMap _cell2OAcell; Cell2OACellMap _cell2OAcell;
Instance2OAInstsMap _instance2OAInst; Instance2OAInstsMap _instance2OAInst;
Layer2OAPhysicalLayerMap _layer2OAPhysicalLayer; Layer2OALayerMap _layer2OALayer;
ViaLayer2OAViaDefMap _viaLayer2OAViaDef;
Pad2OARectMap _pad2OARect; Pad2OARectMap _pad2OARect;
Component2OAPathSegMap _component2OAPathSeg; Component2OAPathSegMap _component2OAPathSeg;
set<int> _layerIDS; set<int> _layerIDS;
@ -79,7 +92,8 @@ namespace {
_cell2OADesign4Layout(), _cell2OADesign4Layout(),
_cell2OAcell(), _cell2OAcell(),
_instance2OAInst(), _instance2OAInst(),
_layer2OAPhysicalLayer(), _layer2OALayer(),
_viaLayer2OAViaDef(),
_pad2OARect(), _pad2OARect(),
_component2OAPathSeg(), _component2OAPathSeg(),
_layerIDS(), _layerIDS(),
@ -166,7 +180,7 @@ namespace {
handle layerID i.e: get extractNumber in Hurricane world if handle layerID i.e: get extractNumber in Hurricane world if
possible ... possible ...
*/ */
int generateLayerID(BasicLayer* bLayer){ int generateLayerID(const BasicLayer* bLayer){
// the layer number is unique to a particular layer // the layer number is unique to a particular layer
cerr << "generateLayerID -> "; cerr << "generateLayerID -> ";
int numLayer = _layerID; int numLayer = _layerID;
@ -212,33 +226,62 @@ namespace {
} }
} }
/**
helper function
technology MUST exist first
*/
oaLayerNum toOALayerNum(const Layer* hLayer){
assert(hLayer);
oaLayer* layer = toOALayer(hLayer,_oaTech);
assert(layer);
return layer->getNumber();
}
/** /**
convert oaLayer from a Layer ... convert oaLayer from a Layer ...
*/ */
oaPhysicalLayer* toOALayer(Layer* layer,oaTech* theOATech) { oaLayer* toOALayer(const Layer* layer,oaTech* theOATech) {
assert(layer); assert(layer);
cerr << "toOALayer " << getString(layer->getName()) << endl; cerr << "toOALayer " << getString(layer->getName()) << endl;
Layer2OAPhysicalLayerMap::iterator it = _layer2OAPhysicalLayer.find(layer); Layer2OALayerMap::iterator it = _layer2OALayer.find(layer);
if (it != _layer2OAPhysicalLayer.end()) if (it != _layer2OALayer.end())
return it->second; return it->second;
assert(theOATech); assert(theOATech);
// 1) get or create layer // 1) get or create layer
oaString layerName = getString(layer->getName()).c_str(); oaString layerName = getString(layer->getName()).c_str();
oaPhysicalLayer* aOALayer = NULL; oaLayer* aOALayer = NULL;
aOALayer = oaPhysicalLayer::find(theOATech, layerName, true); aOALayer = oaPhysicalLayer::find(theOATech, layerName, true);
if(aOALayer){ if(aOALayer){
_layer2OAPhysicalLayer[layer] = aOALayer; _layer2OALayer[layer] = aOALayer;
_layerIDS.insert(aOALayer->getNumber()); _layerIDS.insert(aOALayer->getNumber());
return aOALayer; return aOALayer;
} }
BasicLayer* bLayer = dynamic_cast<BasicLayer*>(layer); const BasicLayer* bLayer = dynamic_cast<const BasicLayer*>(layer);
if(!bLayer){
cerr << "NOT A BASICLAYER " << layerName;
const ViaLayer* vLayer = dynamic_cast<const ViaLayer*>(layer);
if(vLayer)
cerr << " but is a ViaLayer" << endl;
const ContactLayer* cLayer = dynamic_cast<const ContactLayer*>(layer);
if(cLayer)
cerr << " but is a ContactLayer" << endl;
const DiffusionLayer* dLayer = dynamic_cast<const DiffusionLayer*>(layer);
if(dLayer)
cerr << " but is a DiffusionLayer" << endl;
const TransistorLayer* tLayer = dynamic_cast<const TransistorLayer*>(layer);
if(tLayer)
cerr << " but is a TransistorLayer" << endl;
const RegularLayer* rLayer = dynamic_cast<const RegularLayer*>(layer);
if(rLayer)
cerr << " but is a RegularLayer" << endl;
}
aOALayer = oaPhysicalLayer::create(theOATech, layerName, generateLayerID(bLayer), aOALayer = oaPhysicalLayer::create(theOATech, layerName, generateLayerID(bLayer),
bLayer ? toOAMaterial(bLayer->getMaterial()) bLayer ? toOAMaterial(bLayer->getMaterial())
: oaMaterial(oacOtherMaterial)); : oaMaterial(oacOtherMaterial));
assert(aOALayer); assert(aOALayer);
_layer2OAPhysicalLayer[layer] = aOALayer; _layer2OALayer[layer] = aOALayer;
#if 0 #if 0
//create and add layer constraint for Layer specific manufacturing rules //create and add layer constraint for Layer specific manufacturing rules
@ -253,7 +296,7 @@ namespace {
try{ try{
cMinSize = oaLayerConstraint::create(aOALayer->getNumber(), cMinSize = oaLayerConstraint::create(aOALayer->getNumber(),
oaLayerConstraintDef::get(oacMinSize), oaLayerConstraintDef::get(oacMinSize),
oaIntValue::create(theOATech,500)) oaIntValue::create(theOATech,500));
}catch(oaException& e){ }catch(oaException& e){
cerr << "ERROR oaLayer: " << e.getMsg() << endl; cerr << "ERROR oaLayer: " << e.getMsg() << endl;
exit(-2); exit(-2);
@ -279,6 +322,7 @@ namespace {
oaIntValue::create(theOATech->getLib(),pitch)); oaIntValue::create(theOATech->getLib(),pitch));
assert(cPitchV); assert(cPitchV);
#endif #endif
return aOALayer; return aOALayer;
} }
@ -509,58 +553,51 @@ namespace {
return box; return box;
} }
oaRect* toOARect(Pad* component,oaBlock* topBlock){
cerr << "toOARect" << endl;
assert(component);
assert(topBlock);
Pad2OARectMap::iterator it = _pad2OARect.find(component);
/**
Used to convert Pad
*/
oaRect* toOARect(Pad* pad,oaNet* blockNet){
cerr << "toOARect" << endl;
assert(pad);
assert(blockNet);
Pad2OARectMap::iterator it = _pad2OARect.find(pad);
if (it != _pad2OARect.end()) if (it != _pad2OARect.end())
return it->second; return it->second;
oaBox box = toOABox(component->getBoundingBox()); oaRect* rect = oaRect::create(blockNet->getBlock(),
Layer* layer = (Layer*) component->getLayer(); toOALayerNum( pad->getLayer() ),
assert(layer);
oaPhysicalLayer* physLayer = toOALayer(layer,_oaTech);
assert(physLayer);
oaLayerNum layerNum = physLayer->getNumber();
oaRect* rect = oaRect::create(topBlock,
layerNum,
oacDrawingPurposeType, oacDrawingPurposeType,
box); toOABox(pad->getBoundingBox()) );
return rect; return rect;
} }
/**
Used to convert Segment
*/
oaPathSeg* toOAPathSeg(Segment* segment,oaNet* blockNet){ oaPathSeg* toOAPathSeg(Segment* segment,oaNet* blockNet){
#if 0
cerr << "toOAPathSeg" << endl; cerr << "toOAPathSeg" << endl;
assert(component); assert(segment);
assert(blockNet); assert(blockNet);
Component2OAPathSegMap::iterator it = _component2OAPathSeg.find(component); Component2OAPathSegMap::iterator it = _component2OAPathSeg.find(segment);
if (it != _component2OAPathSeg.end()) if (it != _component2OAPathSeg.end())
return it->second; return it->second;
oaBox box = toOABox(component->getBoundingBox()); oaSegStyle style(segment->getWidth(), oacTruncateEndStyle, oacTruncateEndStyle);
Layer* layer = (Layer*) component->getLayer(); oaPathSeg* res = oaPathSeg::create(blockNet->getBlock(),
assert(layer); toOALayerNum( segment->getLayer() ),
oaPhysicalLayer* physLayer = toOALayer(layer,_oaTech);
assert(physLayer);
oaLayerNum layerNum = physLayer->getNumber();
oaSegStyle style(, oacTruncateEndStyle, oacTruncateEndStyle);
res = oaPathSeg::created(blockNet->getBlock(),
,
oacDrawingPurposeType, oacDrawingPurposeType,
toOAPoint(), toOAPoint(segment->getSourcePosition()),
toOAPoint(), toOAPoint(segment->getTargetPosition()),
); style);
return res; return res;
#endif
return NULL;
} }
/** /**
create a Pin from Pin Used to convert Pin
*/ */
oaPin* toOAPin(Pin* hpin,oaNet* blockNet){ oaPin* toOAPin(Pin* hpin,oaNet* blockNet){
cerr << "toOAPin" << endl; cerr << "toOAPin" << endl;
@ -579,8 +616,41 @@ namespace {
return pin; return pin;
} }
/**
used to convert Via
@todo implement me ...
*/
oaVia* toOAVia(Contact* contact,oaNet* blockNet){ oaVia* toOAVia(Contact* contact,oaNet* blockNet){
//TODO //TODO
#if 0
// Get via layers from the technology database oaPhysicalLayer *poly = oaPhysicalLayer::find(tech, "Poly");
ViaLayer::ViaLayer
oaPhysicalLayer *imp1 = oaPhysicalLayer::find(_oaTech, "Nimp");
oaPhysicalLayer *imp2 = oaPhysicalLayer::find(_oaTech, "Pimp");
oaPhysicalLayer *metal1 = oaPhysicalLayer::find(tech, "Metal1");
oaPhysicalLayer *cut = oaPhysicalLayer::find(tech, "Via1");
// Set up the oaStdViaDef parameters
oaViaParam stdViaDefParam;
stdViaDefParam.setCutLayer(cut->getNumber());
stdViaDefParam.setCutWidth(1000);
stdViaDefParam.setCutHeight(1000);
stdViaDefParam.setCutSpacing(100);
stdViaDefParam.setCutColumns(4);
// Create the oaStdViaDef oaStdViaDef *myStdViaDef =
oaStdViaDef::create(tech, oaString("myStdViaDef"), poly, metal1,
stdViaDefParam, imp1, imp2);
// Create the oaStdViaDef
oaTransform zeroTrans(oaPoint(0, 0), oacR0);
oaStdVia* via = oaStdVia::create(blk, myStdViaDef, zeroTrans);
return via;
#endif
return NULL; return NULL;
} }
@ -646,37 +716,37 @@ namespace {
blockNet->setGlobal(net->isGlobal()); blockNet->setGlobal(net->isGlobal());
blockNet->scalarize();//ensure we can add shape .. blockNet->scalarize();//ensure we can add shape ..
#if 0
//logical part //logical part
cerr << " o transformation of plugs" << endl; cerr << " o transformation of plugs" << endl;
for_each_plug(plug, net->getPlugs()) { for_each_plug(plug, net->getPlugs()) {
InstTerm* term = toOAInstTerm(plug, blockNet); oaInstTerm* term = toOAInstTerm(plug, blockNet);
term->addToNet(blockNet); term->addToNet(blockNet);
end_for; end_for;
} }
cerr << " o transformation of contacts" << endl; cerr << " o transformation of contacts" << endl;
for_each_contact(contact, getContacts()) { for_each_contact(contact, net->getContacts()) {
Pin* hPin = dynamic_cast<Pin*>(contact); Pin* hPin = dynamic_cast<Pin*>(contact);
oaPin* pin = NULL; oaPin* pin = NULL;
if(hPin) if(hPin)
pin = toOAPin(pin, blockNet); pin = toOAPin(hPin, blockNet);
#if 0
oaVia* via = toOAVia(contact, blockNet); oaVia* via = toOAVia(contact, blockNet);
via->addToNet(blockNet); via->addToNet(blockNet);
#endif
end_for; end_for;
} }
cerr << " o transformation of pads" << endl; cerr << " o transformation of pads" << endl;
for_each_pad(pads, getPads()){ for_each_pad(pad, net->getPads()){
oaRect* rect = toOARect(contact, blockNet); oaRect* rect = toOARect(pad, blockNet);
rect->addToNet(blockNet); rect->addToNet(blockNet);
end_for; end_for;
} }
cerr << " o transformation of segments" << endl; cerr << " o transformation of segments" << endl;
for_each_segments(component, net->getSegments()) { for_each_segment(component, net->getSegments()) {
oaShape* shape = toOAPathSeg(component,blockNet); oaPathSeg* shape = toOAPathSeg(component,blockNet);
shape->addToNet(blockNet); shape->addToNet(blockNet);
end_for; end_for;
} }
#endif
return blockNet; return blockNet;
} }
@ -828,7 +898,7 @@ namespace {
} }
assert(topBlock); assert(topBlock);
// 4) convert each OA object // 4) convert each instance, net to OA
cerr << "transformation of instances" << endl; cerr << "transformation of instances" << endl;
for_each_instance(instance, cell->getInstances()){ for_each_instance(instance, cell->getInstances()){
toOAInst(instance,topBlock); toOAInst(instance,topBlock);

View File

@ -1,6 +1,6 @@
TESTDIR= ./testOA TESTDIR= ./testOA
TECHNOFILE= /asim/chams/etc/chams/config.freePDK45.xml TECHNOFILE= /dsk/l1/misc/caba/coriolis-2.x/Linux.SLSoC5x/Release.Shared/install/etc/chams/config.freePDK45.xml
M=$$(uname -m) M=$$(uname -m)
all: compile lefTest run all: compile lefTest run